The introduction to tensor calculus that I am reading cites on page sixteen that the inner product of two contravariant vectors $x^\mu$ and $y^\nu$ is $$s=g_{\mu\nu}x^\mu y^\nu$$ where $g_{\mu\nu}$ is the metric tensor, which may need to be defined differently for different coordinate systems.
This is then immediately expanded into
$$g_{\mu\nu}x^\mu y^\nu = \begin{pmatrix} x^1 & x^2 & x^3 \\ \end{pmatrix} \begin{pmatrix} g_{11} & g_{12} & g_{13} \\ g_{21} & g_{22} & g_{23} \\ g_{31} & g_{32} & g_{33} \\ \end{pmatrix} \begin{pmatrix} y^1 \\ y^2 \\ y^3 \\ \end{pmatrix}$$
How did $g$ and $x$ flip orders, and how did $x$ go from being represented as a column to represent as a row? Is the order not significant? (I assumed it was.)
I can tell these two switch-ups are clearly related, but other than that, I’m in the dark.
In the first expression, you can write the factors in any order, since it's just shorthand for $\sum_\mu \sum_\nu g_{\mu\nu} x_\mu y_\nu$ where each term $g_{\mu\nu} x_\mu y_\nu$ is simply a product of numbers, where order doesn't matter.
But in the second expression, it's written using matrix multiplication, where order does matter: for the matrix product $AB$ to even be defined, the matrix $A$ must have the same number of columns as the number of rows in $B$. And even if the products $AB$ and $BA$ both happen to be defined, they are in general not equal.
To see that your two expressions are the same, just write out what the sum is (nine terms), and just compute the matrix product according to the rules of matrix multiplication. Then it should be obvious that you get exactly the same expression.