# Calculate gradient in polar coordinates using exterior derivative

I'm teaching myself some basics of differential form, and stumbled over the calculation of gradient in polar coordinates.

The book I'm reading is Fortney's A Visual Introduction to Differential Forms and Calculus on Manifolds, which talks little about gradient in non-Cartesian coordinates, so I turned to wikipedia. According to the wikipedia of exterior derivative:

$$\nabla f = (df)^\sharp = \frac{\partial f}{\partial x^i}\, (dx^i)^\sharp$$

This formula involves $$\sharp$$. According to the wikipedia of musical isomorphism:

$$\omega^\sharp := g^{ij} \omega_i \mathbf{e}_j = \omega^j \mathbf{e}_j$$

This formula involves inverse metric tensor $$g^{ij}$$ (inverse matrix to metric tensor $$g_{ij}$$). According to wikipedia of metric tensor, the metric tensor in polar coordinates is:

$$g_{ij} = \begin{bmatrix} 1 & 0 \\ 0 & r^2 \end{bmatrix}$$

Combining all these, the gradient of $$f(r,\theta)$$ in polar coordinates seems to be

$$\nabla f(r, \theta) = \frac{\partial f}{\partial r}\mathbf{e}_r + \frac{1}{r^\color{red}{2}}\frac{\partial f}{\partial \theta}\mathbf{e}_\theta$$

which is different from the gradient in polar coordinates we usually refer to, if not wrong.

What am I missing here? How can I calculate the usual gradient in polar coordinates using exterior derivative as the tool?

## Clarification

Post shown by Si Kucing in the comment helps, but I think my question is a bit different. Specifically speaking, I'm also interested in the standard way to obtain the usual gradient, but it's not explained in detail in that post. It's not immediately clear to me why "the norm of $$\frac{∂}{∂θ}$$ is $$r$$". Look forward to answer(s) elaborating on this part.

• The basis vectors in differential geometry/manifolds are not the same as the unit vectors from multivariable calculus. Namely, almost all of the "angular" vectors will not be unit length. – Ninad Munshi Jul 2 '20 at 8:57
• @NinadMunshi Then can we convert the basis? What's the standard way to obtain the gradient in multivariable calculus using exterior derivative? Or people using exterior derivative just don't care about gradient in multivariable calculus world? – xzczd Jul 2 '20 at 9:10
• The formula of $\nabla f$ in calculus written in terms of unit basis. When we compute $(df)^{\sharp}$ in coordinates, the expression is $g^{ij} \partial_i f \partial_j$. So in polar coordinate this would be $\partial_r f\partial_r +1/r^2 \partial_{\theta} f \partial_{\theta}$. But $\partial_{\theta}$ is not unit vector since the length is $\sqrt{g_{\theta \theta}} = r$. So the normalized basis is $\partial_r$ and $\partial_{\theta}/r$. Identifying $\hat{e}_r$ with $\partial_r$ and $\hat{e}_{\theta}$ with $\partial_{\theta}/r$, the expression is match. – Kelvin Lois Jul 2 '20 at 9:34
• Does this answer your question? Gradient formula in Lee Smooth Manifolds differs from others? – Kelvin Lois Jul 2 '20 at 9:36
• @SiKucing That helps, but I think my question is a bit different. I'm also interested in the standard way to obtain the usual gradient using exterior derivative as the tool. For example, it's not immediately clear to me why "the norm of $\frac{\partial}{\partial \theta}$ is $r$". I've edited my question to emphasize a bit on this part. – xzczd Jul 2 '20 at 9:40

Your calculation is almost right, up to the point where you made the huge mistake of thinking that \begin{align} \dfrac{\partial}{\partial \theta} = \mathbf{e}_{\theta} \end{align} This is completely wrong, because the vector on the RHS by definition is the normalized version of the one on the left.

Let's go through it step by step (even though you got it right for the most part). By definition we have \begin{align} \text{grad}(f) := g^{\sharp}(df) \end{align} And if we work in a chart $$(U,x)$$, then \begin{align} \text{grad}(f) &:= g^{\sharp}(df) \\ &= g^{\sharp}\left( \dfrac{\partial f}{\partial x^i}\, dx^i\right) \\ &= \dfrac{\partial f}{\partial x^i} \cdot g^{\sharp}\left(dx^i\right) \\ &= \dfrac{\partial f}{\partial x^i} \cdot g^{ij}\dfrac{\partial }{\partial x^j} \tag{*} \end{align} Where, I use the notation $$g_{ij} := g\left(\frac{\partial}{\partial x^i}, \frac{\partial}{\partial x^j}\right)$$, and $$[g^{ij}]$$ denotes the inverse matrix of $$[g_{ij}]$$. For polar coordinates $$(r,\theta)$$ in the plane (more precisely on a certain open subset of $$\Bbb{R}^2$$), we have \begin{align} [g_{ij}] = \begin{pmatrix} g_{rr} & g_{r\theta}\\ g_{\theta r} & g_{\theta \theta} \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & r^2 \end{pmatrix} \end{align} where for convenience rather than writing $$g_{11}, g_{12}$$ etc, I used the notation $$g_{rr}, g_{r\theta}$$. Now, the inverse matrix is easily calculated because it is diagonal: \begin{align} [g^{ij}] = \begin{pmatrix} g^{rr} & g^{r\theta}\\ g^{\theta r} & g^{\theta \theta} \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1/r^2 \end{pmatrix} \end{align}

Now, what you have to do is use the formula $$(*)$$ exactly as written. If we apply it directly then we find \begin{align} \text{grad}(f) &= g^{rr}\dfrac{\partial f}{\partial r}\dfrac{\partial }{\partial r} + g^{\theta \theta}\dfrac{\partial f}{\partial \theta}\dfrac{\partial }{\partial \theta} \\ &= \dfrac{\partial f}{\partial r}\dfrac{\partial }{\partial r} + \dfrac{1}{r^2}\dfrac{\partial f}{\partial \theta}\dfrac{\partial }{\partial \theta} \tag{**} \end{align} This formula is $$100\%$$ correct, and it DOES NOT contradict what you may have seen in standard vector analysis texts. To get the "usual" formula, we have to see how $$\mathbf{e}_r, \frac{\partial}{\partial r}, \mathbf{e}_{\theta}, \frac{\partial}{\partial \theta}$$ are related to each other. By definition, the $$\mathbf{e}$$'s are the normalized versions, which means \begin{align} \mathbf{e}_r &:= \dfrac{\frac{\partial}{\partial r}}{\lVert \frac{\partial}{\partial r}\rVert} \quad \text{and} \quad \mathbf{e}_{\theta} := \dfrac{\frac{\partial}{\partial \theta}}{\lVert \frac{\partial}{\partial \theta}\rVert} \end{align} So, what is the norm of a vector? By definition, it is the square root of the inner product of the vector with itself; i.e $$\lVert v\rVert := \sqrt{\langle v,v \rangle} = \sqrt{g(v,v)}$$, where the last equality is simple a notational change (recall that the metric tensor $$g$$ is precisely an inner product on each tangent space $$T_pM$$ of your manifold... which in this case is $$M = \Bbb{R}^2$$). So, we have \begin{align} \begin{cases} \mathbf{e}_r &:= \dfrac{\frac{\partial}{\partial r}}{\sqrt{g\left( \frac{\partial}{\partial r},\frac{\partial}{\partial r}\right)}} = \dfrac{1}{\sqrt{g_{rr}}}\dfrac{\partial}{\partial r} = \dfrac{\partial}{\partial r}\\ \mathbf{e}_{\theta} &:= \dfrac{\frac{\partial}{\partial \theta}}{\sqrt{g\left(\frac{\partial}{\partial \theta},\frac{\partial}{\partial \theta}\right)}} = \dfrac{1}{\sqrt{g_{\theta\theta}}}\dfrac{\partial}{\partial \theta} = \dfrac{1}{r}\dfrac{\partial}{\partial \theta} \end{cases} \end{align} If you now make these substitutions into $$(**)$$, you find exactly that \begin{align} \text{grad}(f) &= \dfrac{\partial f}{\partial r} \mathbf{e}_r + \dfrac{1}{r}\dfrac{\partial f}{\partial \theta} \mathbf{e}_{\theta} \tag{***} \end{align}

By the way, when you asked "why is the norm of $$\frac{\partial}{\partial \theta}$$ is $$r$$", it's not clear to me whether your confusion is regarding why $$[g_{ij}] = \text{diag}(1,r^2)$$, or simply what the relationship between the norm and inner product (i.e the metric tensor field) is. If you need more clarification let me know.

Finally, on a more general note, let's go back to $$n$$ dimensions. We once again define $$\mathbf{e}_j$$ to be the normalized vector corresponding to $$\frac{\partial}{\partial x^j}$$, i.e \begin{align} \mathbf{e}_j &= \dfrac{1}{\sqrt{g\left(\frac{\partial}{\partial x^j}, \frac{\partial}{\partial x^j}\right)}} \frac{\partial}{\partial x^j} = \dfrac{1}{\sqrt{g_{jj}}}\frac{\partial}{\partial x^j} \end{align} If we now plug this into $$(*)$$, then we see that the gradient vector field, when written in terms of the normalized coordinate vector field (i.e the $$e_{j}$$'s) is \begin{align} \text{grad}(f) &= \sum_{i,j=1}^n g^{ij}\sqrt{g_{jj}}\dfrac{\partial f}{\partial x^i} \, \mathbf{e}_j\tag{*'} \end{align} This formula above is entirely equivalent to $$(*)$$. Now let's specialize slightly, just for fun. Suppose the coordinate vector fields are orthogonal (i.e $$g_{ij} = 0$$ if $$i\neq j$$). Then, the inverse matrix $$[g^{ij}]$$ is easily calculated to be $$\text{diag}(1/g_{11}, \dots, 1/g_{nn})$$, and in this special case, the gradient reduces to: \begin{align} \text{grad}(f) &= \sum_{i=1}^n \dfrac{1}{\sqrt{g_{ii}}}\dfrac{\partial f}{\partial x^i} \, \mathbf{e}_i \end{align} Now, once again, as a sanity check try applying this to the Polar coordinate case, and you should recover $$(***)$$.

• Thx for the detailed answer. "… it's not clear to me whether your confusion is …" I'd say both, at the moment I leaved that comment :D . Introduction to metric tensor in Fortney's book is very brief. But now, with the help of your answer I guess I somewhat understand. $\begin{pmatrix} 1 & 0 \\ 0 & r^2 \end{pmatrix}$ is obtained with the covariant rank 2 transformation rule $\tilde{T_{kl}}=\frac{\partial x^i}{\partial u^k} \frac{\partial x^j}{\partial u^l}T_{ij}$ ($T_{ij}$ in Cartesian coordinates is $\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$. ) Am I right? – xzczd Jul 3 '20 at 2:04
• @xzczd yes that's right (though you should be careful which of the $x,u$ is cartesian and which is polar... this is something I always forget). The way I remember is that $g = dx \otimes dx + dy \otimes dy$ is the definition of the "Euclidean" metric tensor on $\Bbb{R}^2$. Then, just by using $dx=\frac{\partial x}{\partial r}dr+\frac{\partial x}{\partial \theta}d\theta$, and similarly for $y$, and plug in all of this into $g$. Then a few lines of algebra shows that $g = dr\otimes dr + r^2 d\theta\otimes d\theta$, from which you can read off the entries of the matrix. – peek-a-boo Jul 3 '20 at 2:18
• I find this quicker than using the transformation law, because that requires me to be careful with indices, and then carry out the einstein summation convention carefully etc, whereas the approach I mentioned above directly tells me the answer (this is of course entirely subjective, and you should use what works best for you). For a few example calculations carried out in the language of differential forms, tensor products etc take a look at this answer of mine, you may find it helpful to see the "formalism in practice". – peek-a-boo Jul 3 '20 at 2:20
• One warning I have is that in that answer, I was conforming to the notation of the OP, which is different from what you're using. In that answer, wherever I write $\mathbf{e}_{\theta}$, in your notation it really means $\frac{\partial}{\partial \theta}$ (basically all the $\mathbf{e}$'s in that answer should be $\frac{\partial}{\partial \text{ (something)}}$). As a good exercise, you should try to calculate the gradient in terms of the parabolic coordinates defined in that answer, and if you're feeling adventurous try it in 3D (and if you're even more adventurous, do it for other coordinates). – peek-a-boo Jul 3 '20 at 2:36
• Both methods are good in my view, the former is easier, and the latter is more interesting, for programming in Mathematica :D : 1. {T = IdentityMatrix, x = {σ τ, 1/2 (τ^2 - σ^2)}, u = {σ, τ}}; Table[Sum[D[x[[i]], u[[k]]] D[x[[j]], u[[l]]] T[[i, j]], {i, 2}, {j, 2}], {k, 2}, {l, 2}] // Simplify 2. {x = σ τ, y = 1/2 (τ^2 - σ^2)}; {dx, dy} = {Dt[x], Dt[y]}; rule = HoldPattern@(a___\[TensorProduct](b_ Dt[v_])\[TensorProduct]c___) :> b a\[TensorProduct]Dt[v]\[TensorProduct]c; TensorExpand[dx\[TensorProduct]dx + dy\[TensorProduct]dy] //. rule // Simplify(*// TraditionalForm*) – xzczd Jul 3 '20 at 3:18