# Covariant gradient - What am I missing?

I know that the components of the gradient should transform covariantly, and have used this many times in special relativity, etc. However, I also know that covariant components transform like the coordinate axes, while contravariant components transform in an inverse way, and today, while thinking geometrically about a simple example, I could not get these two statements to agree. So I must be forgetting or misunderstanding something.

Consider a coordinate system $$S$$ in the plane, with orthonormal basis vectors $$\mathbf e_1$$, $$\mathbf e_2$$. Let $$S'$$ be a different coordinate system, with basis vectors $$\mathbf e'_1$$, $$\mathbf e'_2$$ obtained from $$S$$ by rotating $$\mathbf e_1$$, $$\mathbf e_2$$ counterclockwise by an angle $$\theta$$. That is, $$[\mathbf e'_i]_S = R_\theta [\mathbf e_i]_S, \quad i = 1, 2, \tag{1}$$ where $$[\dotsc]_S$$ denotes representation in the system $$S$$, and $$R_\theta = \begin{pmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{pmatrix}. \tag{2}$$ Position vectors, being contravariant (under rotations), transform in the inverse manner $$\mathbf r' = R_\theta^{-1} \mathbf r = R_{-\theta} \mathbf r \quad \Leftrightarrow \quad \mathbf r = R_\theta \mathbf r'.\tag{3}$$ So far so good. But now consider the gradient of a scalar field $$\phi$$. I get, by the chain rule (and with implicit summation over repeated indices), $$(\nabla \phi)'_i = \frac{\partial \phi}{\partial x'^i} = \frac{\partial \phi}{\partial x^j} \frac{\partial x^j}{\partial x'^i} = (\nabla \phi)_j(R_\theta)_{ji} = (\nabla \phi)_j(R^{-1}_\theta)_{ij} = (R^{-1}_\theta \nabla \phi)_i, \tag{4}$$ so that $$(\nabla \phi)' = R^{-1}_\theta \nabla \phi = R_{-\theta} \nabla \phi$$, indicating that the components of the gradient transform like the position vectors! But this cannot be right, since one is supposed to transform covariantly and the other contravariantly.

• How certain are you that you have the right rotation matrix? – Philip Mar 30 at 17:55
• I took the liberty to label your equations so that I can tell you that $(3)$ should follow from $(1)$, whereas it doesn't in what you wrote. – DanielC Mar 30 at 17:56
• Thank you for adding labels! Your comment made me realize that eq. (1) was ambiguous at best, so I have rewritten that part in a more careful way. Do you see what I mean now? – ummg Mar 30 at 18:43

To provide a secondary view which may be more accessible, I have elected to write a second answer.

Let $$\mathbf V$$ be a vector. Given some choice of basis $$\{\hat e_1,\hat e_2\}$$, we can expand $$\mathbf V$$ in component form as $$\mathbf V = \sum_i V^i \hat e_i = V^1 \hat e_1 + V^2 \hat e_2$$

Now we consider a rotation matrix $$R = \pmatrix{\cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta)}$$ We denote its components by $$R^i_{\ \ j}$$, and the interest of full clarity we have that $$R^1_{\ \ 1} = \cos(\theta) \qquad R^1_{\ \ 2} = -\sin(\theta)$$ $$R^2_{\ \ 1} =\sin(\theta) \qquad R^2_{\ \ 2}=\cos(\theta)$$

We define a rotated basis $$\hat g_i = R^j_{\ \ i} \hat e_j$$ - note the index placement! This new basis is rotated counterclockwise by an angle $$\theta$$ from the original one. In our new basis,

$$\mathbf V = \sum_i \tilde V^i \hat g_i = \sum_i \sum_j \tilde V^i R^j_{\ \ i} \hat e_j = \sum_j \left( \sum_i R^j_{\ \ i} \tilde V^i\right) \hat e_j$$

Since the vector is not affected by a change of basis, we must have that $$\sum_i R^j_{\ \ i}\tilde V^i = V^j \iff \tilde V^i = (R^\mathrm T)^i_{\ \ j} V^j$$ where we've used that $$R^\mathrm T = R^{-1}$$. Therefore, under change of basis we have that

$$\hat e_i \mapsto R^j_{\ \ i} \hat e_j$$ $$V^i \mapsto (R^\mathrm T)^i_{\ \ j} V^j$$

Quantities which vary like the basis vectors do are called covariant, while those which vary like the vector components do are called contravariant.

As noted by the OP in several comments, there are several definitions of "gradient" which one could use. The simplest one is that the gradient of a scalar function $$\phi$$ in coordinates $$\{x^1,x^2\}$$ has components $$\frac{\partial \phi}{\partial x^i}$$. However, we note that under this rotation,

$$x^i \mapsto x'^i = (R^\mathrm T)^i_{\ \ j} x^j$$ $$\implies \frac{\partial x'^i}{\partial x^j} = (R^\mathrm T)^i_{\ \ j} \iff \frac{\partial x^i}{\partial x'^j} = R^i_{\ \ j}$$

And so $$\frac{\partial \phi}{\partial x^i} \mapsto \frac{\partial \phi}{\partial x'^i} = \frac{\partial x^j}{\partial x'^i} \frac{\partial \phi}{\partial x^j} = R^j_{\ \ i} \frac{\partial \phi}{\partial x^j}$$

Comparing this to the basis transformation rule, we observe that the transformation behavior is the same: $$\hat e_i \mapsto R^j_{\ \ i} \hat e_j$$ $$\frac{\partial \phi}{\partial x^i} \mapsto R^j_{\ \ i} \frac{\partial \phi}{\partial x^j}$$

from which it follows that the components $$\frac{\partial \phi}{\partial x^i}$$ transform covariantly, as expected.

In the interest of completeness, given a metric tensor $$g_{ij}$$ with inverse $$g^{ij}$$, the quantities $$g^{ij} \frac{\partial \phi}{\partial x^j}$$ transform contravariantly because of the transformation properties of $$g^{ij}$$, namely $$g^{ij} \mapsto (R^\mathrm T)^i_{\ \ m} (R^\mathrm T)^j_{\ \ n} g^{mn}$$

Therefore, we might call $$(\nabla \phi)^i = g^{ij} \frac{\partial \phi}{\partial x^j}$$ the vector gradient, and $$(d\phi)_i = \frac{\partial \phi}{\partial x^j}$$ the covector gradient. These two objects coincide when we work in a cartesian basis, in which $$g^{ij} = \delta^{ij} = \begin{cases}0 & i\neq j \\ 1 & i=j\end{cases}$$.

• Thank you, this is very helpful! I still have a few points of confusion though. One is that $R^j_i = (R^{\mathrm T})^i_j$, right? For example, $R^2_1 = (R^{\mathrm T})^1_2 = \sin \theta$. So it seems like the components work out the same under both transformation rules, which seems to contradict common statements like "a covariant vector has components that change oppositely to the coordinates or, equivalently, transform like the reference axes." (see Wikipedia). – ummg Apr 1 at 22:53
• @ummg The terminology can indeed be confusing. That's why I wrote everything out explicitly, and attempted to draw attention to index placement. The point is that if we rotate our basis by $30^\circ$ counterclockwise, the components will change; the new coordinates will be what we would have obtained by leaving the basis alone and rotating the vector by $30^\circ$ clockwise. I've added a diagram to illustrate the concept. – J. Murray Apr 1 at 23:24
• @j-murray Yes, this part I have no problem with. Indeed, it is what I tried to convey with (3) in my original question. The more I think about this the more it seems like the source of confusion is that what I think of as the gradient is a vector $\nabla \phi = \frac{\partial \phi}{\partial x} \hat x + \frac{\partial \phi}{\partial y} \hat y + \frac{\partial \phi}{\partial z} \hat z$ (note that I avoid indices for clarity; this is just a simple linear combination of the basis vectors). I suppose this is the sort of object you have in mind in the final part of your answer. – ummg Apr 2 at 0:40
• I wrote a more direct version of this question here the other day. Maybe you will understand my point of view better if you read it? – ummg Apr 2 at 0:43
• Anyhow, I think this is starting to make a little bit more sense to me now. I am very grateful for the time and effort you have spent trying to answer my questions. – ummg Apr 2 at 1:15

Firstly, when we speak of contravariance or covariance we are talking about how various quantities transform under passive changes of coordinates and basis. Tensorial quantities are defined at the manifold level and don't depend on coordinates, so by definition they don't change at all.

Consider a vector $$\mathbf V$$. If we choose a coordinate system $$x\equiv(x^1,x^2)$$ and the induced coordinate basis $$\left\{\frac{\partial}{\partial x^1},\frac{\partial}{\partial x^2}\right\}$$, then we can express our vector in component form as $$\mathbf V = V_{(x)}^1 \frac{\partial}{\partial x^1} + V_{(x)}^2 \frac{\partial}{\partial x^2} = V^i_{(x)} \frac{\partial}{\partial x^i}$$ where I use the subscript $$(x)$$ to remind us that these are the components of $$\mathbf V$$ in the $$x$$ coordinate chart.

Let us now change coordinates to a chart $$y\equiv(y^1,y^2)$$. The new coordinate basis is related to the old one via

$$\frac{\partial}{\partial x^i} = \frac{\partial y^j}{\partial x^i} \frac{\partial}{\partial y^j} \iff \frac{\partial}{\partial y^i} = \frac{\partial x^j}{\partial y^i} \frac{\partial}{\partial x^j}$$

Plugging this in to our expression for $$\mathbf V$$, we find

$$\mathbf V =\underbrace{ V^j_{(x)} \frac{\partial y^i}{\partial x^j} }_{\equiv V_{(y)}^i}\frac{\partial}{\partial y^i}$$

and so apparently $$V_{(y)}^i = \frac{\partial y^i}{\partial x^j} V_{(x)}^j$$

Compare this to the transformation behavior for the basis vectors:

$$V_{(y)}^i = \color{red}{\frac{\partial y^i}{\partial x^j}} V_{(x)}^j \qquad \frac{\partial}{\partial y^i} = \color{red}{\frac{\partial x^j}{\partial y^i}} \frac{\partial}{\partial x^j}$$

Under change of basis, the basis vectors transform in one way while the components transform the other way, so as to leave the vector itself unchanged. Anything that transforms in the same way as the basis vectors (i.e. via $$\frac{\partial x^i}{\partial y^j}$$) is called covariant, and anything that transforms in the opposite way (such as the components of the vector) is called contravariant.

This idea can be extended straightforwardly to covectors. It's easy to show that the dual basis $$\mathrm dx^i$$ transforms contravariantly, i.e. $$dy^i = \frac{\partial y^i}{\partial x^j} \mathrm dx^j$$ and that the components of a covector must therefore transform covariantly in order to keep the covector as a whole unchanged. This is what happens with the gradient; from the chain rule, it is clear that

$$\frac{\partial \phi}{\partial y^i} = \frac{\partial x^j}{\partial y^i} \frac{\partial \phi}{\partial x^j}$$

which, as noted above, is covariant transformation behavior.

• Thank you for writing a thorough answer! Unfortunately I am not familiar with whatever formalism you are using, so I don't quite follow a lot of it. I am only really familiar with basic vector calculus, and not, for example, differential forms. This answer to a different question seems to indicate that the gradient operator transforms covariantly, while the gradient of a function (as evaluated at some point) transforms contravariantly. Is this correct? That would solve my problem. – ummg Mar 31 at 18:06
• This one seems to lean the same way. – ummg Mar 31 at 18:17
• @ummg Those answers are correct, but they need to be interpreted carefully. The object which you are describing, which has components $\frac{\partial \phi}{\partial x^i}$, is a covector whose components transform covariantly. The object those answers refer to as the gradient is $g^{ij} \frac{\partial \phi}{\partial x^j}$, where $g^{ij}$ is the inverse metric tensor. This object is a vector whose components transform contravariantly. In cartesian coordinates, $g^{ij}$ is just the identity matrix so they look the same, but in e.g. polar coordinates they do not. – J. Murray Mar 31 at 18:23

What you have is the one form $$d\phi$$ which in coordinate $$(x,y)$$ is given by $$\frac{\partial\phi}{\partial x}dx+ \frac{\partial\phi}{\partial y}dy$$ $$dx$$ and $$dy$$ are one forms so they transform covariantly. Finally $$\frac{\partial\phi}{\partial x}$$ and $$\frac{\partial\phi}{\partial y}$$ are scalar function so they do not transform.

One last word about this is that, changing coordinates dos not change components of a tensor, because the components of a vector in a given base is a scalar. When people are talking about change components by changing coordinates, what they willy mean is that , changing coordinates induces a changing of basis and in this basis the the components of tensor change