# Transposes

Another common operation applied to a matrix is known as the transpose of the matrix, or in mathematical terms, ${A}^{T}$.

The transpose is defined for matrices of any size and flips all elements along the main diagonal, inverting the columns and rows. For instance, a $4×3$ matrix would become a $3×4$ matrix.

${\left[\begin{array}{cccc}1& 2& 3& 4\\ 5& 6& 7& 8\\ 9& 10& 11& 11\end{array}\right]}^{T}=\left[\begin{array}{ccc}1& 5& 9\\ 2& 6& 10\\ 3& 7& 11\\ 4& 8& 11\end{array}\right]$

A few things to notice here. First, the elements on the diagonal stay the same. Second, the elements maintain their order relative to each other. The first column reads $\left[\begin{array}{c}1\\ 5\\ 9\end{array}\right]$and the first row of the transposed matrix also reads $\left(1,5,9\right)$.

Third, the transpose of a transpose is itself:

${\left[\begin{array}{ccc}1& 5& 9\\ 2& 6& 10\\ 3& 7& 11\\ 4& 8& 11\end{array}\right]}^{T}=\left[\begin{array}{cccc}1& 2& 3& 4\\ 5& 6& 7& 8\\ 9& 10& 11& 11\end{array}\right]$

Consider the case of a square matrix that is transposed. What would the resulting transformation look like? Take for instance, this transformation which rotates and scales an area.

$\left[\begin{array}{cc}0& 2\\ -2& 0\end{array}\right]$

When we flip along the diagonal, we still get a rotation (we do not get a transformation that undoes the rotation), but it is curiously in the opposite direction.

$\left[\begin{array}{cc}0& -2\\ 2& 0\end{array}\right]$

The same sort of effect happens in three dimensions too. Take this matrix which rotates around the y axis by about thirty degrees and scales on the y axis by 2.

The transpose of this matrix rotates around the y axis by negative thirty degrees, but still scales on the y axis by 2.

We say that then that the transpose is the contravariant transformation. Instead of vectors transforming with the matrix, they are transformed against it.

What happens if we premultiply a matrix by its own transpose?

$\left[\begin{array}{ccc}0& 0& 1\\ 0& 2& 0\\ -1& 0& 0\end{array}\right]$$\left[\begin{array}{ccc}0& 0& -1\\ 0& 2& 0\\ 1& 0& 0\end{array}\right]$=$\left[\begin{array}{ccc}1& 0& 0\\ 0& 4& 0\\ 0& 0& 1\end{array}\right]$

Notice that the result shows that we have covariant scaling on the $y$ axis and everything else on the other two axes just has a unit covariance.