Lagrangian Mechanics & Derivatives
I don't really know whether to put this in Physics forums since it is relating to Mechanics, or Math since the question is actually about the math being done. Don't criticize me over it.
So for the question: I was doing some review problems on Lagrange's equations, KE+PE, and I found this document.
In the first question's solution, the writer differentiates without explaining the step. They have these:
$$\begin{cases} x = r \sin(\theta) \cos(\phi)\\[5 pt] y = r \sin(\theta) \sin(\phi)\\[5 pt] z = r \cos(\theta) \end{cases} $$
and this:
$$T = {m\over 2}(\dot x^2 +\dot y^2 +\dot z^2)$$
I never really studied the spherical coordinate system much, and obviously never thought about the derivatives of the conversion into Cartesian. Can someone find or explain the process of taking the derivatives of the first three equations, plugging into the equation for Kinetic Energy, and simplifying? There is a probably a different calculus method for the coordinate system, which I don't know. Thanks!
EDIT: While doing taking the derivatives, was the method used actually a separate form of calculus beyond I and II, or was it normal first-order differentiation? If so, how? Here is the part I am speaking of:
Solution: The kinetic energy is $T=\frac m2(\dot x^2+\dot y^2+\dot z^2)$. We substitute $$\begin{cases} x = r \sin(\theta) \cos(\phi)\\[5 pt] y = r \sin(\theta) \sin(\phi)\\[5 pt] z = r \cos(\theta) \end{cases} $$ Differentiating these, substituting into $T$, and simplifying, we find $$T=\frac m2 (\dot r^2 +r^2\dot\theta^2+r^2\sin^2\theta\dot\phi^2).$$
Solution 1:
I think this question belongs to PSE! But whatever, here's your answer: you have to remember that $\dot x$ is a complete derivative of $x$ with respect to time. Going to a new representation of $x$ in a new system, like in your case $x(r,\theta,\phi)$ for the spherical coordinates, where, and this is important, all the coordinates are functions of time $$r\equiv r(t)\\ \theta \equiv \theta(t) \\\phi\equiv\phi(t)$$ transforms the complete time derivative in this manner
$$ \dot x = \frac{\partial x}{\partial r}\frac{\mathrm d r}{\mathrm d t}+\frac{\partial x}{\partial \theta}\frac{\mathrm d \theta}{\mathrm d t}+\frac{\partial x}{\partial \phi}\frac{\mathrm d \phi}{\mathrm d t} \\ \dot x = \frac{\partial x}{\partial r}\dot r+\frac{\partial x}{\partial \theta}\dot\theta+\frac{\partial x}{\partial \phi}\dot\phi \\ \dot x = (\sin\theta\cos\phi)\dot r + (r\cos\theta\cos\phi)\dot\theta - (r\sin\theta\sin\phi)\dot\phi $$
where the last equation was evaluated from the definition of $x=r\sin\theta\cos\phi$. Now same goes for the other variables, which get's you
$$ \dot y = (\sin\theta\sin\phi)\dot r+(r\cos\theta\sin\phi)\dot\theta+(r\sin\theta\cos\phi)\dot\phi \\ \dot z = (\cos\theta)\dot r-(r\sin\theta)\dot\theta $$
From this three equations, it's just a manner of squaring them all, summing them and seeing what you get! Tedious work, but is has to be done sometimes:
$$ \dot x^2 =\sin^2\theta\cos^2\phi\dot r^2+r^2\cos^2\theta\cos^2\phi\dot\theta^2 +r^2\sin^2\theta\sin^2\phi\dot\phi^2+\\ +2r\sin\theta\cos\theta\cos\phi^2\dot r\dot\theta\color{blue}{-2r\sin^2\theta\cos\phi\sin\phi\dot r\dot\phi}\color{red}{-2r^2\cos\theta\sin\theta\cos\phi\sin\phi\dot\theta\dot\phi}\\[10 pt] \dot y^2 = \sin^2\theta\sin^2\phi\dot r^2+r^2\cos^2\theta\sin^2\phi\dot\theta^2+r^2\sin^2\theta\cos^2\phi\dot\phi^2+\\+2r\cos\theta\sin\theta\sin^2\phi\dot r\dot\theta \color{blue}{+ 2r\sin^2\theta\cos\phi\sin\phi\dot r\dot\phi }\color{red}{+2r^2\cos\theta\sin\theta\cos\phi\sin\phi\dot\theta\dot\phi}\\[10 pt] \dot z^2 = \cos^2\theta\dot r^2+r^2\sin^2\theta\dot\theta^2-2r\cos\theta\sin\theta\dot r\dot\theta $$
Let's evaluate the sum keeping in mind that the coloured parts, clearly, add up to zero with one another (we'll see that other parts add up to zero but not so easily):
$$\begin{align} (\dot x^2+\dot y^2+\dot z^2) &= \dot r^2 (\sin^2\theta\cos^2\phi+\sin^2\theta\sin^2\phi+\cos^2\theta)\tag1\\ &+{}r^2\dot\theta^2(\cos^2\theta\cos^2\phi+\cos^2\theta\sin^2\phi+\sin^2\theta)\tag2\\ &+{}r^2\dot\phi^2(\sin^2\theta\sin^2\phi+\sin^2\theta\cos^2\phi)\tag3\\ &+{}2r\dot r\dot\theta(\sin\theta\cos\theta\cos^2\phi+\cos\theta\sin\theta\sin^2\phi-\cos\theta\sin\theta)\tag4 \end{align} $$
Now it probably seems all wrong! But, keeping in mind the formula $$\cos^2\theta+\sin^2\theta=1$$ we can do lot's of things:
Formula $(1)$ $$ \color{red}{\sin^2\theta}\cos^2\phi+\color{red}{\sin^2\theta}\sin^2\phi+\cos^2\theta = \color{red}{\sin^2\theta}\underbrace{(\cos^2\phi+\sin^2\phi)}_{\text{is one}}+\color{red}{\cos^2\theta} \\[5 pt] = \sin^2\theta+\cos^2\theta = 1 $$
Formula $(2)$ $$ \color{red}{\cos^2\theta}\cos^2\phi+\color{red}{\cos^2\theta}\sin^2\phi+\sin^2\theta = \cos^2\theta(\cos^2\phi+\sin^2\phi)+\sin^2\theta = \\ =\cos^2\theta+\sin^2\theta = 1 $$
Formula $(3)$ $$ \color{red}{\sin^2\theta}\sin^2\phi+\color{red}{\sin^2\theta}\cos^2\phi= \sin^2\theta(\sin^2\phi+\cos^2\phi)=\sin^2\theta $$
Formula $(4)$ $$ \color{red}{\sin\theta\cos\theta}\cos^2\phi+\color{red}{\cos\theta\sin\theta}\sin^2\phi-\cos\theta\sin\theta = \sin\theta\cos\theta(\cos^2\phi+\sin^2\phi)-\cos\theta\sin\theta = \\ = \sin\theta\cos\theta-\sin\theta\cos\theta=0 $$
Finally, plugging it all back into the sum of the derivatives squared what we get is
$$ (\dot x^2+\dot y^2+\dot z^2) =\dot r^2+r^2\dot\theta^2+r^2\sin^2\theta\dot\phi^2 $$
which is exactly your formula!
Solution 2:
This is a (relatively tedious) application of the chain and product rule.
$$z=r \cos \theta$$
$$\frac{dz}{dt}=\frac{d}{dt} \left( r \cos \theta \right)$$
Applying the product rule,
$$=\frac{dr}{dt} \cos \theta+ \frac{d \cos \theta}{dt} r$$
Applying the chain rule,
$$=\dot r \cos \theta+\frac{d \cos \theta}{d \theta} \frac{d \theta}{dt} r$$
$$=\dot r \cos \theta-r \dot \theta \sin \theta $$
It is a similar exercise to differentiate $r\sin \theta$ with respect to time.
$$y=r \sin \theta \sin \phi$$
$$\dot y=\sin \phi \frac{d}{dt} (r \sin \theta)+r \sin \theta\frac{d}{dt} \sin \phi$$
$$= \sin \phi \frac{d}{dt} (r \sin \theta)+r \sin \theta\frac{d \sin \phi}{d\phi} \frac{d\phi}{dt}$$
$$=\sin \phi \left( \dot r \sin \theta+\dot \theta r \cos \theta \right)+r \dot \phi \sin \theta \cos \phi$$
$$x=r \sin \theta \cos \phi$$
$$\dot x=\cos \phi \frac{d}{dt}\left(r \sin \theta \right)+r \sin \theta \frac{d}{dt} \cos \phi$$
$$=\cos \phi \left(\dot r \sin \theta+\dot \theta r \cos \theta \right)-r \dot \phi \sin \theta \sin \phi $$
In order to calculate $\dot x^2+\dot y^2$ without too much trouble, make the substitution $u= \dot r \sin \theta+\dot \theta r \cos \theta$ and $v=r \dot \phi \sin \theta$. Then we wish to calculate,
$$(u \sin \phi +v \cos \phi)^2+(u \cos \phi-v \sin \phi)^2$$
$$=u^2+v^2$$
$$=(\dot r \sin \theta+\dot \theta r \cos \theta )^2+r^2 \dot \phi^2 \sin^2 \theta$$
Next, to calculate, $\dot x^2+\dot y^2+\dot z^2$ note:
$$(\dot r \sin \theta+\dot \theta r \cos \theta )^2+\left(\dot r \cos \theta-r \dot \theta \sin \theta \right)^2$$
$$=\dot r^2+r^2 \dot \theta^2$$
So,
$$\dot x^2+\dot y^2+\dot z^2= \dot r^2+r^2 \dot \theta^2+ r^2 \dot \phi^2 \sin^2 \theta$$
As expected.
Solution 3:
To convert the cartesian expression for kinetic energy,
$T = \dfrac{m}{2}(\dot x^2 + \dot y^2 + \dot z^2) \tag 1$
into sperical coordinates $r,\phi, \theta$ such that
$x = r \sin \theta \cos \phi, \tag 2$
$y = r\sin \theta \sin \phi, \tag 3$
$z = r\cos \theta, \tag{4}$
we merely need employ two standard results from elementary calculus, namely, the Leibniz product rule and the chain rule; the calculations are all in the realm of basic first-order differentiation using these two principles. I will start by illustrating how these concepts apply to $z$ (4), since it is the simplest of the three expressions (2)-(4); from (4), by the product rule, where I use $\dot{}$ and ${}´$ both to represent the $t$-derivative,
$\dot z = \dot r \cos \theta + r (\cos \theta)'; \tag 5$
we apply the chain rule to (5):
$(\cos \theta)' = \left (\dfrac{d\cos \theta}{d\theta} \right ) \dot \theta = -\dot \theta \sin \theta; \tag 6$
thus (5) becomes
$\dot z = \dot r \cos \theta - r \dot \theta \sin \theta; \tag 7$
we similarly handle $x$ as in (2): again, the product rule yields
$\dot x = \dot r \sin \theta \cos \phi + r(\sin \theta)'\cos \phi + r\sin \theta (\cos \phi)', \tag 8$
and again we apply the chain rule, this time twice:
$(\sin \theta)' = \dfrac{d\sin \theta}{d\theta} \dot \theta = \dot \theta \cos \theta, \tag 9$
$(\cos \phi)' = \dfrac{d\cos \phi}{d \phi} \dot \phi = -\dot \phi \sin \phi; \tag{10}$
assembling (8)-(10) together:
$\dot x = \dot r \sin \theta \cos \phi + r\dot \theta \cos \theta \sin \phi - r\dot \phi \sin \theta \sin \phi; \tag{11}$
y a parellel procedure, first using the Leibniz and the chain rule, we also have
$\dot y = \dot r \sin \theta \sin \phi + r \dot \theta \cos \theta \sin \phi + r \dot \phi \sin \theta \cos \phi; \tag{12}$
with (7), (11)-(12) at hand, calculating $\dot x^2 + \dot y^2 + \dot z^2$ in sphericals involves no more than a good slug o' algebra; but there is really nothing to see in it that hasn't been very nicely and more than adequately presented by our colleagues David Morgante and Ahmed S. Ataalla.
So I think I'll leave off now. My main point and interest here has been to point out how the Leibniz and chain rules, both results of basic calculus, are used to effect the transformation of the velocities, which then leads to the expression for $T$ in spherical coordinates, as others have shown.