# How do I write the gradient in angular coordinates ($\theta_1$, $\theta_2$, $\theta_3$)?

I have to find $$\tau$$ by finding the gradient of $$U(\theta_1, \theta_2, \theta_3)$$, where my coordinates are $$(\theta_1, \theta_2, \theta_3)$$. I assume the gradient is not the simple Cartesian coordinates formula. However, using the spherical or cylindrical coordinates formula seems wrong since my coordinates are three angles and not an angle and a radius. So how do I express $$\nabla U$$ in this $$\theta_1$$, $$\theta_2$$, $$\theta_3$$ coordinate system? Is there a Jacobian I need, or some other way?

Edit - To make this question clearer, is there a way to express the $$\nabla$$ operator in a roll-pitch-yaw $$\theta_1, \theta_2, \theta_3$$ coordinate space? Analogous to how in Cartesian coordinates $$\nabla = \frac{\partial}{\partial x} e_x + \frac{\partial}{\partial y} e_y + \frac{\partial}{\partial z} e_z$$. I know that the general way to do something like this is via the Jacobian matrix arising from the metric, but am unsure how to do it in this three angle space.

• There's not enough information as to what you want in the question. What is $\tau$ for example? Feb 9 at 22:45
• You cannot coordinatize a three dimensional vector space like $\mathbb{R}^3$ via three angles (unless there is some auxiliary information you haven't provided, like angles of what...). You need some units of length somewhere and angles are dimensionless. Please clarify what do the three angles represent, then perhaps someone can help you
– Amit
Feb 9 at 22:57
• @Amit These are angles of rotation in 3D, so roll, pitch and yaw. I was thinking of my 3D space being in terms of these angles, because the torque $\tau$ is $\frac{dU}{d\theta}$ in 1D, so I extended this to 3D. Feb 9 at 23:09
• @mikestone $\tau$ is the torque on an object that causes it to roll, pitch and yaw in 3D. Feb 9 at 23:10
• I'm not sure that makes sense, since it seems clear to me that there isn't a unique torque that can generate a specific rotation. And if you're looking for just any torque, that's a different matter. Maybe I'm wrong about this...
– Amit
Feb 9 at 23:14

## 3 Answers

$$\def \b {\mathbf}$$

$$~\vec \nabla~$$ Operator and Jacobian -Matrix

\begin{align*} &\text{Nabla Operator sphere coordinate is }\\\\ &\vec{\nabla}=\vec{e}_r\,\frac{\partial}{\partial r}+\frac{1}{r} \, \vec{e}_\theta\,\frac{\partial}{\partial \theta}+ \frac{1}{r\,\sin(\theta)}\, \vec{e}_\phi\,\frac{\partial}{\partial \phi} \end{align*}

with the sphere position vector $$~\vec P~$$ \begin{align*} &\vec{P}=\left[ \begin {array}{c} r\cos \left( \phi \right) \sin \left( \theta \right) \\ r\sin \left( \phi \right) \sin \left( \theta \right) \\ r\cos \left( \theta \right) \end {array} \right]\quad, \vec e_r=\frac{\partial\vec P}{\partial r}\quad, \frac{1}{r}\,\vec{e}_\theta=\frac{\frac{\partial\vec P}{\partial \theta}}{|\frac{\partial\vec P}{\partial \theta}|}=\hat{\b{e}}_\theta\quad, \frac{1}{r\,\sin(\theta)}\, \vec{e}_\phi=\hat{\b{e}}_\phi\quad\Rightarrow\\ \end{align*} \begin{align*} &\vec{\nabla}=\underbrace{\begin{bmatrix} \hat{\b{e}}_r & \hat{\b{e}}_\theta & \hat{\b{e}}_\phi \\ \end{bmatrix}}_{\hat{\b{J}}_(\,3\times 3)} \begin{bmatrix} \frac{\partial}{\partial r} \\\\ \frac{\partial}{\partial \theta} \\\\ \frac{\partial}{\partial \phi} \\\\ \end{bmatrix}\quad ,\b J_{i,j}=\frac{\partial P_i}{\partial \b q_j}\quad, \b q=\begin{bmatrix} r & \theta & \phi \\ \end{bmatrix}^T \end{align*} where $$~\b J~$$ is the Jacobian-Matrix , and "hat" is the matrix column norm

your case

\begin{align*} &\vec{P}=\b R_z(\psi)\,\b R_y(\theta)\,\b R_y(\phi)\, \begin{bmatrix} u_x \\ u_y \\ u_z \\ \end{bmatrix}\quad, \b q=\begin{bmatrix} \psi \\ \theta \\ \phi \\ \end{bmatrix} \end{align*}

the torque is:

$$\b\tau=\b r\times\b F= -\b r\times\,\hat{\b{J}}\,\begin{bmatrix} \frac{\partial U}{\partial\psi} \\ \frac{\partial U}{\partial\theta} \\ \frac{\partial U}{\partial\phi} \\ \end{bmatrix}$$

• Thanks! So in this case, $\nabla$ is the Jacobian times a row vector of the $\theta_1, \theta_2, \theta_3$ (or $\psi, \theta, \phi$), with the Jacobian being the matrix that transforms $\theta_1, \theta_2, \theta_3$ to $x, y, z$? Feb 11 at 18:12
• The Jacobian Matrix is $~J_{i,j}=\frac{\partial P_i}{\partial \b q_j}~$ partial derivative of the position vector to the generalized coordinates. Try to obtain the Nabla vector for the sphere with this concept ! I did_'t used $~\theta_i~$ instead I used $~\psi~,\theta~,\phi~$ yaw pitch ans roll angle
– Eli
Feb 11 at 20:01
• Thanks. Using this concept,to go from $(\theta_1, \theta_2, \theta_3)$ to $(x, y)$, I got the Jacobian $J = (\sum_i \frac{\partial^2 x}{\partial \theta_i^2} \sum_i \frac{\partial^2 y}{\partial \theta_i^2})^{T}$. The follow up question I had from this is how to express $x$ and $y$ in terms of these three angles (spherical coordinates just has two). The physical problem I am working with is planar, so there is no $z$ axis, but still these three angles (all three are not fully independent of each other). Feb 14 at 22:34

Using roll, pitch, and yaw is overspecified, and does not tell you the distance. For example, telling a bomber jet where to fire, you could specify pitch angle and yaw angle, but roll angle does not add anything. The third thing you need is distance downrange.

Also, force is the (negative) derivative of potential energy of a system with respect to some degree of freedom $$q$$:

$$F=-\frac {dU}{dq}$$

it only becomes a 3D gradient when the potential energy is a field extending over 3D space (like a gravitational or electric field). In the case of a displaced spring the degree of freedom $$q$$ might be spring displacement $$\Delta x$$ or for a pendulum might be angle from vertical $$\theta$$.

Since we have: $$\hat{n}_{\theta_i}\cdot\vec{\tau} = -\frac{\partial U}{\partial\theta_i}$$

For $$i=1,2,3$$ , then you may reconstruct the Torque vector via:

$$\vec{\tau} = -\sum_{i=1}^3 \frac{\partial U}{\partial\theta_i} \hat{n}_{\theta_i}$$

This is not the gradient, at least not in the usual sense of the word, although it has a very similar form. Most importantly: the angles $$\theta_i$$ may represent rotations from "shifted" axes, in particular this is true for Euler angles. So it's important to know whether the angles refer to an intrinsic or an extrinsic frame, in order to appropriately determine the $$\hat{n}_{\theta_i}$$'s.

See this for a lot more related information about rotation mechanics of rigid bodies.

• Thanks! So in this case, the $n_{\theta}$ is some unit vector in the direction of that $\theta$. For the purpose of defining a gradient with unit vectors $n_{\theta_1}$, $n_{\theta_2} and$n_{\theta_3}$, is there a specific way to go about it? I am not sure how to construct a Jacobian moving from Cartesian unit vectors to these three unit vectors. Feb 9 at 23:43 • the$\hat{n}_{\theta_i}$are unit vectors along the axis of rotation (direction of course determined by right hand rule...). – Amit Feb 9 at 23:45 • Please see also the linked answer. I notice now there is a way to define this with a direct application of the gradient operator, which is used there. – Amit Feb 9 at 23:46 •$\theta$being an angle has no defined direction in and of itself, I hope that's clear. You need to know which axis each angle refers to, and I suppose that's given in the problem. – Amit Feb 9 at 23:47 • If it happens that the angles are ordered from 1 to 3 as rotations about the x,y,z axis then what I wrote above coincides with$-\nabla U\$ w.r.t the angles, but in general it will not
– Amit
Feb 9 at 23:55