The vector $\textbf{a} = a_{i}\textbf{e}^{i}$ in terms of covariant components. In terms of contravariant components, $\textbf{a} = a^{i}\textbf{e}_{i} = a^{j}\textbf{e}_j$. Thus, $a_{i}\textbf{e}^{i} = a^{j}\textbf{e}_j$. Multiplying both sides by the metric tensor, we have
$$g_{ij} a_i \textbf{e}^i = g_{ij} a^j \textbf{e}_j = a_i \textbf{e}_j $$
and
$$g_{ij} \textbf{e}^i = \textbf{e}_j\,.$$
However, the textbook I'm reading (Riley, Hobson and Bence-Mathematical Methods for Physics and Engineering, P959) lists the relation as
$$g_{ij} \textbf{e}^j = \textbf{e}_i \, .$$
Where have I gone wrong? How do I get the correct relationship?
The book defines $\textbf{a}$ in two different ways
$$\textbf{e}_i = \frac{\partial \textbf{r}}{\partial u^i} \quad \text{and}\quad \textbf{e}^i = \nabla u^i \, .$$ From the first equality we see that we may consider a superscript that appears in the denominator of a partial derivative as a subscript.
Given the two bases $\textbf{e}_i$ and $\textbf{e}^i$, we may write a general vector $\textbf{a}$ equally well in terms of either basis as follows: \begin{align} a &= a^1 \textbf{e}_1 + a^2 \textbf{e}_2 + a^3 \textbf{e}_3 = a^i \textbf{e}_i \\ a &= a_1 \textbf{e}^1 + a_2 \textbf{e}^2 + a_3 \textbf{e}^3 = a_i \textbf{e}^i \, . \end{align} The $a^i$ are called the contravariant components of the vector $\textbf{a}$ and the $a_i$ are called the covariant components, the position of the index (either as a subscript or or superscript) serving to distinguish between them. Similarly, we may call the $\textbf{e}_i$ the covariant basis and vectors and the $\textbf{e}^i$ the contravariant ones.