Covariance and contravariance of vectors
In physics, especially in multilinear algebra and tensor analysis, covariance and contravariance describe how the quantitative description of certain geometric or physical entities changes with a change of basis. In modern mathematical notation, the role is sometimes swapped.^{[2]}
A simple illustrative case is that of a vector. For a vector, once a set of basis vectors has been defined, then the components of that vector will always vary opposite to that of the basis vectors. That vector is therefore defined as a contravariant tensor. Take a standard position vector for example. By changing the scale of the reference axes from meters to centimeters (that is, dividing the scale of the reference axes by 100, so that the basis vectors now are [math]\displaystyle{ .01 }[/math] meters long), the components of the measured position vector are multiplied by 100. A vector's components change scale inversely to changes in scale to the reference axes, and consequently a vector is called a contravariant tensor.
In contrast, a covector, also called a dual vector, has components that vary with the basis vectors in the corresponding vector space. It is an example of a covariant tensor. A covector is an object that represents a linear map from vectors to scalars. It is actually not a vector, but an object that lives in a dual vector space. Some good examples of covectors are dot product operators involving vectors. For example if [math]\displaystyle{ \mathbf{v} }[/math] is a vector, then a corresponding object in the dual space would be the linear operator [math]\displaystyle{ \mathbf{v}\ \cdot }[/math] . Sometimes, the components of the covector [math]\displaystyle{ \mathbf{v}\ \cdot }[/math] are referred to as the covariant components of [math]\displaystyle{ \mathbf{v} }[/math], although this is potentially misleading, (due to a vector having components that always vary in the contravariant sense). Despite potential confusion, this is what will be meant when the "covariant components of a vector" are referred to herein.
The gradient is often cited as an example of a covector, but this is incorrect. If the components of the gradient of a function [math]\displaystyle{ f }[/math] , [math]\displaystyle{ (\nabla f)^i }[/math] , are expressed in terms of a given basis, [math]\displaystyle{ \mathbf{e}_i }[/math] , then these components will in fact still vary oppositely to that of the basis vectors, as can be seen by observing (using the Einstein summation convention):
[math]\displaystyle{ \nabla f = \mathbf{e}_i (\nabla f)^i=\mathbf{e}_i \delta^{i}_j (\nabla f)^j=\mathbf{e}_i (T)_k^i(T^{1})_j^k (\nabla f)^j\ , }[/math]
where [math]\displaystyle{ \delta^i_j }[/math] is the kronecker delta symbol, and [math]\displaystyle{ (T)_k^i }[/math] represents the components of some transformation matrix corresponding to the transformation [math]\displaystyle{ T }[/math]. As can be seen, whatever transformation acts on the basis vectors, the inverse transformation must act on the components.
A third concept related to covariance and contravariance is invariance. A scalar (also called type0 or rank0 tensor) is an object that does not vary with the change in basis. An example of a physical observable that is a scalar is the mass of a particle. The single, scalar value of mass is independent to changes in basis vectors and consequently is called invariant. The magnitude of a vector (such as distance) is another example of an invariant, because it remains fixed even if geometrical vector components vary. (For example, for a position vector of length [math]\displaystyle{ 3 }[/math] meters, if all Cartesian basis vectors are changed from [math]\displaystyle{ 1 }[/math] meters in length to [math]\displaystyle{ .01 }[/math] meters in length, the length of the position vector remains unchanged at [math]\displaystyle{ 3 }[/math] meters, although the vector components will all increase by a factor of [math]\displaystyle{ 100 }[/math]).
Under more general changes in basis:
 A vector or tangent vector, has components that contravary with a change of basis to compensate. That is, the matrix that transforms the vector components must be the inverse of the matrix that transforms the basis vectors. The components of vectors (as opposed to those of covectors) are said to be contravariant. In Einstein notation (implicit summation over repeated index), contravariant components are denoted with upper indices as in
 [math]\displaystyle{ \mathbf{v} = v^i \mathbf{e}_i }[/math]
 A covector or cotangent vector has components that covary with a change of basis in the corresponding (initial) vector space. That is, the components must be transformed by the same matrix as the change of basis matrix in the corresponding (initial) vector space. The components of covectors (as opposed to those of vectors) are said to be covariant. In Einstein notation, covariant components are denoted with lower indices as in
 [math]\displaystyle{ \mathbf{w} = w_i \mathbf{e}^i. }[/math]
Curvilinear coordinate systems, such as cylindrical or spherical coordinates, are often used in physical and geometric problems. Associated with any coordinate system is a natural choice of coordinate basis for vectors based at each point of the space, and covariance and contravariance are particularly important for understanding how the coordinate description of a vector changes by passing from one coordinate system to another.
The terms covariant and contravariant were introduced by James Joseph Sylvester in 1851^{[3]}^{[4]} in the context of associated algebraic forms theory. Tensors are objects in multilinear algebra that can have aspects of both covariance and contravariance.
In the lexicon of category theory, covariance and contravariance are properties of functors; unfortunately, it is the lowerindex objects (covectors) that generically have pullbacks, which are contravariant, while the upperindex objects (vectors) instead have pushforwards, which are covariant. This terminological conflict may be avoided by calling contravariant functors "cofunctors" in accordance with the "covector" terminology.
Introduction
In physics, a vector typically arises as the outcome of a measurement or series of measurements, and is represented as a list (or tuple) of numbers such as
 [math]\displaystyle{ (v_1,v_2,v_3) . }[/math]
The numbers in the list depend on the choice of coordinate system. For instance, if the vector represents position with respect to an observer (position vector), then the coordinate system may be obtained from a system of rigid rods, or reference axes, along which the components v_{1}, v_{2}, and v_{3} are measured. For a vector to represent a geometric object, it must be possible to describe how it looks in any other coordinate system. That is to say, the components of the vectors will transform in a certain way in passing from one coordinate system to another.
A vector, which is an example of a contravariant tensor, has components that transform inversely to the transformation of the reference axes, (with example transformations including rotation and dilation). The vector itself does not change under these operations; instead, the components of the vector change in a way that cancels the change in the spatial axes. In other words, if the reference axes were rotated in one direction, the component representation of the vector would rotate in exactly the opposite way. Similarly, if the reference axes were stretched in one direction, the components of the vector, would reduce in an exactly compensating way. Mathematically, if the coordinate system undergoes a transformation described by an [math]\displaystyle{ n\times n }[/math] invertible matrix M, so that the basis vectors transform according to [math]\displaystyle{ \begin{bmatrix} \mathbf{e}_1^\prime\ \mathbf{e}_2^\prime\ ... \ \mathbf{e}_n^\prime\end{bmatrix}=\begin{bmatrix} \mathbf{e}_1\ \mathbf{e}_2\ ... \ \mathbf{e}_n\end{bmatrix}M }[/math], then the components of a vector v in the original basis ( [math]\displaystyle{ v^i }[/math] ) must be similarly transformed via [math]\displaystyle{ \begin{bmatrix} v^1{^\prime} \\ v^2{^\prime} \\ ... \\ v^n{^\prime} \end{bmatrix}=M^{1}\begin{bmatrix} v^1 \\ v^2 \\ ... \\ v^n \end{bmatrix} }[/math]. The components of a vector are often represented arranged in a column.
By contrast, a covector has components that transform like the reference axes. It lives in the dual vector space, and represents a linear map from vectors to scalars. The dot product operator involving vectors is a good example of a covector. To illustrate, assume we have a covector defined as [math]\displaystyle{ \mathbf{v}\ \cdot }[/math] , where [math]\displaystyle{ \mathbf{v} }[/math] is a vector. The components of this covector in some arbitrary basis are [math]\displaystyle{ \begin{bmatrix} \mathbf{v}\cdot\mathbf{e}_1 & \mathbf{v}\cdot\mathbf{e}_2 & ... & \mathbf{v}\cdot\mathbf{e}_n \end{bmatrix} }[/math], with [math]\displaystyle{ \begin{bmatrix} \mathbf{e}_1\ \mathbf{e}_2\ ... \ \mathbf{e}_n\end{bmatrix} }[/math] being the basis vectors in the corresponding vector space. (This can be derived by noting that we want to get the correct answer for the dot product operation when multiplying by an arbitrary vector [math]\displaystyle{ \mathbf{w} }[/math] , with components [math]\displaystyle{ \begin{bmatrix} w^1 \\ w^2 \\ ... \\ w^n \end{bmatrix} }[/math]). The covariance of these covector components is then easily seen by noting that if a transformation described by an [math]\displaystyle{ n\times n }[/math] invertible matrix M were to be applied to the basis vectors in the corresponding vector space, [math]\displaystyle{ \begin{bmatrix} \mathbf{e}_1^\prime\ \mathbf{e}_2^\prime\ ... \ \mathbf{e}_n^\prime\end{bmatrix}=\begin{bmatrix} \mathbf{e}_1\ \mathbf{e}_2\ ... \ \mathbf{e}_n\end{bmatrix}M }[/math], then the components of the covector [math]\displaystyle{ \mathbf{v}\ \cdot }[/math] will transform with the same matrix [math]\displaystyle{ M }[/math], namely, [math]\displaystyle{ \begin{bmatrix} \mathbf{v}\cdot\mathbf{e}_1^\prime & \mathbf{v}\cdot\mathbf{e}_2^\prime & ... & \mathbf{v}\cdot\mathbf{e}_n^\prime \end{bmatrix}=\begin{bmatrix} \mathbf{v}\cdot\mathbf{e}_1 & \mathbf{v}\cdot\mathbf{e}_2 & ... & \mathbf{v}\cdot\mathbf{e}_n \end{bmatrix}M }[/math]. The components of a covector are often represented arranged in a row.
Definition
The general formulation of covariance and contravariance refers to how the components of a coordinate vector transform under a change of basis (passive transformation). Thus let V be a vector space of dimension n over a field of scalars S, and let each of f = (X_{1}, ..., X_{n}) and f′ = (Y_{1}, ..., Y_{n}) be a basis of V.^{[note 1]} Also, let the change of basis from f to f′ be given by

[math]\displaystyle{ \mathbf{f}\mapsto \mathbf{f}' = \left(\sum_i a^i_1X_i,\dots,\sum_i a^i_nX_i\right) = \mathbf{f}A }[/math]
(
)
for some invertible n×n matrix A with entries [math]\displaystyle{ a^i_j }[/math]. Here, each vector Y_{j} of the f′ basis is a linear combination of the vectors X_{i} of the f basis, so that
 [math]\displaystyle{ Y_j=\sum_i a^i_jX_i. }[/math]
Contravariant transformation
A vector [math]\displaystyle{ v }[/math] in V is expressed uniquely as a linear combination of the elements [math]\displaystyle{ X_i }[/math] of the f basis as

[math]\displaystyle{ v=\sum_i v^i[\mathbf{f}]X_i, }[/math]
(
)
where v^{i}[f] are elements of the field S known as the components of v in the f basis. Denote the column vector of components of v by v[f]:
 [math]\displaystyle{ \mathbf{v}[\mathbf{f}] = \begin{bmatrix}v^1[\mathbf{f}]\\v^2[\mathbf{f}]\\\vdots\\v^n[\mathbf{f}]\end{bmatrix} }[/math]
so that (2) can be rewritten as a matrix product
 [math]\displaystyle{ v = \mathbf{f}\, \mathbf{v}[\mathbf{f}]. }[/math]
The vector v may also be expressed in terms of the f′ basis, so that
 [math]\displaystyle{ v = \mathbf{f'}\, \mathbf{v}[\mathbf{f'}]. }[/math]
However, since the vector v itself is invariant under the choice of basis,
 [math]\displaystyle{ \mathbf{f}\, \mathbf{v}[\mathbf{f}] = v = \mathbf{f'}\, \mathbf{v}[\mathbf{f'}]. }[/math]
The invariance of v combined with the relationship (1) between f and f′ implies that
 [math]\displaystyle{ \mathbf{f}\, \mathbf{v}[\mathbf{f}] = \mathbf{f}A\, \mathbf{v}[\mathbf{f}A], }[/math]
giving the transformation rule
 [math]\displaystyle{ \mathbf{v}[\mathbf{f'}] = \mathbf{v}[\mathbf{f}A] = A^{1}\mathbf{v}[\mathbf{f}]. }[/math]
In terms of components,
 [math]\displaystyle{ v^i[\mathbf{f}A] = \sum_j \tilde{a}^i_jv^j[\mathbf{f}] }[/math]
where the coefficients [math]\displaystyle{ \tilde{a}^i_j }[/math] are the entries of the inverse matrix of A.
Because the components of the vector v transform with the inverse of the matrix A, these components are said to transform contravariantly under a change of basis.
The way A relates the two pairs is depicted in the following informal diagram using an arrow. The reversal of the arrow indicates a contravariant change:
 [math]\displaystyle{ \begin{align} \mathbf{f} &\longrightarrow \mathbf{f'} \\ v[\mathbf{f}] &\longleftarrow v[\mathbf{f'}] \end{align} }[/math]
Covariant transformation
A linear functional α on V is expressed uniquely in terms of its components (elements in S) in the f basis as
 [math]\displaystyle{ \alpha(X_i) = \alpha_i[\mathbf{f}] , \quad i=1,2,\dots,n. }[/math]
These components are the action of α on the basis vectors X_{i} of the f basis.
Under the change of basis from f to f′ (via 1), the components transform so that

[math]\displaystyle{ \begin{align} \alpha_i[\mathbf{f}A] &= \alpha(Y_i) \\ &= \alpha\left(\sum_j a^j_i X_j\right) \\ &= \sum_j a^j_i \alpha(X_j) \\ &= \sum_j a^j_i \alpha_j[\mathbf{f}]. \end{align} }[/math]
(
)
Denote the row vector of components of α by α[f]:
 [math]\displaystyle{ \mathbf{\alpha}[\mathbf{f}] = \begin{bmatrix}\alpha_1[\mathbf{f}],\alpha_2[\mathbf{f}],\dots,\alpha_n[\mathbf{f}]\end{bmatrix} }[/math]
so that (3) can be rewritten as the matrix product
 [math]\displaystyle{ \alpha[\mathbf{f}A] = \alpha[\mathbf{f}]A. }[/math]
Because the components of the linear functional α transform with the matrix A, these components are said to transform covariantly under a change of basis.
The way A relates the two pairs is depicted in the following informal diagram using an arrow. A covariant relationship is indicated since the arrows travel in the same direction:
 [math]\displaystyle{ \begin{align} \mathbf{f} &\longrightarrow \mathbf{f'} \\ \alpha[\mathbf{f}] &\longrightarrow \alpha[\mathbf{f'}] \end{align} }[/math]
Had a column vector representation been used instead, the transformation law would be the transpose
 [math]\displaystyle{ \alpha^\mathrm{T}[\mathbf{f}A] = A^\mathrm{T}\alpha^\mathrm{T}[\mathbf{f}]. }[/math]
Coordinates
The choice of basis f on the vector space V defines uniquely a set of coordinate functions on V, by means of
 [math]\displaystyle{ x^i[\mathbf{f}](v) = v^i[\mathbf{f}]. }[/math]
The coordinates on V are therefore contravariant in the sense that
 [math]\displaystyle{ x^i[\mathbf{f}A] = \sum_{k=1}^n \tilde{a}^i_kx^k[\mathbf{f}]. }[/math]
Conversely, a system of n quantities v^{i} that transform like the coordinates x^{i} on V defines a contravariant vector (or simply vector). A system of n quantities that transform oppositely to the coordinates is then a covariant vector (or covector).
This formulation of contravariance and covariance is often more natural in applications in which there is a coordinate space (a manifold) on which vectors live as tangent vectors or cotangent vectors. Given a local coordinate system x^{i} on the manifold, the reference axes for the coordinate system are the vector fields
 [math]\displaystyle{ X_1 = \frac{\partial}{\partial x^1},\dots,X_n=\frac{\partial}{\partial x^n}. }[/math]
This gives rise to the frame f = (X_{1}, ..., X_{n}) at every point of the coordinate patch.
If y^{i} is a different coordinate system and
 [math]\displaystyle{ Y_1=\frac{\partial}{\partial y^1},\dots,Y_n = \frac{\partial}{\partial y^n}, }[/math]
then the frame f' is related to the frame f by the inverse of the Jacobian matrix of the coordinate transition:
 [math]\displaystyle{ \mathbf{f}' = \mathbf{f}J^{1},\quad J = \left(\frac{\partial y^i}{\partial x^j}\right)_{i,j=1}^n. }[/math]
Or, in indices,
 [math]\displaystyle{ \frac{\partial}{\partial y^i} = \sum_{j=1}^n\frac{\partial x^j}{\partial y^i}\frac{\partial}{\partial x^j}. }[/math]
A tangent vector is by definition a vector that is a linear combination of the coordinate partials [math]\displaystyle{ \partial/\partial x^i }[/math]. Thus a tangent vector is defined by
 [math]\displaystyle{ v = \sum_{i=1}^n v^i[\mathbf{f}] X_i = \mathbf{f}\ \mathbf{v}[\mathbf{f}]. }[/math]
Such a vector is contravariant with respect to change of frame. Under changes in the coordinate system, one has
 [math]\displaystyle{ \mathbf{v}\left[\mathbf{f}'\right] = \mathbf{v}\left[\mathbf{f}J^{1}\right] = J\, \mathbf{v}[\mathbf{f}]. }[/math]
Therefore, the components of a tangent vector transform via
 [math]\displaystyle{ v^i\left[\mathbf{f}'\right] = \sum_{j=1}^n \frac{\partial y^i}{\partial x^j}v^j[\mathbf{f}]. }[/math]
Accordingly, a system of n quantities v^{i} depending on the coordinates that transform in this way on passing from one coordinate system to another is called a contravariant vector.
Covariant and contravariant components of a vector with a metric
In a finitedimensional vector space V over a field K with a symmetric bilinear form g : V × V → K (which may be referred to as the metric tensor), there is little distinction between covariant and contravariant vectors, because the bilinear form allows covectors to be identified with vectors. That is, a vector v uniquely determines a covector α via
 [math]\displaystyle{ \alpha(w) = g(v, w) }[/math]
for all vectors w. Conversely, each covector α determines a unique vector v by this equation. Because of this identification of vectors with covectors, one may speak of the covariant components or contravariant components of a vector, that is, they are just representations of the same vector using the reciprocal basis.
Given a basis f = (X_{1}, ..., X_{n}) of V, there is a unique reciprocal basis f^{#} = (Y^{1}, ..., Y^{n}) of V determined by requiring that
 [math]\displaystyle{ Y^i(X_j) = \delta^i_j, }[/math]
the Kronecker delta. In terms of these bases, any vector v can be written in two ways:
 [math]\displaystyle{ \begin{align} v &= \sum_i v^i[\mathbf{f}]X_i = \mathbf{f}\,\mathbf{v}[\mathbf{f}]\\ &=\sum_i v_i[\mathbf{f}]Y^i = \mathbf{f}^\sharp\mathbf{v}^\sharp[\mathbf{f}]. \end{align} }[/math]
The components v^{i}[f] are the contravariant components of the vector v in the basis f, and the components v_{i}[f] are the covariant components of v in the basis f. The terminology is justified because under a change of basis,
 [math]\displaystyle{ \mathbf{v}[\mathbf{f}A] = A^{1}\mathbf{v}[\mathbf{f}],\quad \mathbf{v}^\sharp[\mathbf{f}A] = A^T\mathbf{v}^\sharp[\mathbf{f}]. }[/math]
Euclidean plane
In the Euclidean plane, the dot product allows for vectors to be identified with covectors. If [math]\displaystyle{ \mathbf{e}_1,\mathbf{e}_2 }[/math] is a basis, then the dual basis [math]\displaystyle{ \mathbf{e}^1,\mathbf{e}^2 }[/math] satisfies
 [math]\displaystyle{ \begin{align} \mathbf{e}^1\cdot\mathbf{e}_1 = 1, &\quad \mathbf{e}^1\cdot\mathbf{e}_2 = 0 \\ \mathbf{e}^2\cdot\mathbf{e}_1 = 0, &\quad \mathbf{e}^2\cdot\mathbf{e}_2 = 1. \end{align} }[/math]
Thus, e^{1} and e_{2} are perpendicular to each other, as are e^{2} and e_{1}, and the lengths of e^{1} and e^{2} normalized against e_{1} and e_{2}, respectively.
Example
For example,^{[5]} suppose that we are given a basis e_{1}, e_{2} consisting of a pair of vectors making a 45° angle with one another, such that e_{1} has length 2 and e_{2} has length 1. Then the dual basis vectors are given as follows:
 e^{2} is the result of rotating e_{1} through an angle of 90° (where the sense is measured by assuming the pair e_{1}, e_{2} to be positively oriented), and then rescaling so that e^{2} ⋅ e_{2} = 1 holds.
 e^{1} is the result of rotating e_{2} through an angle of 90°, and then rescaling so that e^{1} ⋅ e_{1} = 1 holds.
Applying these rules, we find
 [math]\displaystyle{ \mathbf{e}^1 = \frac{1}{2}\mathbf{e}_1  \frac{1}{\sqrt{2}}\mathbf{e}_2 }[/math]
and
 [math]\displaystyle{ \mathbf{e}^2 = \frac{1}{\sqrt{2}}\mathbf{e}_1 + 2\mathbf{e}_2. }[/math]
Thus the change of basis matrix in going from the original basis to the reciprocal basis is
 [math]\displaystyle{ R = \begin{bmatrix} \frac{1}{2} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & 2 \end{bmatrix}, }[/math]
since
 [math]\displaystyle{ [\mathbf{e}^1\ \mathbf{e}^2] = [\mathbf{e}_1\ \mathbf{e}_2]\begin{bmatrix} \frac{1}{2} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & 2 \end{bmatrix}. }[/math]
For instance, the vector
 [math]\displaystyle{ v = \frac{3}{2}\mathbf{e}_1 + 2\mathbf{e}_2 }[/math]
is a vector with contravariant components
 [math]\displaystyle{ v^1 = \frac{3}{2},\quad v^2 = 2. }[/math]
The covariant components are obtained by equating the two expressions for the vector v:
 [math]\displaystyle{ v = v_1\mathbf{e}^1 + v_2\mathbf{e}^2 = v^1\mathbf{e}_1 + v^2\mathbf{e}_2 }[/math]
so
 [math]\displaystyle{ \begin{align} \begin{bmatrix}v_1\\ v_2\end{bmatrix} &= R^{1}\begin{bmatrix}v^1 \\ v^2\end{bmatrix} \\ &= \begin{bmatrix}4 & \sqrt{2} \\ \sqrt{2} & 1\end{bmatrix} \begin{bmatrix}v^1 \\ v^2\end{bmatrix} \\ &= \begin{bmatrix}6 + 2\sqrt{2} \\ 2 + \frac{3}{\sqrt{2}}\end{bmatrix} \end{align}. }[/math]
Threedimensional Euclidean space
In the threedimensional Euclidean space, one can also determine explicitly the dual basis to a given set of basis vectors e_{1}, e_{2}, e_{3} of E_{3} that are not necessarily assumed to be orthogonal nor of unit norm. The dual basis vectors are:
 [math]\displaystyle{ \mathbf{e}^1 = \frac{\mathbf{e}_2 \times \mathbf{e}_3}{\mathbf{e}_1 \cdot (\mathbf{e}_2 \times \mathbf{e}_3)} ; \qquad \mathbf{e}^2 = \frac{\mathbf{e}_3 \times \mathbf{e}_1}{\mathbf{e}_2 \cdot (\mathbf{e}_3 \times \mathbf{e}_1)}; \qquad \mathbf{e}^3 = \frac{\mathbf{e}_1 \times \mathbf{e}_2}{\mathbf{e}_3 \cdot (\mathbf{e}_1 \times \mathbf{e}_2)}. }[/math]
Even when the e_{i} and e^{i} are not orthonormal, they are still mutually reciprocal:
 [math]\displaystyle{ \mathbf{e}^i \cdot \mathbf{e}_j = \delta^i_j, }[/math]
Then the contravariant components of any vector v can be obtained by the dot product of v with the dual basis vectors:
 [math]\displaystyle{ q^1 = \mathbf{v} \cdot \mathbf{e}^1; \qquad q^2 = \mathbf{v} \cdot \mathbf{e}^2; \qquad q^3 = \mathbf{v} \cdot \mathbf{e}^3 . }[/math]
Likewise, the covariant components of v can be obtained from the dot product of v with basis vectors, viz.
 [math]\displaystyle{ q_1 = \mathbf{v} \cdot \mathbf{e}_1; \qquad q_2 = \mathbf{v} \cdot \mathbf{e}_2; \qquad q_3 = \mathbf{v} \cdot \mathbf{e}_3 . }[/math]
Then v can be expressed in two (reciprocal) ways, viz.
 [math]\displaystyle{ \mathbf{v} = q^i \mathbf{e}_i = q^1 \mathbf{e}_1 + q^2 \mathbf{e}_2 + q^3 \mathbf{e}_3 . }[/math]
or
 [math]\displaystyle{ \mathbf{v} = q_i \mathbf{e}^i = q_1 \mathbf{e}^1 + q_2 \mathbf{e}^2 + q_3 \mathbf{e}^3 }[/math]
Combining the above relations, we have
 [math]\displaystyle{ \mathbf{v} = (\mathbf{v} \cdot \mathbf{e}^i) \mathbf{e}_i = (\mathbf{v} \cdot \mathbf{e}_i) \mathbf{e}^i }[/math]
and we can convert between the basis and dual basis with
 [math]\displaystyle{ q_i = \mathbf{v}\cdot \mathbf{e}_i = (q^j \mathbf{e}_j)\cdot \mathbf{e}_i = (\mathbf{e}_j\cdot\mathbf{e}_i) q^j }[/math]
and
 [math]\displaystyle{ q^i = \mathbf{v}\cdot \mathbf{e}^i = (q_j \mathbf{e}^j)\cdot \mathbf{e}^i = (\mathbf{e}^j\cdot\mathbf{e}^i) q_j . }[/math]
If the basis vectors are orthonormal, then they are the same as the dual basis vectors.
General Euclidean spaces
More generally, in an ndimensional Euclidean space V, if a basis is
 [math]\displaystyle{ \mathbf{e}_1,\dots,\mathbf{e}_n, }[/math]
the reciprocal basis is given by (double indices are summed over),
 [math]\displaystyle{ \mathbf{e}^i=g^{ij}\mathbf{e}_j }[/math]
where the coefficients g^{ij} are the entries of the inverse matrix of
 [math]\displaystyle{ g_{ij} = \mathbf{e}_i\cdot\mathbf{e}_j . }[/math]
Indeed, we then have
 [math]\displaystyle{ \mathbf{e}^i\cdot\mathbf{e}_k=g^{ij}\mathbf{e}_j\cdot\mathbf{e}_k=g^{ij}g_{jk} = \delta^i_k . }[/math]
The covariant and contravariant components of any vector
 [math]\displaystyle{ \mathbf{v} = q_i \mathbf{e}^i = q^i \mathbf{e}_i \, }[/math]
are related as above by
 [math]\displaystyle{ q_i = \mathbf{v}\cdot \mathbf{e}_i = (q^j \mathbf{e}_j)\cdot \mathbf{e}_i = q^jg_{ji} }[/math]
and
 [math]\displaystyle{ q^i = \mathbf{v}\cdot \mathbf{e}^i = (q_j\mathbf{e}^j)\cdot \mathbf{e}^i = q_jg^{ji} . }[/math]
Informal usage
In the field of physics, the adjective covariant is often used informally as a synonym for invariant. For example, the Schrödinger equation does not keep its written form under the coordinate transformations of special relativity. Thus, a physicist might say that the Schrödinger equation is not covariant. In contrast, the Klein–Gordon equation and the Dirac equation do keep their written form under these coordinate transformations. Thus, a physicist might say that these equations are covariant.
Despite this usage of "covariant", it is more accurate to say that the Klein–Gordon and Dirac equations are invariant, and that the Schrödinger equation is not invariant. Additionally, to remove ambiguity, the transformation by which the invariance is evaluated should be indicated.
Because the components of vectors are contravariant and those of covectors are covariant, the vectors themselves are often referred to as being contravariant and the covectors as covariant.
Use in tensor analysis
The distinction between covariance and contravariance is particularly important for computations with tensors, which often have mixed variance. This means that they have both covariant and contravariant components, or both vector and covector components. The valence of a tensor is the number of variant and covariant terms, and in Einstein notation, covariant components have lower indices, while contravariant components have upper indices. The duality between covariance and contravariance intervenes whenever a vector or tensor quantity is represented by its components, although modern differential geometry uses more sophisticated indexfree methods to represent tensors.
In tensor analysis, a covariant vector varies more or less reciprocally to a corresponding contravariant vector. Expressions for lengths, areas and volumes of objects in the vector space can then be given in terms of tensors with covariant and contravariant indices. Under simple expansions and contractions of the coordinates, the reciprocity is exact; under affine transformations the components of a vector intermingle on going between covariant and contravariant expression.
On a manifold, a tensor field will typically have multiple, upper and lower indices, where Einstein notation is widely used. When the manifold is equipped with a metric, covariant and contravariant indices become very closely related to one another. Contravariant indices can be turned into covariant indices by contracting with the metric tensor. The reverse is possible by contracting with the (matrix) inverse of the metric tensor. Note that in general, no such relation exists in spaces not endowed with a metric tensor. Furthermore, from a more abstract standpoint, a tensor is simply "there" and its components of either kind are only calculational artifacts whose values depend on the chosen coordinates.
The explanation in geometric terms is that a general tensor will have contravariant indices as well as covariant indices, because it has parts that live in the tangent bundle as well as the cotangent bundle.
A contravariant vector is one which transforms like [math]\displaystyle{ \frac{dx^{\mu}}{d\tau} }[/math], where [math]\displaystyle{ x^{\mu} \! }[/math] are the coordinates of a particle at its proper time [math]\displaystyle{ \tau }[/math]. A covariant vector is one which transforms like [math]\displaystyle{ \frac{\partial \varphi}{\partial x^{\mu}} }[/math], where [math]\displaystyle{ \varphi }[/math] is a scalar field.
Algebra and geometry
In category theory, there are covariant functors and contravariant functors. The assignment of the dual space to a vector space is a standard example of a contravariant functor. Some constructions of multilinear algebra are of "mixed" variance, which prevents them from being functors.
In differential geometry, the components of a vector relative to a basis of the tangent bundle are covariant if they change with the same linear transformation as a change of basis. They are contravariant if they change by the inverse transformation. This is sometimes a source of confusion for two distinct but related reasons. The first is that vectors whose components are covariant (called covectors or 1forms) actually pull back under smooth functions, meaning that the operation assigning the space of covectors to a smooth manifold is actually a contravariant functor. Likewise, vectors whose components are contravariant push forward under smooth mappings, so the operation assigning the space of (contravariant) vectors to a smooth manifold is a covariant functor. Secondly, in the classical approach to differential geometry, it is not bases of the tangent bundle that are the most primitive object, but rather changes in the coordinate system. Vectors with contravariant components transform in the same way as changes in the coordinates (because these actually change oppositely to the induced change of basis). Likewise, vectors with covariant components transform in the opposite way as changes in the coordinates.
See also
 Active and passive transformation
 Mixed tensor
 Twopoint tensor, a generalization allowing indices to reference multiple vector bases
Notes
 ↑ A basis f may here profitably be viewed as a linear isomorphism from R^{n} to V. Regarding f as a row vector whose entries are the elements of the basis, the associated linear isomorphism is then [math]\displaystyle{ \mathbf{x}\mapsto \mathbf{f}\mathbf{x}. }[/math]
Citations
 ↑ Misner, C.; Thorne, K.S.; Wheeler, J.A. (1973). Gravitation. W.H. Freeman. ISBN 0716703440.
 ↑ Frankel, Theodore (2012). The geometry of physics : an introduction. Cambridge: Cambridge University Press. p. 42. ISBN 9781107602601. OCLC 739094283. https://www.worldcat.org/oclc/739094283.
 ↑ Sylvester, J.J. (1851). "On the general theory of associated algebraical forms". Cambridge and Dublin Mathematical Journal. 6. pp. 289–293. https://books.google.com/books?id=mZ9EAAAAcAAJ&pg=PA289.
 ↑ Sylvester, J.J. University Press. The collected mathematical papers of James Joseph Sylvester. 3, 1870–1883. ISBN 9781107661431. OCLC 758983870.
 ↑ Bowen, Ray; Wang, C.C. (2008). "§3.14 Reciprocal Basis and Change of Basis". Introduction to Vectors and Tensors. Dover. pp. 78, 79, 81. ISBN 9780486469140. https://books.google.com/books?id=Hr5bhIVWr4wC&pg=PA76.
References
 Kusse, Bruce R.; Westwig, Erik A. (2010), Mathematical Physics: Applied Mathematics for Scientists and Engineers (2nd ed.), Wiley, ISBN 9783527618149.
 Arfken, George B.; Weber, Hans J. (2005), Mathematical Methods for Physicists (6th ed.), Harcourt, ISBN 0120598760.
 Dodson, C. T. J.; Poston, T. (1991), Tensor geometry, Graduate Texts in Mathematics, 130 (2nd ed.), Springer, ISBN 9783540520184.
 Greub, Werner Hildbert (1967), Multilinear algebra, Die Grundlehren der Mathematischen Wissenschaften, Band 136, Springer, ISBN 9780387038278.
 Sternberg, Shlomo (1983), Lectures on differential geometry, Chelsea, ISBN 9780828403160.
 Sylvester, J.J. (1853), "On a Theory of the Syzygetic Relations of Two Rational Integral Functions, Comprising an Application to the Theory of Sturm's Functions, and That of the Greatest Algebraical Common Measure", Philosophical Transactions of the Royal Society of London 143: 407–548, doi:10.1098/rstl.1853.0018, https://zenodo.org/record/1432412.
External links
 Hazewinkel, Michiel, ed. (2001), "Covariant tensor", Encyclopedia of Mathematics, Springer Science+Business Media B.V. / Kluwer Academic Publishers, ISBN 9781556080104, https://www.encyclopediaofmath.org/index.php?title=p/c026880
 Hazewinkel, Michiel, ed. (2001), "Contravariant tensor", Encyclopedia of Mathematics, Springer Science+Business Media B.V. / Kluwer Academic Publishers, ISBN 9781556080104, https://www.encyclopediaofmath.org/index.php?title=p/c025970
 Weisstein, Eric W.. "Covariant Tensor". http://mathworld.wolfram.com/CovariantTensor.html.
 Weisstein, Eric W.. "Contravariant Tensor". http://mathworld.wolfram.com/ContravariantTensor.html.
 Invariance, Contravariance, and Covariance
 Dullemond, Kees; Peeters, Kasper (2010). "Introduction to tensor calculus". http://www.ita.uniheidelberg.de/~dullemond/lectures/tensor/tensor.pdf.
Original source: https://en.wikipedia.org/wiki/Covariance and contravariance of vectors.
Read more 