Skip to main content
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 material has been adapted from material by Fergus Cooper and others from the "Essential Mathematics" module at the Doctoral Training Centre, University of Oxford.

Creative Commons License
This course material was developed as part of UNIVERSE-HPC, which is funded through the SPF ExCALIBUR programme under grant number EP/W035731/1

This course material was developed as part of UNIVERSE-HPC, which is funded through the SPF ExCALIBUR programme under grant number EP/W035731/1

Creative Commons License

Linear algebra 2


YouTube lecture recording from October 2020

A recording of this lecture from October 2020; the material has changed a little since.
Youtube lecture thumbnail

Why eigenvalues?

In lecture 12 we wrote systems of linear equations as Ax=bA\mathbf{x} = \mathbf{b}, and solved them by inverting AA, as long as AA 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=bA\mathbf{x} = \mathbf{b} directly with np.linalg.solve. We can also calculate the inverse itself. To find A−1A^{-1} for
A=(30230−3011)A = \begin{pmatrix}3&0&2\\ 3&0&-3\\ 0&1&1\end{pmatrix}

NumPy

import numpy as np A = np.array([[3, 0, 2], [3, 0, -3], [0, 1, 1]]) np.linalg.inv(A)
array([[ 0.2 , 0.13333333, 0. ], [-0.2 , 0.2 , 1. ], [ 0.2 , -0.2 , -0. ]])
The −0.-0. in the bottom right is a tiny negative rounding error, like the ones we saw in lecture 12: the exact value is 00, as SymPy shows.

SymPy

import sympy as sp A = sp.Matrix([[3, 0, 2], [3, 0, -3], [0, 1, 1]]) A.inv()
[152150−1515115−150]\def\arraystretch{1.8}\left[\begin{matrix}\frac{1}{5} & \frac{2}{15} & 0\\- \frac{1}{5} & \frac{1}{5} & 1\\\frac{1}{5} & - \frac{1}{5} & 0\end{matrix}\right]

It doesn't always work

Consider the following system
eq1:x+y+z=aeq2:2x+5y+2z=beq3:7x+10y+7z=c\begin{array}{cccccccc} eq1: & x & + & y & + & z & = & a \\ eq2: & 2x & + & 5y & + & 2z & = & b \\ eq3: & 7x & +& 10y & + & 7z & = & c \end{array}
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 eq3eq3 is 5×eq1+eq25\times eq1 + eq2, since 5×(x+y+z)+(2x+5y+2z)=7x+10y+7z5\times(x + y + z) + (2x + 5y + 2z) = 7x + 10y + 7z. So eq3eq3 tells us nothing new, and really there are only two equations for three unknowns.

Singular matrices

The rank of an n×nn\times n matrix AA is the number of linearly independent rows in AA (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\text{rank}(A) < n:
  • the system Ax=bA\mathbf{x} = \mathbf{b} has fewer independent equations than unknowns;
  • the matrix is said to be singular;
  • AA has no inverse;
  • the determinant of AA is 0;
  • the equation Au=0A\mathbf{u} = \mathbf{0} has non-trivial solutions (solutions where u≠0\mathbf{u} \neq \mathbf{0}).

Singular matrix example

With too few independent equations, there may be many solutions or no solutions. An example with many solutions is
x+y=1,2x+2y=2.\begin{aligned} x+y &= 1,\\ 2x+2y &= 2. \end{aligned}
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=0x=0, y=1y=1, or x=2x=2, y=−1y=-1, or x=−89.3x=-89.3, y=90.3y=90.3.
An example with no solutions is
x+y=1,2x+2y=0,\begin{aligned} x+y &= 1,\\ 2x+2y &= 0, \end{aligned}
where the second equation is inconsistent with the first (it says x+y=0x + y = 0): the two lines are parallel, and never cross.
Both examples use the matrix
(1122),\begin{pmatrix}1&1\\ 2&2\end{pmatrix},
which has rank 1, and determinant 1×2−1×2=01\times 2 - 1\times 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=0A\mathbf{u} = \mathbf{0}. These vectors form the null space of AA.
Any vector in the null space makes no difference to the effect that AA is having:
A(x+u)=Ax+Au=Ax+0=Ax.A(\mathbf{x} + \mathbf{u}) = A\mathbf{x} + A\mathbf{u} = A\mathbf{x} + \mathbf{0} = A\mathbf{x}.
So if x\mathbf{x} is a solution of Ax=bA\mathbf{x} = \mathbf{b}, then so is x+u\mathbf{x} + \mathbf{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=0A\mathbf{u} = \mathbf{0} and Av=0A\mathbf{v} = \mathbf{0} then
A(αu+βv)=αAu+βAv=0.A(\alpha\mathbf{u} + \beta\mathbf{v}) = \alpha A\mathbf{u} + \beta A\mathbf{v} = \mathbf{0}.
The number of linearly independent vectors in the null space is denoted null(A)\text{null}(A), and for an n×nn\times n matrix
null(A)+rank(A)=n.\text{null}(A) + \text{rank}(A) = n.

Null space example

Our singular system has the matrix
A=(1112527107).A = \left(\begin{matrix} 1& 1& 1\\ 2& 5& 2\\ 7& 10&7 \end{matrix}\right).
To find its null space by hand, we solve Au=0A\mathbf{u} = \mathbf{0} with u=(x,y,z)T\mathbf{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+z=0,2x+5y+2z=0.\begin{aligned} x + y + z &= 0, \\ 2x + 5y + 2z &= 0. \end{aligned}
Subtracting twice the first equation from the second gives 3y=03y = 0, so y=0y = 0, and then the first equation gives x=−zx = -z. So the null space is all the multiples of (1,0,−1)T(1, 0, -1)^T: one independent vector, so null(A)=1\text{null}(A) = 1, and rank(A)=3−1=2\text{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))
2
import scipy.linalg scipy.linalg.null_space(A)
array([[-7.07106781e-01], [-1.11022302e-16], [ 7.07106781e-01]])
This is (−1,0,1)T/2(-1, 0, 1)^T/\sqrt{2}: a multiple of (1,0,−1)T(1, 0, -1)^T, scaled to have length 1 (see normalised vectors below). The −1.1×10−16-1.1\times 10^{-16} is a rounding error, and should be 00.
Scaled vectors in the null space are also in the null space, so for example x=−1000x=-1000, y=0y=0, z=1000z=1000 is in it too. Try it:
(1112527107)(−100001000)=?\left(\begin{matrix} 1& 1& 1\\ 2& 5& 2\\ 7& 10&7 \end{matrix}\right) \left(\begin{matrix} -1000\\ 0 \\ 1000 \end{matrix}\right) = \quad ?
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).A = \left(\begin{matrix} 2& 1 \\ 1&2\end{matrix}\right).
Below, v\mathbf{v} (blue) is a vector of length 1 at an angle of π/8\pi/8 radians to the xx axis, and AvA\mathbf{v} (orange) points in a different direction from it (the dotted line extends v\mathbf{v}):
The vector v at an angle of pi/8 and Av, which points in a different direction
As v\mathbf{v} turns, AvA\mathbf{v} mostly points a different way. But along two special directions, AvA\mathbf{v} is just a multiple of v\mathbf{v}. At an angle of π/4\pi/4, v=(1,1)T/2\mathbf{v} = (1, 1)^T/\sqrt{2}, and Av=3vA\mathbf{v} = 3\mathbf{v}:
The vector v at an angle of pi/4, and Av = 3v along the same line
At an angle of 3π/43\pi/4, v=(−1,1)T/2\mathbf{v} = (-1, 1)^T/\sqrt{2}, and Av=vA\mathbf{v} = \mathbf{v}. These two directions are the eigenvectors of AA, and the multiples, 33 and 11, 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=(20012)B=\left(\begin{matrix} 2& 0 \\ 0&\frac{1}{2}\end{matrix}\right)
doubles in xx, but halves in yy. Its eigenvectors are along the axes, (1,0)T(1, 0)^T and (0,1)T(0, 1)^T, with eigenvalues 22 and 12\frac{1}{2}, and repeated applications of BB move points towards (±∞,0)(\pm\infty, 0).
R=(cos⁡π4−sin⁡π4sin⁡π4cos⁡π4)R=\left(\begin{matrix} \cos \frac{\pi}{4}&-\sin \frac{\pi}{4}\\ \sin \frac{\pi}{4}&\cos \frac{\pi}{4}\end{matrix}\right)
rotates every vector by π/4\pi/4 radians, and leaves its length unchanged. It leaves no direction unchanged, so it has no real eigenvectors: its eigenvalues are complex numbers, 12(1±i)\frac{1}{\sqrt 2}(1 \pm 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 AA is a square matrix, v\mathbf{v} is a non-zero vector, λ\lambda is a scalar, and
Av=λvA \mathbf{v} = \lambda \mathbf{v}
then v\mathbf{v} is called an eigenvector and λ\lambda is the corresponding eigenvalue.
If v\mathbf{v} is an eigenvector, then so is any scaling ava\mathbf{v} (with a≠0a \neq 0):
A(av)=aAv=aλv=λ(av).A (a \mathbf{v}) = a A\mathbf{v} = a\lambda\mathbf{v} = \lambda (a \mathbf{v}).
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=vI\mathbf{v} = \mathbf{v}:
Av=λv,Av−λIv=0,(A−λI)v=0.\begin{aligned} A \mathbf{v} &= \lambda \mathbf{v},\\ A \mathbf{v} - \lambda I \mathbf{v} &= \mathbf{0},\\ (A - \lambda I) \mathbf{v} &= \mathbf{0}. \end{aligned}
If A−λIA - \lambda I had an inverse, we could multiply both sides by it to get v=(A−λI)−10=0\mathbf{v} = (A - \lambda I)^{-1}\mathbf{0} = \mathbf{0}. But an eigenvector is non-zero, so A−λIA - \lambda I must be singular, and its determinant must be zero:
∣A−λI∣=0.|A-\lambda I|=0.
This equation gives the eigenvalues. In the picture from lecture 12, it says that A−λIA - \lambda I squashes the plane flat, sending a whole direction of non-zero vectors to 0\mathbf{0}: that direction is the eigenvector.

Example

What are the eigenvalues of this matrix?
A=(−2−21−5)A=\left(\begin{matrix}-2&-2\\ 1&-5\end{matrix}\right) ∣A−λI∣=∣−2−λ−21−5−λ∣=(−2−λ)(−5−λ)−(−2)=10+5λ+2λ+λ2+2=λ2+7λ+12=(λ+3)(λ+4)=0\begin{aligned} |A-\lambda I| &=\left\vert\begin{matrix}-2-\lambda&-2\\ 1&-5-\lambda\end{matrix}\right\vert=(-2-\lambda)(-5-\lambda)-(-2) \\ &=10+5\lambda+2\lambda+\lambda^2+2 \\ &=\lambda^2+7\lambda+12=(\lambda+3)(\lambda+4)=0 \end{aligned}
So the eigenvalues are λ1=−3\lambda_1=-3 and λ2=−4\lambda_2=-4.

Eigenvalues using Python

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}\left\{ -4 : 1, \ -3 : 1\right\}

Finding eigenvectors

For each eigenvalue, the corresponding eigenvector comes from substituting into Av=λvA \mathbf{v} = \lambda \mathbf{v}.

Example

What are the eigenvectors of
A=(−2−21−5)?A=\left(\begin{matrix}-2&-2\\ 1&-5\end{matrix}\right)?
The eigenvalues are λ1=−3\lambda_1=-3 and λ2=−4\lambda_2=-4, and we write v=(x,y)T\mathbf{v} = (x, y)^T. For λ1=−3\lambda_1=-3:
(−2−21−5)(xy)=(−3x−3y).\left(\begin{matrix}-2&-2\\ 1&-5\end{matrix}\right) \left(\begin{matrix}x\\ y\end{matrix}\right) = \left(\begin{matrix}-3x\\ -3y\end{matrix}\right).
The top row says −2x−2y=−3x-2x - 2y = -3x, so x=2yx = 2y. The bottom row says x−5y=−3yx - 5y = -3y, which also gives x=2yx = 2y: because A−λIA - \lambda I is singular, the two rows always agree. So any vector with x=2yx = 2y is an eigenvector:
v1=(21),(10.5),(−4.4−2.2),(2αα)…\mathbf{v}_1 = \left(\begin{matrix}2 \\ 1\end{matrix}\right), \left(\begin{matrix}1 \\ 0.5\end{matrix}\right), \left(\begin{matrix}-4.4 \\ -2.2\end{matrix}\right), \left(\begin{matrix}2\alpha \\ \alpha\end{matrix}\right)\ldots
For λ2=−4\lambda_2=-4, the top row says −2x−2y=−4x-2x - 2y = -4x, so x=yx = y, and
v2=(11)\mathbf{v}_2 = \left(\begin{matrix}1 \\ 1\end{matrix}\right)
or any multiple of it.

Normalised vectors

The length (or magnitude) of a vector v=(x,y,z)T\mathbf{v} = (x, y, z)^T is
∥v∥=x2+y2+z2,\lVert\mathbf{v}\rVert = \sqrt{x^2+y^2+z^2},
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∥=1x2+y2+z2(xyz).\frac{\mathbf{v}}{\lVert\mathbf{v}\rVert} = \frac{1}{\sqrt{x^2+y^2+z^2}}\left(\begin{matrix}x\\ y\\ z\end{matrix}\right).
For example, v1=(2,1)T\mathbf{v}_1 = (2, 1)^T has length 22+12=5\sqrt{2^2 + 1^2} = \sqrt{5}, so normalised it is (2,1)T/5=(0.894,0.447)T(2, 1)^T/\sqrt{5} = (0.894, 0.447)^T.

Eigenvectors in Python

NumPy gives the eigenvectors as the columns of a matrix, normalised:
eigenvectors
array([[0.89442719+0.j, 0.70710678+0.j], [0.4472136 +0.j, 0.70710678+0.j]])
These are (2,1)T/5(2, 1)^T/\sqrt{5} and (1,1)T/2(1, 1)^T/\sqrt{2}, in the same order as the eigenvalues −3-3 and −4-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]])]\left[ \left( -4, \ 1, \ \left[ \left[\begin{matrix}1\\1\end{matrix}\right]\right]\right), \ \left( -3, \ 1, \ \left[ \left[\begin{matrix}2\\1\end{matrix}\right]\right]\right)\right]

Diagonalising matrices

Suppose an n×nn\times n matrix AA has nn linearly independent eigenvectors v1,…,vn\mathbf{v}_1, \ldots, \mathbf{v}_n, with eigenvalues λ1,…,λn\lambda_1, \ldots, \lambda_n. Put the eigenvectors in the columns of a matrix PP, and the eigenvalues on the diagonal of a diagonal matrix DD:
P=(v1⋯vn),D=(λ10⋱0λn).P = \left(\begin{matrix}\mathbf{v}_1 & \cdots & \mathbf{v}_n\end{matrix}\right), \qquad D = \left(\begin{matrix}\lambda_1 & & 0\\ & \ddots & \\ 0 & & \lambda_n\end{matrix}\right).
Then AP=PDAP = PD, because column ii of each side is Avi=λiviA\mathbf{v}_i = \lambda_i\mathbf{v}_i. The eigenvectors are independent, so PP has an inverse, and
A=PDP−1.A = P D P^{-1}.
This separates how much effect the matrix has (the λi\lambda_i) from the directions it acts in (the vi\mathbf{v}_i).

Example

For our example, with v1=(2,1)T\mathbf{v}_1 = (2, 1)^T and v2=(1,1)T\mathbf{v}_2 = (1, 1)^T,
P=(2111),D=(−300−4),P−1=(1−1−12),P = \left(\begin{matrix}2&1\\ 1&1\end{matrix}\right), \qquad D = \left(\begin{matrix}-3&0\\ 0&-4\end{matrix}\right), \qquad P^{-1} = \left(\begin{matrix}1&-1\\ -1&2\end{matrix}\right),
using the formula for the inverse of a 2x2 matrix (∣P∣=1|P| = 1). Multiplying out:
PDP−1=(−6−4−3−4)(1−1−12)=(−2−21−5)=A.\begin{aligned} PDP^{-1} &= \left(\begin{matrix}-6&-4\\ -3&-4\end{matrix}\right)\left(\begin{matrix}1&-1\\ -1&2\end{matrix}\right) \\ &= \left(\begin{matrix}-2&-2\\ 1&-5\end{matrix}\right) = A. \end{aligned}
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 PP has normalised columns, so it is not the same as ours, but any (non-zero) scaling of the eigenvectors works.

Why diagonalise?

Powers of AA become easy, because each P−1PP^{-1}P in the middle cancels:
Ak=(PDP−1)(PDP−1)⋯(PDP−1)=PDkP−1,A^k = (PDP^{-1})(PDP^{-1})\cdots(PDP^{-1}) = PD^kP^{-1},
and the power of a diagonal matrix is just the powers of its diagonal elements:
Dk=(λ1k00λ2k).D^k = \left(\begin{matrix}\lambda_1^k&0\\ 0&\lambda_2^k\end{matrix}\right).
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,
(1101)\left(\begin{matrix}1&1\\ 0&1\end{matrix}\right)
has the repeated eigenvalue 11, but only one eigenvector direction, (1,0)T(1, 0)^T, so there are not enough eigenvectors to make PP. Whether a matrix can be diagonalised has nothing to do with whether it is singular: this matrix has determinant 11, while a singular matrix such as (1000)\left(\begin{smallmatrix}1&0\\0&0\end{smallmatrix}\right) 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.\mathbf{x}_1\cdot\mathbf{x}_2=\left(\begin{matrix}2\\ -1\\ 3\end{matrix}\right)\cdot\left(\begin{matrix}2\\ 7\\ 1\end{matrix}\right)=2\times 2+(-1\times 7)+(3\times1)=4-7+3=0.
If the dot product of two vectors is zero, they are perpendicular, or orthogonal. So here x1\mathbf{x}_1 and x2\mathbf{x}_2 are orthogonal.
The dot product of a vector with itself is its length squared: v⋅v=∥v∥2\mathbf{v}\cdot\mathbf{v} = \lVert\mathbf{v}\rVert^2. In matrix form, the dot product of two column vectors is x1⋅x2=x1Tx2\mathbf{x}_1\cdot\mathbf{x}_2 = \mathbf{x}_1^T\mathbf{x}_2.

Symmetric matrices have orthogonal eigenvectors

A matrix is symmetric if it is equal to its transpose, AT=AA^T = A. Symmetric matrices have real eigenvalues, and their eigenvectors (for different eigenvalues) are orthogonal. For example,
A=(1920−1620134−16431)A=\left(\begin{matrix}19&20&-16\\ 20&13&4 \\ -16&4&31\end{matrix}\right)
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 = I print(np.round(P.T @ P, 12))
[-9. 27. 45.] [[ 0.66666667 -0.33333333 0.66666667] [-0.66666667 -0.66666667 0.33333333] [ 0.33333333 -0.66666667 -0.66666667]] [[1. 0. 0.] [0. 1. 0.] [0. 0. 1.]]
Element (i,j)(i, j) of PTPP^TP is the dot product of eigenvectors ii and jj. 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−1610^{-16}.

Orthogonal matrices

A matrix is orthogonal if its columns are normalised, orthogonal vectors. As we have just seen, if MM is orthogonal then MTM=IM^TM=I, so
M−1=MT.M^{-1} = M^T.
For a symmetric matrix, we can choose normalised eigenvectors, so PP is orthogonal, and the diagonalising equation is simplified:
A=PDP−1=PDPT.A = PDP^{-1} = PDP^T.

Summary

  1. A singular matrix has rank less than its size: some of its equations are combinations of others, and Ax=bA\mathbf{x} = \mathbf{b} has many solutions or none.
  2. The null space of AA is the set of solutions of Au=0A\mathbf{u} = \mathbf{0}.
  3. An eigenvector of AA is a non-zero vector with Av=λvA\mathbf{v} = \lambda\mathbf{v}: find the eigenvalues from ∣A−λI∣=0|A - \lambda I| = 0, then each eigenvector by substitution.
  4. A matrix with a full set of independent eigenvectors can be diagonalised, A=PDP−1A = PDP^{-1}; we will use this for systems of differential equations.
  5. Symmetric matrices have orthogonal eigenvectors, and A=PDPTA = PDP^T.
  6. 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.

Introductory problems 1

Given
A=(100i);B=(0ii0);C=(1212(1−i)12(1+i)−12);A = \left(\begin{array}{cc} 1 & 0 \\ 0 & i \end{array}\right); \qquad B = \left(\begin{array}{cc} 0 & i \\ i & 0 \end{array}\right); \qquad C = \left(\begin{array}{cc} \frac{1}{\sqrt{2}} & \frac{1}{2}\left(1-i\right) \\\frac{1}{2}\left(1+i\right) & -\frac{1}{\sqrt{2}} \end{array}\right);
verify by hand, and using the numpy.linalg module, that
  1. AA−1=A−1A=IAA^{-1}=A^{-1}A =I;
  2. BB−1=B−1B=IBB^{-1}=B^{-1}B =I;
  3. CC−1=C−1C=ICC^{-1}=C^{-1}C =I;
# hint import numpy as np # In Python the imaginary unit is "1j" A = np.array([[1, 0], [0, 1j]]) print(A @ np.linalg.inv(A))

Introductory problems 2

Let A be an n×nn \times n invertible matrix. Let II be the n×nn\times n identity matrix and let BB be an n×nn\times n matrix.
Suppose that ABA−1=IABA^{-1}=I. Determine the matrix BB in terms of the matrix AA.

Main problems

Main problems 1

Let AA be the coefficient matrix of the system of linear equations
−x1−2x2=1,2x1+3x2=−1.\begin{aligned} -x_1 - 2 x_2 &= 1,\\ 2 x_1 + 3 x_2 &= -1. \end{aligned}
  1. Solve the system by finding the inverse matrix A−1A^{-1}.
  2. Let x=(x1,x2)T\mathbf{x} = (x_1, x_2)^T be the solution of the system obtained in part 1. Calculate and simplify A2017xA^{2017} \mathbf{x}.

Main problems 2

For each of the following matrices
A=(2314);B=(4268);C=(1411);D=(x00y),\begin{gathered} A = \left(\begin{array}{cc} 2 & 3 \\ 1 & 4 \end{array}\right); \qquad B = \left(\begin{array}{cc} 4 & 2 \\ 6 & 8 \end{array}\right); \\ C = \left(\begin{array}{cc} 1 & 4 \\ 1 & 1 \end{array}\right); \qquad D = \left(\begin{array}{cc} x & 0 \\ 0 & y \end{array}\right), \end{gathered}
compute the determinant, eigenvalues and eigenvectors by hand.
Check your results by verifying that Qx=λixQ\mathbf{x} = \lambda_i \mathbf{x}, where Q=AQ=A, BB, CC or DD, and by using the numpy.linalg module.
# hint import numpy as np A = np.array([[2, 3], [1, 4]]) e_vals, e_vecs = np.linalg.eig(A) print(e_vals) print(e_vecs)

Main problems 3

Orthogonal vectors.
Two vectors x1\mathbf{x_1} and x2\mathbf{x_2} are said to be perpendicular or orthogonal if their dot/scalar product is zero:
x1.x2=(2−13).(271)=(2×2)+(−1×7)+(3×1)=4−7+3=0,\mathbf{x_1}.\mathbf{x_2}=\left(\begin{array}{c} 2 \\ -1 \\ 3 \end{array} \right).\left(\begin{array}{c} 2 \\ 7 \\ 1 \end{array} \right)=(2{\times}2)+(-1{\times}7)+(3{\times}1)=4-7+3=0,
thus x1\mathbf{x_1} and x2\mathbf{x_2} are orthogonal.
Find vectors that are orthogonal to
(12)and(12−1).\left(\begin{array}{c} 1 \\ 2 \end{array} \right) \quad\text{and}\quad \left(\begin{array}{c} 1 \\ 2 \\ -1 \end{array} \right).
How many such vectors are there?

Main problems 4

Diagonalise the 2×22 \times 2 matrix
A=(2−1−12)A=\left(\begin{array}{cc} 2 & -1 \\ -1 & 2 \end{array} \right)
by finding a non-singular matrix SS and a diagonal matrix DD such that A=SDS−1A = SDS^{-1}.

Main problems 5

Find a 2×22{\times}2 matrix AA such that
A(21)=(−14)andA(53)=(02).A\left(\begin{array}{c} 2 \\ 1 \end{array} \right) = \left(\begin{array}{c} -1 \\ 4 \end{array} \right)\quad\text{and}\quad A \left(\begin{array}{c} 5 \\ 3\end{array} \right)=\left(\begin{array}{c} 0 \\ 2\end{array} \right).

Main problems 6

Consider the matrices
A=(2412);B=(1234);C=(123246111).A = \left(\begin{array}{cc} 2 & 4 \\ 1 & 2 \end{array}\right); \qquad B = \left(\begin{array}{cc} 1 & 2 \\ 3 & 4 \end{array}\right); \qquad C = \left(\begin{array}{ccc} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 1 & 1 & 1 \end{array}\right).
  1. Calculate the determinant of AA and of BB. Which of AA, BB and CC are singular?
  2. Find the rank of each matrix.
  3. For each singular matrix, find a non-zero vector u\mathbf{u} in its null space, so that Au=0A\mathbf{u} = \mathbf{0} or Cu=0C\mathbf{u} = \mathbf{0}.
  4. Without solving them, say whether each of these systems has many solutions or no solutions, and explain why: 2x+4y=6,x+2y=3;2x+4y=6,x+2y=1.\begin{aligned} 2x + 4y &= 6,\\ x + 2y &= 3; \end{aligned} \qquad\qquad \begin{aligned} 2x + 4y &= 6,\\ x + 2y &= 1. \end{aligned}
  5. Check your answers to parts 2. and 3. using numpy.linalg.matrix_rank and scipy.linalg.null_space.

Extension problems

Extension problems 1

If there exists a matrix MM whose columns are those of normalised (unit length) and orthogonal vectors, prove that MTM=IM^TM=I which implies that MT=M−1M^T=M^{-1}.