While assuming a frictionless inclined plane, we use the work-energy theorem W = ΔE:
Ki + Wg + Ws = Kf, showing that the mechanical energy of the system is conserved
(1/2)mv2 + mgsinθ(d+x) + [0 - (1/2)kx2] = 0 where the vertical height from the final position is sinθ(d+x).
To simplify, we divide the equation by m:
(1/2)v2 + gsinθ(d+x) - (k/2m)x2 = 0
(k/2m)x2 - (gsinθ)x - (gsinθ)d - (v2/2) = 0
Arranging the quadratic equation in the form ax2 + bx + c = 0,
(k/2m)x2 - (gsinθ)x - [ (v2/2) + (gsinθ)d ] = 0
we can solve for x using the quadratic formula:
x = {gsinθ ± sqrt[ (gsinθ)2 + 4(k/2m)(v2/2 + (gsinθ)d) ]} / 2(k/2m)
x = {gsinθ + sqrt[ (gsinθ)2 + (2k/m)(v2/2 + gdsinθ) ]} / (k/m)