Begin by considering the deflected shape
Note that the two displacement variables, \(u\) and \(v\) are related by the equation
\[\begin{align} u + \sqrt{L^{2} - v^{2}} & = \frac{u}{2} + L \\ \frac{u}{2} & = L - \sqrt{L^{2} - v^{2}} \\ \frac{u}{2L} & = 1 - \sqrt{1 - \frac{v^{2}}{L^{2}}} \\ & \approx \frac{1}{2} \frac{v^{2}}{L^{2}} \\ \frac{u}{2} & = \frac{1}{2} v^{2} \frac{1}{L} \\ \end{align}\]
Now use the substitution \(k_{g} = \frac{2}{L}\)
\[ u = \frac{1}{2} k_{g} v^{2} \]
Work done through moving \(P\) a distance \(u\):
\[\begin{align} W & = P u \\ & = P \frac{1}{2} k_{g} v^{2} \end{align}\]
Energy stored in spring:
\[ V = \frac{1}{2} k_{m} v^{2} \]
Total energy in system
\[\begin{align} \Pi & = V - W \\ & = \frac{1}{2}k_{m} v^{2} - P \frac{1}{2} k_{g} w^{2} \end{align}\]