If I attempt to find the displacement $x$, from equilibrium when a mass, $M$ is attached to an upside down vertical spring with spring constant $k$ I get two different answers when I use energy considerations and when I use forces. There is probably some simple conceptual mistake I am making but I can't identify it. Here are the equations I am referring to
$0=\frac{1}{2}kx^2-mgx$, (making our equilibrium point, $y = 0$) $$x=\frac{2mg}{k}$$ Now using forces, $$mg=kx$$ $$mg/k=x$$ Obviously $2mg/k$ is not equal to $mg/k$ so what is my mistake?