# How do I calculate the lagrangian of a planet orbiting a star and find its equation of motion? [closed]

So, it's basically what the title says. I was messing around with some systems that I found would be interesting to calculate their lagrangians, and one of these systems is a planet in an elliptical orbit around a star.

When I was trying to solve this problem, I started by just writing the potential energy $$U=-\frac{GMm}{r}$$ and then the kinetic energy. But then I remembered that the velocity of a body in an elliptical orbit can be written as $$v=\sqrt{GMm\left(\frac{2}{r}-\frac{1}{a}\right)}$$ where $$a$$ is the semimajor axis of the ellipse. And so the kinetic energy is just that squared times $$m$$.

So my final lagrangian came out as $$L=\frac{1}{2}GMm^{2}\left(\frac{2}{r}-\frac{1}{a}\right)+\frac{GMm}{r}$$ However, when I tried to solve for the equation of motion, I got to some nonsensical conclusions. I know I probably blundered along the way, but I don't know where. I would be grateful with any help or hints towards solving this!

• The problem is mostly that you've put the cart before the horse. The fact that the velocity of a body in an elliptical orbit can be written in the way you state should be the result of solving the Lagrange equations. Taking that known end result and plugging in back in the beginning will lead to nonsense. The Lagrangian is a functional of position and velocity, and substituting in implicit relationships between the two means that it isn't the Lagrangian anymore. Commented May 25, 2021 at 13:31
• @jwimberley Your comment is an answer. I suggest you move it before it gets deleted. And I believe it sufficiently addresses the difficulty the OP has. We don't need to provide the specific Lagrangian to OP. As you say, the cart has been put before the horse! Commented May 25, 2021 at 13:36
• It's better to begin an analysis of orbits with Newtonian mechanics, though we can switch to a Lagrangian when we've learned enough.
– J.G.
Commented May 25, 2021 at 14:33

To give a very simple example, consider a spring with potential $$U=\frac{1}{2}kx^2$$, and thus a Lagrangian $$\mathcal{L} = \frac{1}{2} mv^2 - \frac{1}{2} kx^2$$ Solving Lagrange's equations will tell you that $$ma = -kx$$, from which you can derive that $$mv^2 = k(A^2-x^2)$$ for some amplitude $$A$$. Plugging that back in to the formal expression for the Lagrangian gives $$\frac{1}{2} k(A^2 - x^2) - \frac{1}{2} kx^2 = \frac{1}{2}kA^2 - kx^2$$ As a Lagrangian, this would be nonsense, since the important dependence on $$v$$ has been eliminated. The expression is essentially the value of the Lagrangian itself along the path in phase space taken by the system.