Wolfram Alpha:

```Contravariant and Covariant Components of a Vector
--------------------------------------------------

Consider cartesian coordinates.

^ X2
|
|      -
x2|......c           -
|     /           |c| = L
|    /.
|  L/ .
|  /  .
| /   .
|/    .
--------------> X1
x1

L2 = (x1)2 + (x2)2

Now how do we get L when we have non-cartesian coordinates?
We need to introduce the concept of contravariant and
covariant components.  In cartesian coordinates the
covariant and contravariant components are the same.

Contravariant components:

u1 = x1 - x2/tanα

u2 = x2/sinα

Covariant components:

u1 = x1

u2 = Lcos(α - β)

= Lcos(α)cos(β) + Lsin(α)sin(β)

Now Lcosβ = x1 and Lsinβ = x2

u2 = x1cosα + x2sinα

To get L2 try:

u1u1 = x1(x1 - x2/tanα) = (x1)2 - (x1x2/tanα)

u2u2 = (x1cosα + x2sinα)x2/sinα = (x1x2/tanα) + (x2)2

Therefore,

u1u1 + u2u2 = (x1)2 + (x1)2

Tranformation Matrices
----------------------

We can write:
-  -       -  -
| u1 | = H | x1 |
| u2 |     | x2 |
-  -       -  -

where

-              -     -         -
H = | ∂u1/∂x1 ∂u1/∂x2 | = | 1 -1/tanα |
| ∂u2/∂x1 ∂u2/∂x2 |   | 0  1/sinα |
-              -     -         -

and

-  -       -  -
| u1 | = M | x1 |
| u2 |     | x2 |
-  -       -  -

where

-              -     -         -
M = | ∂u1/∂x1 ∂u1/∂x2 | = |  1    0   |
| ∂u2/∂x1 ∂u2/∂x2 |   | cosα sinα |
-              -     -         -

H and M are transformation matrices (JACOBEAN MATRICES)

How do we convert between the covariant and contravariant
components and vice versa?

-  -        -   -
| x1 | = H-1 | u1 |
| x2 |       | u2 |
-  -        -   -

and

-  -        -   -
| x1 | = M-1 | u1 |
| x2 |       | u1 |
-  -        -   -

where H-1 and M-1 are the inverse of the JACOBEAN MATRICES
H and M.  So,

-  -        -   -
H-1 | u1 | = M-1 | u1 |
| u2 |       | u2 |
-   -       -   -

Therefore,

-  -         -   -
| u1 | = HM-1 | u1 |
| u2 |        | u2 |
-  -         -   -

So,

-  -        -   -
| u1 | = gij | u1 |
| u2 |       | u2 |
-  -        -   -

where  gij is the INVERSE METRIC tensor.

In summary, we can construct a map as follows:

u1
u2
/ ^  ^
/ /  | |
M-1/ /M  | |
/ /    | |
v /     | |
x1   gij| |gij
x2      | |
^ \     | |
\ \    | |
H-1\ \H  | |
\ \  | |
\ v   v
u1
u2

From the map:
-       -
gij = HM-1 where M-1 = (1/sinα)|  sinα 0 |
| -cosα 1 |
-       -
Therefore,
-            -
gij = (1/sin2α)|   1    -cosα |
| -cosα    1   |
-            -

Now gij = (gij)-1  (= H-1M from the map). Where gij is the
METRIC TENSOR.  Therefore,

-                        -
gij  = (1/det[gij])|  1/sin2α     -cosα/sin2α |
| -cosα/sin2α   1/sin2α    |
-                        -

det[gij] = 1/sin4α - cos2α/sin4α = sin2α/sin4α = 1/sin2α

So,

-                      -
gij = sin2α| 1/sin2α     cosα/sin2α |
| cosα/sin2α   1/sin2α   |
-                      -

-         -
= | 1    cosα |
| cosα  1   |
-         -

-          -  -         -
Now gijgij = (1/sin2α)|   1  -cosα || 1    cosα |
| -cosα   1  || cosα   1  |
-          -  -         -

-                         -
= (1/sin2α)| 1 - cos2α     cosα - cosα |
|-cosα + cosα  -cos2α + 1   |
-                         -

-   -
= | 1 0 |
| 0 1 |
-   -

Now  gij = H-1M from the map so M = gijH

-         -  -         -
= | 1    cosα || 1 -1/tanα |
| cosα  1   || 0  1/sinα |
-         -  -         -
-                            -
= |  1     (-1/tanα + cosα/sinα) |
| cosα   (-cosα/tanα + 1/sinα) |
-                            -

-         -
= |  1    0   | which agrees with before.
| cosα sinα |
-         -

Similarly, gij = HM-1 from the map so H = gijM

H = gijM

-           -  -        -
= 1/sin2α | 1     -cosα || 1    0   |
|-cosα   1    ||cosα sinα |
-           -  -        -

-         -
= | 1 -1/tanα | which agrees with before.
| 0  1/sinα |
-         -

In summary, the metric tensor enables us to convert
the contravariant components of a vector to their
covariant form, and vice versa, in the following
manner:

-   -     -  -       2
gij | u1 | = | u1 | <--> Σgijuj = ui
| u2 |   | u2 |      j=1
-   -     -  -

and

-   -     -  -       2
gij | u1 | = | u1 | <--> Σgijuj = ui
| u2 |   | u2 |      j=1
-   -     -  -

This process of going between contravariant and
covariant components, and vice versa, is referred
as the "raising and lowering of indeces".```