In Matrices as transformations, a matrix is a function that moves vectors around — it stretches, rotates, mixes the axes. Today we hunt for the special directions a matrix leaves alone.
Most vectors get rotated by a matrix. A few special ones only get scaled — those are eigenvectors.
The amount of scaling is the eigenvalue\lambda, and the whole idea is one equation: A\mathbf{v} = \lambda\mathbf{v}.
How to find them by hand for a 2\times2: the characteristic equation\det(A - \lambda I) = 0 gives the eigenvalues, and you check each answer by multiplying. Shortcuts: diagonal or triangular matrices, the symmetric pattern, and geometry. Bigger matrices: eigen() in R.
Why symmetric matrices (like a covariance matrix) are special: real eigenvalues, orthogonal eigenvectors.
Biology: the eigenvectors of a covariance matrix point along the main axes of variation in a dataset — the seed of PCA (later this week).
This is a concept day. Practise on paper with 2\times2 matrices: find the eigenvalues, find the eigenvectors, check by multiplying.
Problem: where do the tilted axes of a cell cloud come from?
Measure two genes across many cells and plot each cell as a point (gene 1 on x, gene 2 on y).
The two genes are co-regulated, so the cloud is a tilted, elongated ellipse.
There is one direction along which the cells spread the most — the long axis of the cloud.
And a perpendicular direction with the least spread — the short axis.
These two axes are not the x- and y-axes. They are tilted. Where do they come from?
They are the eigenvectors of the data’s covariance matrix. Today we learn what that sentence means.
A matrix turns most vectors but only stretches a few
Take a matrix A and feed it different input vectors. Watch the direction of the output.
A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}
A\begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}2\\1\end{pmatrix} — pointed along x, came out tilted up. Direction changed.
A\begin{pmatrix}0\\1\end{pmatrix} = \begin{pmatrix}1\\2\end{pmatrix} — pointed along y, came out tilted. Direction changed.
A\begin{pmatrix}1\\1\end{pmatrix} = \begin{pmatrix}3\\3\end{pmatrix} — pointed along the diagonal, came out on the same line, just longer!
That last one is special: A only scaled it (by 3), without rotating it.
An eigenvector is only stretched, never turned
A nonzero vector \mathbf{v} is an eigenvector of A if A only scales it:
A\mathbf{v} = \lambda\mathbf{v}
\lambda (a scalar) is the eigenvalue — the stretch factor for that direction.
“Eigen” is German for own / characteristic: these are the matrix’s own special directions.
Reading the equation: transforming \mathbf{v} with A gives the same thing as just multiplying \mathbf{v} by the number \lambda. The matrix acts like a plain number on that direction.
From the previous slide: A\begin{pmatrix}1\\1\end{pmatrix} = \begin{pmatrix}3\\3\end{pmatrix} = 3\begin{pmatrix}1\\1\end{pmatrix}, so \mathbf{v}=(1,1) is an eigenvector with eigenvalue \lambda = 3.
Any multiple of an eigenvector is also an eigenvector
If \mathbf{v} is an eigenvector, so is 2\mathbf{v}, -\mathbf{v}, 0.5\mathbf{v} — any nonzero multiple:
An eigenvector defines a direction (a line through the origin), not one specific arrow.
So we are free to pick a convenient representative — usually the simplest integers, or a unit vector (length 1).
R will hand you the unit vector by default; on paper we keep nice whole numbers like (1,1).
Test a candidate: just multiply
To check whether a given \mathbf v is an eigenvector, compute A\mathbf v and ask: is the output a multiple of the input?
With A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}:
\mathbf v = \begin{pmatrix}1\\-1\end{pmatrix}: \ A\mathbf v = \begin{pmatrix}2-1\\1-2\end{pmatrix} = \begin{pmatrix}1\\-1\end{pmatrix} = 1\cdot\mathbf v. Yes, eigenvector with \lambda = 1.
\mathbf v = \begin{pmatrix}1\\2\end{pmatrix}: \ A\mathbf v = \begin{pmatrix}2+2\\1+4\end{pmatrix} = \begin{pmatrix}4\\5\end{pmatrix}. Is \begin{pmatrix}4\\5\end{pmatrix} = \lambda\begin{pmatrix}1\\2\end{pmatrix}? It would need \lambda = 4and\lambda = 2.5. No.
The eigenvalue is read off by comparing entries: divide each entry of A\mathbf v by the matching entry of \mathbf v. Both ratios must agree, and they equal \lambda.
Where eigenvalues come from: \det(A - \lambda I) = 0
Where do eigenvalues come from in general? From (A - \lambda I)\mathbf{v} = \mathbf{0}: we need a nonzero\mathbf{v} that A-\lambda I sends to zero. A matrix can only crush a nonzero vector to zero if it is singular (no inverse), and that is exactly when its determinant is zero (week 1):
\boxed{\ \det(A - \lambda I) = 0\ }
For a 2\times2, \det\begin{pmatrix} a & b \\ c & d \end{pmatrix} = ad - bc, so
\det(A - \lambda I) = (a-\lambda)(d-\lambda) - bc = 0,
a quadratic in \lambda.
The characteristic equation: a worked example
A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}
1. Subtract \lambda from the diagonal:\quad A - \lambda I = \begin{pmatrix} 2-\lambda & 1 \\ 1 & 2-\lambda \end{pmatrix}
2. Determinant ad - bc, set to zero:\quad (2-\lambda)(2-\lambda) - 1\cdot 1 = 0
3. Move the 1 to the right-hand side:\quad (2-\lambda)^2 = 1
4. Which numbers square to 1? Both 1 and -1, so there are two cases:
Triangular matrix (zeros below or above the diagonal): bc = 0, so the equation is (a-\lambda)(d-\lambda) = 0. A product is zero only when one of the factors is zero: a - \lambda = 0 or d - \lambda = 0, so \lambda = a or \lambda = d, the diagonal entries.
One eigenvector comes for free: A\begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}3\\0\end{pmatrix} = 3\begin{pmatrix}1\\0\end{pmatrix}.
The other is found on the next slide.
Finding the eigenvector for a known \lambda
Once you know \lambda, the eigenvector is a small linear system. Start from A\mathbf{v} = \lambda\mathbf{v} and move everything to one side (write \lambda\mathbf{v} = \lambda I\mathbf{v} so the shapes match):
(A - \lambda I)\mathbf{v} = \mathbf{0}, \qquad A - \lambda I = \text{$A$ with $\lambda$ subtracted from each diagonal entry.}
For A = \begin{pmatrix} 3 & 1 \\ 0 & 2 \end{pmatrix} and \lambda = 2:
For a symmetric matrix with equal diagonal entries, the eigenvectors are always the two diagonals of the plane:
A = \begin{pmatrix} a & b \\ b & a \end{pmatrix}: \qquad A\begin{pmatrix}1\\1\end{pmatrix} = (a+b)\begin{pmatrix}1\\1\end{pmatrix}, \qquad A\begin{pmatrix}1\\-1\end{pmatrix} = (a-b)\begin{pmatrix}1\\-1\end{pmatrix}
For our A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}:
\lambda_1 = 2 + 1 = 3 for (1,1) and
\lambda_2 = 2 - 1 = 1 for (1,-1).
Notice: \mathbf{v}_1\cdot\mathbf{v}_2 = (1)(1) + (1)(-1) = 0 … the two eigenvectors are orthogonal! (will be important later)
What a matrix does reveals its eigenvectors
Think about what the matrix does; the directions it leaves on their own line are the eigenvectors.
(1,1): \lambda = 1 (on the mirror); \ (1,-1): \lambda = -1 (flipped)
\begin{pmatrix} 1 & 0.5 \\ 0 & 1 \end{pmatrix}
shear
(1,0): \lambda = 1; no other direction
\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}
rotates 90^\circ
none: every direction is turned
Check your answer: the eigenvalues always add up to the trace (sum of the diagonal). For \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}: 3 + 1 = 4 = 2 + 2. ✓
Bigger than 2\times2: let R do it with eigen() (Eigenvalues in R).
Try it: hunt for eigen-directions
Symmetric matrices have perpendicular eigenvectors
A matrix is symmetric if A = A^\top (it equals its own transpose — mirror across the diagonal). Our example \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix} is symmetric (b = c = 1).
For symmetric matrices (a theorem — the spectral theorem):
All eigenvalues are real (no awkward complex numbers).
Eigenvectors for different eigenvalues are orthogonal (perpendicular).
This is exactly what we just saw: real eigenvalues 3, 1 and perpendicular eigenvectors (1,1) and (1,-1) (dot product 1\cdot1 + 1\cdot(-1) = 0).
This is not very important for this course; but there are plenty deep theories about linear algebra if you wish to learn this topic properly.
Covariance eigenvectors are the data’s main axes
For a dataset (e.g. expression of 2 genes, x and y, across many cells), the covariance matrixC summarises spread:
C is symmetric (cov(x,y)= cov(y,x)), so by the spectral theorem:
its eigenvectors are orthogonal → they form clean perpendicular axes,
its eigenvalues are real and positive → the amount of variance along each axis.
The eigenvector with the largest eigenvalue points along the long axis of the data cloud — the direction of greatest variation. That is PCA (taught later this week). Today you built its engine.
Special cases & gotchas
Repeated eigenvalue:\begin{pmatrix} 2 & 0 \\ 0 & 2 \end{pmatrix} has \lambda = 2 twice. Every direction is an eigenvector (it scales everything equally).
Diagonal matrix: eigenvalues are just the diagonal entries; eigenvectors are the axes.
Complex eigenvalues: a pure rotation \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} has no real eigenvector — it rotates everything, leaving no direction fixed. (This can’t happen for symmetric matrices.)
Scale freedom: eigenvectors are only defined up to length and sign.