This material has been adapted from material by Fergus Cooper and others from the "Essential Mathematics" module at the Doctoral Training Centre, University of Oxford.
This course material was developed as part of UNIVERSE-HPC, which is funded through the SPF ExCALIBUR programme under grant number EP/W035731/1
Linear algebra 2
Learning outcomes
Understand what makes a matrix singular, and the rank of a matrix
Be able to find the null space of a singular matrix
Understand eigenvectors as the directions a matrix only stretches
Be able to find the eigenvalues and eigenvectors of a 2x2 matrix by hand, and of any matrix with Python
Be able to normalise a vector, and know when two vectors are orthogonal
Be able to diagonalise a matrix, and know why this is useful
Know that symmetric matrices have orthogonal eigenvectors
YouTube lecture recording from October 2020
A recording of this lecture from October 2020; the material has changed a little since.
Why eigenvalues?
In lecture 12 we wrote systems of linear equations as Ax=b, and solved them by inverting A, as long as A is not singular.
In this lecture we look more closely at singular matrices: why they have no inverse, and what that means for the equations.
Then we meet the eigenvalues and eigenvectors of a matrix.
Multiplying a vector by a matrix usually changes its direction, but the eigenvectors are special directions that the matrix only stretches, and the eigenvalues say by how much.
In lectures 14 to 16, eigenvalues let us solve systems of differential equations, and decide whether their steady states are stable.
Using Python to calculate the inverse
In lecture 12 we solved Ax=b directly with np.linalg.solve.
We can also calculate the inverse itself.
To find A−1 for
A=3300012−31
NumPy
import numpy as np
A = np.array([[3,0,2],[3,0,-3],[0,1,1]])np.linalg.inv(A)
The −0. in the bottom right is a tiny negative rounding error, like the ones we saw in lecture 12: the exact value is 0, as SymPy shows.
SymPy
import sympy as sp
A = sp.Matrix([[3,0,2],[3,0,-3],[0,1,1]])A.inv()
51−515115251−51010
It doesn't always work
Consider the following system
eq1:eq2:eq3:x2x7x+++y5y10y+++z2z7z===abc
A = np.array([[1,1,1],[2,5,2],[7,10,7]])np.linalg.inv(A)
numpy.linalg.LinAlgError: Singular matrix
The matrix is singular because the equations are not independent: the left-hand side of eq3 is 5×eq1+eq2, since 5×(x+y+z)+(2x+5y+2z)=7x+10y+7z.
So eq3 tells us nothing new, and really there are only two equations for three unknowns.
Singular matrices
The rank of an n×n matrix A is the number of linearly independent rows in A (rows that are not combinations of other rows).
In the example above, the third row is a combination of the first two, so the rank is 2.
When rank(A)<n:
the system Ax=b has fewer independent equations than unknowns;
the matrix is said to be singular;
A has no inverse;
the determinant of A is 0;
the equation Au=0 has non-trivial solutions (solutions where u=0).
Singular matrix example
With too few independent equations, there may be many solutions or no solutions.
An example with many solutions is
x+y2x+2y=1,=2.
The second equation is just twice the first, so in the picture from lecture 12 the two lines are the same line, and every point on it is a solution: for example x=0, y=1, or x=2, y=−1, or x=−89.3, y=90.3.
An example with no solutions is
x+y2x+2y=1,=0,
where the second equation is inconsistent with the first (it says x+y=0): the two lines are parallel, and never cross.
Both examples use the matrix
(1212),
which has rank 1, and determinant 1×2−1×2=0.
Whether there are many solutions or none depends on the right-hand side, but with a singular matrix there is never exactly one.
Null space
When a matrix is singular we can find non-trivial solutions to Au=0.
These vectors form the null space of A.
Any vector in the null space makes no difference to the effect that A is having:
A(x+u)=Ax+Au=Ax+0=Ax.
So if x is a solution of Ax=b, then so is x+u, which is why a singular system can have many solutions.
Any combination or scaling of vectors in the null space is also in the null space.
That is, if Au=0 and Av=0 then
A(αu+βv)=αAu+βAv=0.
The number of linearly independent vectors in the null space is denoted null(A), and for an n×n matrix
null(A)+rank(A)=n.
Null space example
Our singular system has the matrix
A=1271510127.
To find its null space by hand, we solve Au=0 with u=(x,y,z)T.
The third row is a combination of the first two, so it adds nothing new, and we only need the first two rows:
x+y+z2x+5y+2z=0,=0.
Subtracting twice the first equation from the second gives 3y=0, so y=0, and then the first equation gives x=−z.
So the null space is all the multiples of (1,0,−1)T: one independent vector, so null(A)=1, and rank(A)=3−1=2.
In Python, np.linalg.matrix_rank gives the rank, and scipy.linalg.null_space gives the null space:
A = np.array([[1,1,1],[2,5,2],[7,10,7]])print(np.linalg.matrix_rank(A))
This is (−1,0,1)T/2: a multiple of (1,0,−1)T, scaled to have length 1 (see normalised vectors below).
The −1.1×10−16 is a rounding error, and should be 0.
Scaled vectors in the null space are also in the null space, so for example x=−1000, y=0, z=1000 is in it too.
Try it:
1271510127−100001000=?
A @ np.array([-1000,0,1000])
array([0, 0, 0])
Eigenvectors and eigenvalues
We now turn from singular matrices to the eigenvalues and eigenvectors of a matrix.
Motivation
Multiplying a vector by a matrix usually changes its direction as well as its length.
For example, take the matrix from lecture 12's note on the determinant,
A=(2112).
Below, v (blue) is a vector of length 1 at an angle of π/8 radians to the x axis, and Av (orange) points in a different direction from it (the dotted line extends v):
As v turns, Av mostly points a different way.
But along two special directions, Av is just a multiple of v.
At an angle of π/4, v=(1,1)T/2, and Av=3v:
At an angle of 3π/4, v=(−1,1)T/2, and Av=v.
These two directions are the eigenvectors of A, and the multiples, 3 and 1, are its eigenvalues.
So eigenvalues and eigenvectors give an indication of how much effect a matrix has, and in what direction.
Two more examples:
B=(20021)
doubles in x, but halves in y.
Its eigenvectors are along the axes, (1,0)T and (0,1)T, with eigenvalues 2 and 21, and repeated applications of B move points towards (±∞,0).
R=(cos4πsin4π−sin4πcos4π)
rotates every vector by π/4 radians, and leaves its length unchanged.
It leaves no direction unchanged, so it has no real eigenvectors: its eigenvalues are complex numbers, 21(1±i), and we will meet complex eigenvalues again in lecture 16.
Where eigenvalues are used
In lectures 14 to 16, eigenvalues and eigenvectors let us solve systems of linear differential equations, and decide whether the steady states of nonlinear ones are stable.
They appear across biology and beyond.
For example, the long-term growth rate of a population with several age classes is the largest eigenvalue of its (Leslie) matrix.
The long-term state of a Markov chain, such as a model of a molecule switching between conformations, is an eigenvector of its matrix of transition probabilities.
Principal component analysis finds the directions of greatest variation in data, such as gene expression measurements, as eigenvectors.
Definition
If A is a square matrix, v is a non-zero vector, λ is a scalar, and
Av=λv
then v is called an eigenvector and λ is the corresponding eigenvalue.
If v is an eigenvector, then so is any scaling av (with a=0):
A(av)=aAv=aλv=λ(av).
So an eigenvector is really a direction, and we can choose any non-zero vector along it.
Finding eigenvalues
We can rearrange the equation for an eigenvector, using Iv=v:
AvAv−λIv(A−λI)v=λv,=0,=0.
If A−λI had an inverse, we could multiply both sides by it to get v=(A−λI)−10=0.
But an eigenvector is non-zero, so A−λI must be singular, and its determinant must be zero:
∣A−λI∣=0.
This equation gives the eigenvalues.
In the picture from lecture 12, it says that A−λI squashes the plane flat, sending a whole direction of non-zero vectors to 0: that direction is the eigenvector.
NumPy's np.linalg.eig finds the eigenvalues and eigenvectors together:
A = np.array([[-2,-2],[1,-5]])eigenvalues, eigenvectors = np.linalg.eig(A)eigenvalues
array([-3.+0.j, -4.+0.j])
The +0.j shows that NumPy has stored the eigenvalues as complex numbers, each with imaginary part zero.
In SymPy, eigenvals gives each eigenvalue, and how many times it is repeated:
A = sp.Matrix([[-2,-2],[1,-5]])A.eigenvals()
{−4:1,−3:1}
Finding eigenvectors
For each eigenvalue, the corresponding eigenvector comes from substituting into Av=λv.
Example
What are the eigenvectors of
A=(−21−2−5)?
The eigenvalues are λ1=−3 and λ2=−4, and we write v=(x,y)T.
For λ1=−3:
(−21−2−5)(xy)=(−3x−3y).
The top row says −2x−2y=−3x, so x=2y.
The bottom row says x−5y=−3y, which also gives x=2y: because A−λI is singular, the two rows always agree.
So any vector with x=2y is an eigenvector:
v1=(21),(10.5),(−4.4−2.2),(2αα)…
For λ2=−4, the top row says −2x−2y=−4x, so x=y, and
v2=(11)
or any multiple of it.
Normalised vectors
The length (or magnitude) of a vector v=(x,y,z)T is
∥v∥=x2+y2+z2,
and similarly for vectors of any size.
Dividing a vector by its length gives the normalised vector, which points the same way and has length 1:
∥v∥v=x2+y2+z21xyz.
For example, v1=(2,1)T has length 22+12=5, so normalised it is (2,1)T/5=(0.894,0.447)T.
Eigenvectors in Python
NumPy gives the eigenvectors as the columns of a matrix, normalised:
These are (2,1)T/5 and (1,1)T/2, in the same order as the eigenvalues −3 and −4.
SymPy's eigenvects gives each eigenvalue, how many times it is repeated, and a list of its eigenvectors:
A.eigenvects()
[(−4,1,[[11]]),(−3,1,[[21]])]
Diagonalising matrices
Suppose an n×n matrix A has n linearly independent eigenvectors v1,…,vn, with eigenvalues λ1,…,λn.
Put the eigenvectors in the columns of a matrix P, and the eigenvalues on the diagonal of a diagonal matrix D:
P=(v1⋯vn),D=λ10⋱0λn.
Then AP=PD, because column i of each side is Avi=λivi.
The eigenvectors are independent, so P has an inverse, and
A=PDP−1.
This separates how much effect the matrix has (the λi) from the directions it acts in (the vi).
Example
For our example, with v1=(2,1)T and v2=(1,1)T,
P=(2111),D=(−300−4),P−1=(1−1−12),
using the formula for the inverse of a 2x2 matrix (∣P∣=1).
Multiplying out:
PDP−1=(−6−3−4−4)(1−1−12)=(−21−2−5)=A.
In Python:
P = eigenvectors
D = np.diag(eigenvalues)P @ D @ np.linalg.inv(P)
array([[-2.+0.j, -2.+0.j],
[ 1.+0.j, -5.+0.j]])
NumPy's P has normalised columns, so it is not the same as ours, but any (non-zero) scaling of the eigenvectors works.
Why diagonalise?
Powers of A become easy, because each P−1P in the middle cancels:
Ak=(PDP−1)(PDP−1)⋯(PDP−1)=PDkP−1,
and the power of a diagonal matrix is just the powers of its diagonal elements:
Dk=(λ1k00λ2k).
In lecture 14 the same idea uncouples a system of differential equations into separate equations that we can solve one at a time.
Not every matrix can be diagonalised.
For example,
(1011)
has the repeated eigenvalue 1, but only one eigenvector direction, (1,0)T, so there are not enough eigenvectors to make P.
Whether a matrix can be diagonalised has nothing to do with whether it is singular: this matrix has determinant 1, while a singular matrix such as (1000) is already diagonal.
Symmetric matrices
Symmetric matrices have especially simple eigenvectors, which are at right angles to each other.
To say this precisely we need the dot product.
Orthogonal vectors
The dot (or scalar) product of two vectors multiplies them element by element and adds up the results.
For example,
x1⋅x2=2−13⋅271=2×2+(−1×7)+(3×1)=4−7+3=0.
If the dot product of two vectors is zero, they are perpendicular, or orthogonal.
So here x1 and x2 are orthogonal.
The dot product of a vector with itself is its length squared: v⋅v=∥v∥2.
In matrix form, the dot product of two column vectors is x1⋅x2=x1Tx2.
Symmetric matrices have orthogonal eigenvectors
A matrix is symmetric if it is equal to its transpose, AT=A.
Symmetric matrices have real eigenvalues, and their eigenvectors (for different eigenvalues) are orthogonal.
For example,
A=1920−1620134−16431
is symmetric.
For a symmetric matrix, NumPy has np.linalg.eigh, which is faster and more accurate than eig, gives real results, and gives the eigenvalues in increasing order:
A = np.array([[19,20,-16],[20,13,4],[-16,4,31]])eigenvalues, P = np.linalg.eigh(A)print(eigenvalues)print(P)# The eigenvectors are orthogonal and normalised, so P^T P = Iprint(np.round(P.T @ P,12))
Element (i,j) of PTP is the dot product of eigenvectors i and j.
So the 1s on the diagonal say that each eigenvector has length 1, and the 0s elsewhere say that each pair is orthogonal.
We round to 12 decimal places, because without rounding the 0s come out as rounding errors of about 10−16.
Orthogonal matrices
A matrix is orthogonal if its columns are normalised, orthogonal vectors.
As we have just seen, if M is orthogonal then MTM=I, so
M−1=MT.
For a symmetric matrix, we can choose normalised eigenvectors, so P is orthogonal, and the diagonalising equation is simplified:
A=PDP−1=PDPT.
Summary
A singular matrix has rank less than its size: some of its equations are combinations of others, and Ax=b has many solutions or none.
The null space of A is the set of solutions of Au=0.
An eigenvector of A is a non-zero vector with Av=λv: find the eigenvalues from ∣A−λI∣=0, then each eigenvector by substitution.
A matrix with a full set of independent eigenvectors can be diagonalised, A=PDP−1; we will use this for systems of differential equations.
Symmetric matrices have orthogonal eigenvectors, and A=PDPT.
In Python: np.linalg.inv, np.linalg.matrix_rank, scipy.linalg.null_space, np.linalg.eig and np.linalg.eigh, and SymPy's inv, eigenvals and eigenvects.
Introductory problems
Tip
For more practice, an AI tool can write new problems like the ones below.
Ask it for problems of the same type and difficulty, or for problems set in your own field.
For example, you could ask it to "write five physics problems on eigenvalues and eigenvectors, at the level of these ones".
Work them on paper first, then ask the tool to check your answers and to explain any step you are unsure of.
verify by hand, and using the numpy.linalg module, that
AA−1=A−1A=I;
BB−1=B−1B=I;
CC−1=C−1C=I;
# hintimport numpy as np
# In Python the imaginary unit is "1j"A = np.array([[1,0],[0,1j]])print(A @ np.linalg.inv(A))
By hand, we use the formula for the inverse of a 2×2 matrix:
(acbd)−1=ad−bc1(d−c−ba)
∣A∣=1×i−0=i, so
A−1=i1(i001)=(100−i)
since 1/i=−i.
Multiplying out, AA−1 and A−1A are both diagonal, with diagonal entries 1×1=1 and i×(−i)=1, so they equal I.
∣B∣=0−i×i=1, so
B−1=(0−i−i0)
Multiplying out,
BB−1=(0+i×(−i)00i×(−i)+0)=(1001)
and B−1B=I in the same way.
∣C∣=−21−41(1−i)(1+i)=−21−42=−1, so
C−1=−(−21−21(1+i)−21(1−i)21)=C
So, C is its own inverse, and we need to check that CC=I.
The top-left entry is 21+41(1−i)(1+i)=21+21=1, and the top-right entry is 21⋅21(1−i)−21(1−i)⋅21=0.
The bottom row works in the same way, so CC=I.
In Python, note that * multiplies matrices element by element, so we use @ for matrix multiplication:
import numpy as np
A = np.array([[1,0],[0,1j]])B = np.array([[0,1j],[1j,0]])C = np.array([[1/ np.sqrt(2),(1-1j)/2],[(1+1j)/2,-1/ np.sqrt(2)]])for M in[A, B, C]:print(M @ np.linalg.inv(M))print(np.linalg.inv(M) @ M)
For C, the off-diagonal entries are about 10−17 rather than exactly 0.
This is rounding error, because the computer stores numbers such as 1/2 to only about 16 significant figures.
np.allclose(C @ np.linalg.inv(C), np.eye(2)) checks that the result equals I to within this rounding.
Introductory problems 2
Let A be an n×n invertible matrix. Let I be the n×n identity matrix and let B be an n×n matrix.
Suppose that ABA−1=I.
Determine the matrix B in terms of the matrix A.
Multiply both sides on the right by A:
ABA−1A=IA⟹AB=A
Then multiply both sides on the left by A−1:
A−1AB=A−1A⟹B=I
So, B is the identity matrix, whatever the matrix A.
Main problems
Main problems 1
Let A be the coefficient matrix of the system of linear equations
−x1−2x22x1+3x2=1,=−1.
Solve the system by finding the inverse matrix A−1.
Let x=(x1,x2)T be the solution of the system obtained in part 1.
Calculate and simplify A2017x.
The system is Ax=b, with
A=(−12−23)andb=(1−1)
∣A∣=−3+4=1, so
A−1=(3−22−1)andx=A−1b=(3−2−2+1)=(1−1)
Multiplying out,
Ax=(−12−23)(1−1)=(1−1)=x
So, multiplying x by A leaves it unchanged, and doing this 2017 times still leaves it unchanged:
A2017x=x=(1−1)
In other words, x is an eigenvector of A with eigenvalue 1.
Main problems 2
For each of the following matrices
A=(2134);B=(4628);C=(1141);D=(x00y),
compute the determinant, eigenvalues and eigenvectors by hand.
Check your results by verifying that Qx=λix, where Q=A, B, C or D, and by using the numpy.linalg module.
# hintimport numpy as np
A = np.array([[2,3],[1,4]])e_vals, e_vecs = np.linalg.eig(A)print(e_vals)print(e_vecs)
In each case we solve ∣Q−λI∣=0 for the eigenvalues, then substitute each one into (Q−λI)v=0 to find an eigenvector v=(u,v)T.
Any multiple of an eigenvector is also an eigenvector.
A:∣A∣=8−3=5, and
∣A−λI∣=(2−λ)(4−λ)−3=λ2−6λ+5=(λ−1)(λ−5)=0
For λ1=1, u+3v=0, so v1=(−3,1)T.
For λ2=5, −3u+3v=0, so v2=(1,1)T.
Check: A(1,1)T=(5,5)T=5(1,1)T.
B:∣B∣=32−12=20, and
∣B−λI∣=(4−λ)(8−λ)−12=λ2−12λ+20=(λ−2)(λ−10)=0
For λ1=2, 2u+2v=0, so v1=(−1,1)T.
For λ2=10, −6u+2v=0, so v2=(1,3)T.
Check: B(1,3)T=(10,30)T=10(1,3)T.
C:∣C∣=1−4=−3, and
∣C−λI∣=(1−λ)2−4=λ2−2λ−3=(λ−3)(λ+1)=0
For λ1=3, −2u+4v=0, so v1=(2,1)T.
For λ2=−1, 2u+4v=0, so v2=(−2,1)T.
Check: C(−2,1)T=(2,−1)T=−1×(−2,1)T.
D:∣D∣=xy.
D is diagonal, so ∣D−λI∣=(x−λ)(y−λ)=0, and the eigenvalues are its diagonal entries, λ1=x and λ2=y.
The eigenvectors are v1=(1,0)T and v2=(0,1)T, since D(1,0)T=(x,0)T and D(0,1)T=(0,y)T.
(If x=y, every vector is an eigenvector.)
In Python:
import numpy as np
for Q in[np.array([[2,3],[1,4]]), np.array([[4,2],[6,8]]), np.array([[1,4],[1,1]])]: e_vals, e_vecs = np.linalg.eig(Q)print(np.linalg.det(Q))print(e_vals)print(e_vecs)
The eigenvalues agree with ours (the +0.j shows that their imaginary parts are zero).
The eigenvectors are the columns of e_vecs, and NumPy scales each one to have length 1, so they are multiples of ours.
For example, the first column for A is (−0.949,0.316)T=(−3,1)T/10, and the second is (−0.707,−0.707)T=−(1,1)T/2.
The determinants are not exact whole numbers because of rounding error.
Main problems 3
Orthogonal vectors.
Two vectors x1 and x2 are said to be perpendicular or orthogonal if their dot/scalar product is zero:
So, any vector of the form t(−2,1)T is orthogonal to (1,2)T, for any number t=0.
There are infinitely many such vectors, but they all lie along one line.
A vector (a,b,c)T is orthogonal to (1,2,−1)T when
a+2b−c=0,soc=a+2b
Here we can choose both a and b, so the vectors are
aba+2b=a101+b012
for example (1,0,1)T, (0,1,2)T or (−2,1,0)T.
Again there are infinitely many, but this time they fill a whole plane (the plane through the origin perpendicular to (1,2,−1)T).
Main problems 4
Diagonalise the 2×2 matrix
A=(2−1−12)
by finding a non-singular matrix S and a diagonal matrix D such that A=SDS−1.
First we find the eigenvalues:
∣A−λI∣=(2−λ)2−1=λ2−4λ+3=(λ−1)(λ−3)=0
For λ1=1, (A−I)v=0 gives u−v=0, so v1=(1,1)T.
For λ2=3, (A−3I)v=0 gives −u−v=0, so v2=(1,−1)T.
S has the eigenvectors as its columns, and D has the eigenvalues on its diagonal, in the same order:
S=(111−1),D=(1003),S−1=21(111−1)
We can check this by multiplying out:
SDS−1=(113−3)21(111−1)=21(4−2−24)=A
(Other answers are possible: the eigenvectors can be scaled, or listed in the other order, as long as D matches.)
Main problems 5
Find a 2×2 matrix A such that
A(21)=(−14)andA(53)=(02).
Put the two vectors side by side as the columns of one matrix, and the two results as the columns of another.
Then both conditions together say that
A(2153)=(−1402)
The determinant of the left-hand matrix is 6−5=1, so its inverse is
(2153)−1=(3−1−52)
Multiplying both sides on the right by this inverse,
A=(−1402)(3−1−52)=(−3105−16)
Check: A(2,1)T=(−6+5,20−16)T=(−1,4)T and A(5,3)T=(−15+15,50−48)T=(0,2)T.
Main problems 6
Consider the matrices
A=(2142);B=(1324);C=121241361.
Calculate the determinant of A and of B.
Which of A, B and C are singular?
Find the rank of each matrix.
For each singular matrix, find a non-zero vector u in its null space, so that Au=0 or Cu=0.
Without solving them, say whether each of these systems has many solutions or no solutions, and explain why:
2x+4yx+2y=6,=3;2x+4yx+2y=6,=1.
Check your answers to parts 2. and 3. using numpy.linalg.matrix_rank and scipy.linalg.null_space.
∣A∣=2×2−4×1=0 and ∣B∣=1×4−2×3=−2.
So, A is singular and B is not.
The second row of C is twice its first row, so C is singular too (and ∣C∣=0).
The rows of A are multiples of each other, so A has rank 1.
B is not singular, so it has rank 2.
In C, the second row is a multiple of the first, but the third row is not a combination of the others, so C has rank 2.
For A, we need 2u1+4u2=0 and u1+2u2=0, which are the same equation.
So, u1=−2u2, and taking u2=1 gives u=(−2,1)T.
Any multiple of this vector is also in the null space.
For C, the first two rows give the same equation, so we need
u1+2u2+3u3u1+u2+u3=0,=0.
Subtracting the second equation from the first gives u2+2u3=0, so u2=−2u3.
Then u1=−u2−u3=u3.
Taking u3=1 gives u=(1,−2,1)T.
Check: C(1,−2,1)T=(1−4+3,2−8+6,1−2+1)T=(0,0,0)T.
Both systems use the singular matrix A.
In the first, the first equation is exactly twice the second, so there is really only one equation, x+2y=3, and it has infinitely many solutions (for example x=3, y=0, or x=1, y=1).
In the second, twice the second equation gives 2x+4y=2, which contradicts the first equation, so there are no solutions.
In Python:
import numpy as np
import scipy.linalg
A = np.array([[2,4],[1,2]])B = np.array([[1,2],[3,4]])C = np.array([[1,2,3],[2,4,6],[1,1,1]])for M in[A, B, C]:print(np.linalg.matrix_rank(M))print(scipy.linalg.null_space(M))
The null space of B is empty, as it should be for a matrix that is not singular.
SciPy returns vectors of unit length, so they are scaled versions of ours: (−2,1)T/5 and (1,−2,1)T/6.
Extension problems
Extension problems 1
If there exists a matrix M whose columns are those of normalised (unit length) and orthogonal vectors, prove that MTM=I which implies that MT=M−1.
Let M be an n×n matrix with columns c1,c2,…,cn.
The rows of MT are then c1T,c2T,…,cnT.
The entry in row i and column j of MTM is row i of MT times column j of M, which is the dot product ci⋅cj:
The columns have unit length, so ci⋅ci=1, and each pair is orthogonal, so ci⋅cj=0 for i=j.
So, every diagonal entry is 1 and every other entry is 0, which means that MTM=I.
By definition, M−1 is the matrix that multiplies M to give I, so MT=M−1.
(For a square matrix, if MTM=I then MMT=I too.)