What steps would you follow to change coordinate systems for this Lagrangian? (Cartesian to Spherical)

coordinate systemseuler-lagrange-equationmultivariable-calculus

I'm self-teaching my way through "Lagrangian and Hamiltonian Dynamics" by Peter Mann and find myself stumbling on the following basic transformation.

Consider the following Lagrangian (for a particle in a central potential):
$$\mathscr{L}=\frac{1}{2}m(\dot{x}^2+\dot{y}^2+\dot{z}^2)-U(r)$$
I'd like to convert to spherical coordinates using the relations $x=r \sin(\theta)\cos(\phi), y=r\sin(\theta)\sin(\phi),z=r\cos\theta$.

The text then skips right to the following result:
$$\mathscr{L}=\frac{1}{2}m(\dot{r}^2+\dot{r}^2\dot{\theta}^2+r^2\dot{\phi}^2\sin^2(\theta))-U(r)$$

My question is how do we go from the cartesian to the spherical result? I've tried obtaining $\dot{x}$ etc. from differentiation rules (chain rule, product rule etc.) and subbing into $\mathscr{L}$ but I end up with a much more complex looking result:
$$\mathscr{L}=\frac{1}{2} m \left(\left(r'(t) \sin (\theta (t)) \sin (\phi (t))+r(t) \theta '(t) \cos (\theta (t)) \sin
(\phi (t))+r(t) \sin (\theta (t)) \phi '(t) \cos (\phi (t))\right)^2+\left(r'(t) \sin (\theta
(t)) \cos (\phi (t))+r(t) \theta '(t) \cos (\theta (t)) \cos (\phi (t))-r(t) \sin (\theta (t))
\phi '(t) \sin (\phi (t))\right)^2+\left(r'(t) \cos (\theta (t))-r(t) \theta '(t) \sin (\theta
(t))\right)^2\right)-u(t)$$

Please forgive the messy notation here. If it's just a matter of simplifying with trig-identities, I'd appreciate any resources that would help me sharpen that skill.

Best Answer

Btw you have a typo, it should be $r^2\dot{\theta}^2$ in the Lagrangian. It really is just a matter of expanding out the squares and adding them up and using $\sin^2+\cos^2=1$. To keep the calculations organized, first write down what you know: \begin{align} \begin{cases} \dot{x}&=\dot{r}\sin\theta\cos\phi+r\dot{\theta}\cos\theta\cos\phi-r\dot{\phi}\sin\theta\sin\phi\\ \dot{y}&=\dot{r}\sin\theta\sin\phi+r\dot{\theta}\cos\theta\sin\phi+r\dot{\phi}\sin\theta\cos\phi\\ \dot{z}&=\dot{r}\cos\theta-r\dot{\theta}\sin\theta \end{cases} \end{align} Now, we have to square each of these and add them up. Now, recall that \begin{align} (a+b+c)^2=a^2+b^2+c^2+2ab+2ac+2bc. \end{align} So, by inspection, the coefficient of $\dot{r}^2$ is $(\sin\theta\cos\phi)^2+(\sin\theta\sin\phi)^2+(\cos\theta)^2=1$. Similarly, the coefficient of $\dot{\theta}^2$ is $r^2$, and the coefficient of $\dot{\phi}^2$ is $r^2\sin^2\theta$. You can then verify that the "cross-velocities" cancel out. For example, the coefficient of $\dot{r}\dot{\theta}$ is \begin{align} 2(\sin\theta\cos\phi)(r\cos\theta\cos\phi)+ 2(\sin\theta\sin\phi)(r\cos\theta\sin\phi)+2(\cos\theta)(-r\sin\theta)&=0. \end{align} Similarly, the coefficients of $\dot{r}\dot{\phi}$ and $\dot{\theta}\dot{\phi}$ are both zero. Hence, \begin{align} \mathscr{L}=\frac{m}{2}\left(\dot{r}^2+r^2\dot{\theta}^2+r^2\sin^2(\theta)\dot{\phi}^2\right)-U(r). \end{align}