I'm solving the equations of motion for a spring attached to a wall with a mass $m$ on the other end that is subject to Earth's gravitational field, $\vec{g}$. An obvious set of coordinates is the cartesian system, $(x,y)$. However, you could also use the elongation of the spring and the vertical position of the mass, $(q,y)$. This greatly simplifies the lagrangian since the Hooke potential depends on the elongation and not simply the cartesian coordinates. However, we have:


Where $x_0$ and $y_0$ are the equilibrium positions. Obviously, then, $q=q(x,y)$. The dependency with $x$ is irrelevant since we aren't considering it as a generalised coordinate. However, the dependency with $y$ seems to be relevant for one of the Lagrange equations, namely:

$$\frac{d}{dt}\left(\frac{\partial L}{\partial \dot{y}} \right)-\frac{\partial L}{\partial y}=0$$

Because $L$ depends on $y$ both explicitly and implicitly from $q$ . Is it simply that, since these are partial derivatives, we are to only consider explicit dependence with $y$ and $\dot y$?

  • $\begingroup$ Your kinetic term for x (the $\frac{1}{2}m\dot x^2$ term) is going to look really complicated once you substitute in for $\dot x = \dot x(q,y,\dot q, \dot y)$. And you are going to have to account for this in your partials wrt y and $\dot y$. It's because in order to move y with q fixed you also have to move x (and vice versa). $\endgroup$
    – hft
    Jun 2, 2022 at 0:04
  • $\begingroup$ Suggestion to the post (v1): Consider to include a figure for clarity. $\endgroup$
    – Qmechanic
    Jun 2, 2022 at 3:08

1 Answer 1


Your system has 2 dof due to the generalised coordinates and 2 more for their generalized velocities. You can pick any pair of coordinates that you consider appropiate.

I think you are missinterpreting what dependence means. The relation between $x,y,q$ implies that only 2 of the 3 variables can be considered independent simultaneously. However, it could be any pair of them. For instance, you could write $x = x(q,y)$ where $x$ is the dependent variable.

In this case, $q,y,\dot{q},\dot{y}$ are independent and $x,\dot{x}$ are functions of those (and should be differenciated accordingly if you kept them around on the Lagrangian).

As one of the comments mentioned, some pairs of varaibles will lead to easier terms on kinnetic energy, while others might simplify the expression for potential energy, but any choice will result on the same physics.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.