Answer:
At equilibrium, the sum of vertical forces are equal to zero. Let's analyze the downward and upward components of the forces.
Downward forces:
(Gravity)(
is the gravitational constant.)
Upward forces:
(Spring)
Equilibrium condition:
.


so

Step-by-step explanation:
If there is no masses hanging from the spring, the length of the spring is equal to
. When there is a mass M hanging, the spring will be stretched by an amount of
. This distance can be found by using the equilibrium condition, that the sum of the forces is equal to zero.