Covariant and contravariant basis

On a surface, basically, we must suppose

\begin{align} \boldsymbol{g}_i\cdot\boldsymbol{g}_j\neq \delta_{ij}. \end{align}

Hence, sometimes introducing another set of basis such that

\begin{align} \boldsymbol{g}_i\cdot\boldsymbol{g}^j=\delta_i^{\cdot j}, \end{align}

makes equations simpler.
These basis are referred to as dual basis. Additionally, $\boldsymbol{g}_i$ is called covariant basis, and $\boldsymbol{g}^i$ is called contravariant basis. Basically, $\delta_i^{\cdot j}$ is substantially same as Kronecker's delta $\delta_{ij}$, i.e., $\delta_i^{\cdot j}=0$ when $i=j$ and $\delta_i^{\cdot j}=1$ otherwise.
Given a tangent vector $\boldsymbol{a}$, to obtain sufficient information about this vector, it is sufficient to take inner product with two independent vectors. Of course, we chose basis as those vectors.
For example, we define

\begin{align} a_1=\boldsymbol{a}\cdot\boldsymbol{g}_1, \end{align}


\begin{align} a_2=\boldsymbol{a}\cdot\boldsymbol{g}_2, \end{align}

and call $a_1,a_2$ covariant components. On the other hand, we define

\begin{align} a^1=\boldsymbol{a}\cdot\boldsymbol{g}^1, \end{align}


\begin{align} a^2=\boldsymbol{a}\cdot\boldsymbol{g}^2, \end{align}

and call $a^1,a^2$ contravariant components.
Because there are two types of components, each tangent vector has two representations, i.e,

\begin{align} \boldsymbol{a}=a_1\boldsymbol{g}^1+a_2\boldsymbol{g}^2 \end{align}


\begin{align} \boldsymbol{a}=a^1\boldsymbol{g}_1+a^2\boldsymbol{g}_2. \end{align}

By taking inner product with Eq. (7) with $\boldsymbol{g}_i$, we obtain Eq. (5).
So as Eq. (8).
Contrary, by taking inner product with Eq. (7) with $\boldsymbol{g}^i$, we obtain

\begin{equation} a^i=a_1g^{1i}+a_2g^{2i} \end{equation}


\begin{equation} a_i=a^1g_{1i}+a^2g_{2i}. \end{equation}

Covariant and contravariant components can be converted as such. This translation can be performed with metric only. Using summation convention, we can write

\begin{align} a^\alpha=a_ig^{i\alpha} \end{align}


\begin{align} a_\alpha=a^ig_{i\alpha}. \end{align}

This is known as raising and lowering indices laws of tensors. Also, this is a generalization to an arbitrary dimension.
For contravaiant basis, we can define

\begin{align} g^{ij}=\boldsymbol{g}^i\cdot\boldsymbol{g}^j. \end{align}

This "the other metric" can be computed by

\begin{align} \left[\begin{array}{ccc}g^{11}g^{12}\\g^{12}g^{22} \end{array}\right]=\left[\begin{array}{ccc}g_{11}g_{12}\\g_{12}g_{22} \end{array}\right]^{-1}. \end{align}

Actually, in a most common manner, $g^{ij}$ is calculated first and then $\boldsymbol{g}^i$ are calculated second by using

\begin{align} \boldsymbol{g}^1=g^{11}\boldsymbol{g}_1+g^{12}\boldsymbol{g}_2 \end{align}


\begin{align} \boldsymbol{g}^2=g^{12}\boldsymbol{g}_1+g^{22}\boldsymbol{g}_2. \end{align}

Note that these satisfy Eq. (2). Using summation convention, we can write

\begin{align} \boldsymbol{g}^{j}=g^{ij}\boldsymbol{g}_i \end{align}

Because we have two different types of components, there are four ways to calculate inner products between tangent vectors and they are:

\begin{align} <\boldsymbol{a},\boldsymbol{b}>=a^ib^jg_{ij}=a_ib_jg^{ij}=a_ib^j=a^ib_j. \end{align}

They give the same scalar.