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.
 A: 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}$.
A: 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.
A: 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
