# Chain rule applied on Jacobian

Say we want to find the acceleration vector in spherical coordinates and in cartesian basis.

By defining the position vectors in cartesian, $$\mathbf{x}=(x,y,z)$$, and in spherical coordinates, $$\mathbf{r}=(r,\theta, \Phi)$$, and using chain rule, we can first determine the velocity as

$$\mathbf{v}=\dfrac{d\mathbf{x}(r,\theta,\Phi)}{dt}=\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}\dfrac{d\mathbf{r}}{dt},$$

where

\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}= \left( \begin{aligned} \boldsymbol{\nabla}x\\ \boldsymbol{\nabla}y\\ \boldsymbol{\nabla}z \end{aligned} \right), is the jacobian.

Then differentiating once again wrt time, we'd get the acceleration:

$$\mathbf{a}=\dfrac{d\mathbf{v}}{dt}=\dfrac{d}{dt}\left(\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}(r,\theta,\Phi)\right)\dfrac{d\mathbf{r}}{dt}+\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}\dfrac{d^2\mathbf{r}}{dt^2}.$$

Now, what I'm wondering is whether $$\dfrac{d}{dt}\left(\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}(r,\theta,\Phi)\right)\dfrac{d\mathbf{r}}{dt}\overset{?}{=}\left(\dfrac{\partial}{\partial\mathbf{r}}\left(\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}\right)\dfrac{d\mathbf{r}}{dt}\right)\dfrac{d\mathbf{r}}{dt}.$$

But this doesn't look too good since I can't tell if this yield a vector and I don't know what that "second derivative jacobian" is.

Instead, if I do chain rule manually and rearranging, I get something more complex which is a matrix of directional derivatives of each jacobian component with direction $$\mathbf{\dot r}$$. Is there any way I can derive the chain rule of jacobian in a simpler and intelligible way?

## 1 Answer

The Chain and Product rule are applied as usual, then the second chain rule is applied as you might expect.

$$\dfrac{\partial^2\mathbf x}{\partial\mathbf r~^2}(r,\theta,\phi)$$ is a $$3\times 3\times 3$$ tensor. When multiplied, twice, by the $$t$$-differential of $$\mathbf r$$, the result is a $$3$$ vector, as required.

\begin{align}&\dfrac{\mathrm d^2( \mathbf x\circ\mathbf r)}{\mathrm d t~^2}\\ &= \dfrac{\mathrm d ~~}{\mathrm d t}\left(\dfrac{\partial\mathbf x}{\partial\mathbf r}\circ\mathbf r~\cdot \dfrac{\mathrm d\mathbf r}{\mathrm d t}\right)\\ &=\left(\dfrac{\mathrm d ~~}{\mathrm d t}\dfrac{\partial\mathbf x}{\partial\mathbf r}\circ\mathbf r\right)\cdot\dfrac{\mathrm d\mathbf r}{\mathrm d t}+\left(\dfrac{\partial\mathbf x}{\partial\mathbf r}\circ\mathbf r\cdot \dfrac{\mathrm d^2\mathbf r}{\mathrm d t~^2}\right)\\&= \left(\dfrac{\partial^2\mathbf x}{\partial\mathbf r~^2}\circ\mathbf r\cdot\dfrac{\mathrm d\mathbf r}{\mathrm d t}\right)\cdot\dfrac{\mathrm d\mathbf r}{\mathrm d t}+\left(\dfrac{\partial\mathbf x}{\partial\mathbf r}\circ\mathbf r\cdot \dfrac{\mathrm d^2\mathbf r}{\mathrm d t~^2}\right)\\&=\left(\begin{array}{c:c:c}\begin{matrix}x_{rr}& x_{\theta r} & x_{\phi r}\\y_{rr}& y_{\theta r} & y_{\phi r}\\ z_{rr}& z_{\theta r} & z_{\phi r}\end{matrix}&\begin{matrix}x_{r\theta}& x_{\theta\theta} & x_{\phi\theta}\\y_{r\theta}& y_{\theta\theta} & y_{\phi\theta}\\ z_{r\theta}& z_{\theta\theta} & z_{\phi \theta}\end{matrix}&\begin{matrix}x_{r\phi}& x_{\theta\phi} & x_{\phi\phi}\\y_{r\phi}& y_{\theta\phi} & y_{\phi\phi}\\ z_{r\phi}& z_{\theta\phi} & z_{\phi \phi}\end{matrix}\end{array}\right)\begin{pmatrix}\dot r\\\dot\theta\\\dot\phi\end{pmatrix}\begin{pmatrix}\dot r\\\dot\theta\\\dot\phi\end{pmatrix}+\begin{pmatrix}x_r& x_\theta & x_\phi\\y_r&y_\theta&y_\phi\\z_r & z_\theta& z_\phi\end{pmatrix}\begin{pmatrix}\ddot r\\\ddot\theta\\\ddot\phi\end{pmatrix}\\&=\begin{pmatrix}x_{rr}\dot r+x_{r\theta}\dot\theta+x_{r\phi}\dot\phi&x_{\theta r}\dot r+x_{\theta\theta}\dot\theta+x_{\theta\phi}\dot\phi&x_{\phi r}\dot r+x_{\phi\theta}\dot\theta+x_{\phi\phi}\dot\phi\\y_{rr}\dot r+y_{r\theta}\dot\theta+y_{r\phi}\dot\phi &y_{\theta r}\dot r+y_{\theta\theta}\dot\theta+y_{\theta\phi}\dot\phi&y_{\phi r}\dot r+y_{\phi\theta}\dot\theta+y_{\phi\phi}\dot\phi\\z_{rr}\dot r+z_{r\theta}\dot\theta+z_{r\phi}\dot\phi &z_{\theta r}\dot r+z_{\theta\theta}\dot\theta+z_{\theta\phi}\dot\phi&z_{\phi r}\dot r+z_{\phi\theta}\dot\theta+z_{\phi\phi}\dot\phi\end{pmatrix}\begin{pmatrix}\dot r\\\dot\theta\\\dot\phi\end{pmatrix}+\begin{pmatrix}x_r\ddot r+x_\theta\ddot\theta+x_\phi\ddot\phi\\y_r\ddot r+y_\theta\ddot\theta+y_\phi\ddot\phi\\z_r\ddot r+z_\theta\ddot\theta+z_\phi\ddot\phi\end{pmatrix}\\&=\begin{pmatrix}x_{rr}\dot r^2+2x_{r\theta}\dot r\dot\theta+2x_{r\phi}\dot r\dot\phi+x_{\theta\theta}\dot\theta^2+2x_{\theta\phi}\dot\theta\dot\phi+x_{\phi\phi}\dot\phi^2\\y_{rr}\dot r^2+2y_{r\theta}\dot r\dot\theta+2y_{r\phi}\dot r\dot\phi+y_{\theta\theta}\dot\theta^2+2y_{\theta\phi}\dot\theta\dot\phi+y_{\phi\phi}\dot\phi^2\\z_{rr}\dot r^2+2z_{r\theta}\dot r\dot\theta+2z_{r\phi}\dot r\dot\phi+z_{\theta\theta}\dot\theta^2+2z_{\theta\phi}\dot\theta\dot\phi+z_{\phi\phi}\dot\phi^2\end{pmatrix}+\begin{pmatrix}x_r\ddot r+x_\theta\ddot\theta+x_\phi\ddot\phi\\y_r\ddot r+y_\theta\ddot\theta+y_\phi\ddot\phi\\z_r\ddot r+z_\theta\ddot\theta+z_\phi\ddot\phi\end{pmatrix}\end{align}

In some more compact notations: \begin{align}\mathbf a_i(t) &= \partial_1 \partial_1 (\mathbf x\circ \mathbf r)_i(t)\\&=\partial_1(\partial_j\mathbf x_i\circ\mathbf r~\cdot\partial_1\mathbf r_j)(t)\\&=[\partial_1(\partial_j\mathbf x_i\circ\mathbf r)\cdot\partial_1\mathbf r_j+(\partial_\ell\mathbf x_i\circ\mathbf r)\cdot\partial _1\partial_1\mathbf r_\ell](t)\\&=[(\partial_k\partial_j\mathbf x_i\circ\mathbf r)\cdot\partial_1\mathbf r_k)\cdot\partial_1\mathbf r_j+(\partial_\ell\mathbf x_i\circ\mathbf r)\cdot\partial _1\partial_1\mathbf r_\ell](t)\\[2ex] \dfrac{\partial^2(\mathbf {x\circ r})_i}{\partial t~^2}(t)&=\sum_{k~,~j}\left(\dfrac{\partial^2\mathbf x_i}{\partial\mathbf r_k~\partial\mathbf r_j}(\mathbf r(t))\cdot\dfrac{\partial\mathbf r_k}{\partial t}(t)\cdot\dfrac{\partial\mathbf r_j}{\partial t}(t)\right)+\sum_\ell\left(\dfrac{\partial\mathbf x_i}{\partial\mathbf r_\ell}(\mathbf r(t))\cdot\dfrac{\partial^2\mathbf r_\ell}{\partial t~^2}(t)\right)\\ \ddot{\overline{(\mathbf{x\circ r})}}(t) &=(\mathcal D^2\mathbf x(\mathbf r(t))\cdot\dot{\mathbf r}(t))\cdot\dot{\mathbf r}(t)+\mathcal D\mathbf x(\mathbf r(t))\cdot\ddot{\mathbf r}(t) \end{align}

• So basically $$\dfrac{d}{dt}\left(\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}\right)= \left( \dfrac{\partial}{\partial r}\left(\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}\right), \dfrac{\partial}{\partial\theta}\left(\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}\right), \dfrac{\partial}{\partial\Phi}\left(\dfrac{\partial\mathbf{x}}{\partial\mathbf{r}}\right) \right) \begin{pmatrix} \dot r\\ \dot\theta\\ \dot\Phi \end{pmatrix}$$ Sep 6, 2023 at 13:11
• By doing the dot product and summing these 3 matrices and rearranging we get $$\begin{pmatrix} \boldsymbol{\nabla}(x_r)\mathbf{\dot r} & \boldsymbol{\nabla}(x_\theta)\mathbf{\dot r} &\boldsymbol{\nabla}(x_\Phi)\mathbf{\dot r}\\ \boldsymbol{\nabla}(y_r)\mathbf{\dot r} & \boldsymbol{\nabla}(y_\theta)\mathbf{\dot r} &\boldsymbol{\nabla}(y_\Phi)\mathbf{\dot r}\\ \boldsymbol{\nabla}(z_r)\mathbf{\dot r} & \boldsymbol{\nabla}(z_\theta)\mathbf{\dot r} &\boldsymbol{\nabla}(z_\Phi)\mathbf{\dot r}\\ \end{pmatrix}$$ Sep 6, 2023 at 13:13
• Which in turn means that a derivative wrt time of a matrix is just the matrix of the derivative wrt time of each component. Thus, you'll have to apply the chain rule on each component. Sep 6, 2023 at 13:24
• Yess, that is what it boils down to. Sep 6, 2023 at 23:47
• Really elegant and more comprehensible with the compact notations, Graham, thank you! Sep 11, 2023 at 0:54