Another common operation applied to a matrix is known as the transpose of the matrix, or in mathematical terms, .
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 matrix would become a matrix.
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 and the first row of the transposed matrix also reads .
Third, the transpose of a transpose is itself:
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.
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.
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?
You will notice that space gets flattened into a line. This is called the covariance matrix and specifies a vector where the two matrices transform with each other.