Exercise: eigenvalues & eigenvectors
Goal
By the end of this exercise you should be able to:
- explain what makes an eigenvector special (\(A\) only scales it, never rotates it),
- write and read the eigen relation \(A\mathbf{v} = \lambda\mathbf{v}\),
- find the eigenvalues of a \(2\times2\) matrix from the characteristic equation \(\det(A-\lambda I) = 0\),
- test whether a given vector is an eigenvector by multiplying, and read off its eigenvalue,
- read the eigenvalues of diagonal and triangular matrices, and use the symmetric \(2\times2\) pattern,
- find the eigenvector for a known eigenvalue from \((A-\lambda I)\mathbf{v}=\mathbf{0}\), and verify it,
- find eigenvectors from the geometry of a transformation (projection, mirror, shear, rotation),
- use the trace check to catch arithmetic slips,
- explain why a symmetric matrix (such as a covariance matrix) has real eigenvalues and orthogonal eigenvectors.
This is a concept day built on by-hand skills. Spend most of your time on the pen-and-paper problems; the R section is only to confirm your hand answers (full R fluency comes in Eigenvalues in R).
Background
A nonzero vector \(\mathbf{v}\) is an eigenvector of \(A\) with eigenvalue \(\lambda\) when
\[A\mathbf{v} = \lambda\mathbf{v}.\]
The matrix acts on that one direction like a plain number \(\lambda\): it stretches (\(|\lambda|>1\)), shrinks (\(|\lambda|<1\)), or flips (\(\lambda<0\)) the vector, but never knocks it off its line.
The by-hand toolbox:
- The characteristic equation. Subtract \(\lambda\) from the diagonal entries and set the \(2\times2\) determinant to zero: \(\det(A-\lambda I) = (a-\lambda)(d-\lambda) - bc = 0\). Solve the quadratic (factor it, or use the quadratic formula). This works for any \(2\times2\).
- Test a candidate. Compute \(A\mathbf{v}\). If it equals \(\lambda\mathbf{v}\) for one number \(\lambda\) (the same ratio in every entry), \(\mathbf{v}\) is an eigenvector with eigenvalue \(\lambda\).
- Diagonal and triangular matrices. The eigenvalues are the diagonal entries. For a diagonal matrix the axes are the eigenvectors.
- The symmetric pattern. \(\begin{pmatrix} a & b \\ b & a \end{pmatrix}\) has eigenvectors \((1,1)\) with \(\lambda = a+b\) and \((1,-1)\) with \(\lambda = a-b\).
- Eigenvector for a known \(\lambda\). Subtract \(\lambda\) from each diagonal entry to get \(A-\lambda I\), then solve \((A-\lambda I)\mathbf{v}=\mathbf{0}\): with \(\mathbf v = (x, y)\), one row gives the relation between \(x\) and \(y\); pick the simplest integers.
- Geometry. Directions that a transformation leaves on their own line are eigenvectors (a projection keeps its line, a mirror keeps its mirror line, a rotation keeps nothing).
- Check. Always verify \(A\mathbf{v}=\lambda\mathbf{v}\) by multiplying. The eigenvalues add up to the trace (sum of the diagonal) and multiply to \(\det A\).
For matrices bigger than \(2\times2\), use eigen() in R (Eigenvalues in R).
Symmetric matrices (\(A = A^\top\), e.g. any covariance matrix) always have real eigenvalues and orthogonal eigenvectors.
By hand
B1. For \(A = \begin{pmatrix} 4 & 0 \\ 0 & 2 \end{pmatrix}\), find the eigenvalues by inspection (it is diagonal). What are the eigenvectors? What does \(A\) do geometrically?
B2. For the triangular matrix \(A = \begin{pmatrix} 3 & 1 \\ 0 & 2 \end{pmatrix}\): (a) read off the eigenvalues; (b) show that \((1,0)\) is an eigenvector, and for which eigenvalue; (c) find the eigenvector for the other eigenvalue from \((A-\lambda I)\mathbf{v}=\mathbf{0}\), and verify it; (d) check the trace.
B3. For the symmetric matrix \(A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}\): (a) find the eigenvalues and eigenvectors with the symmetric pattern; (b) verify both by multiplying; (c) verify the two eigenvectors are orthogonal (dot product 0); (d) check the trace.
B4. Find the eigenvalues and eigenvectors of \(A = \begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix}\) and of \(A = \begin{pmatrix} 5 & -2 \\ -2 & 5 \end{pmatrix}\). Which eigenvalue is the largest in each case?
B5. Show that \(\mathbf{v} = \begin{pmatrix} 1 \\ 2 \end{pmatrix}\) is an eigenvector of \(A = \begin{pmatrix} 0 & 1 \\ -2 & 3 \end{pmatrix}\) by computing \(A\mathbf{v}\) and reading off \(\lambda\). Then test \(\mathbf{w} = (1, 1)\) and \(\mathbf{u} = (1, 0)\). Use the trace to check that you have found both eigenvalues.
B6. The rotation matrix \(A = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}\) (rotate \(90^\circ\)). Compute \(A\begin{pmatrix}1\\0\end{pmatrix}\), \(A\begin{pmatrix}0\\1\end{pmatrix}\) and \(A\begin{pmatrix}1\\1\end{pmatrix}\). Explain, from what the matrix does geometrically, why it has no real eigenvector.
B7. (covariance flavour) A small dataset has covariance matrix \(C = \begin{pmatrix} 5 & 4 \\ 4 & 5 \end{pmatrix}\). Find its eigenvalues and eigenvectors by hand. Which eigenvector points along the direction of greatest variation, and what is the variance along it?
B8. (geometry first) For each matrix, say what it does, predict the eigenvectors and eigenvalues without calculating, then verify by multiplying: (a) \(P = \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}\); (b) \(F = \begin{pmatrix} -1 & 0 \\ 0 & 1 \end{pmatrix}\); (c) \(S = \begin{pmatrix} 2 & 0 \\ 0 & 2 \end{pmatrix}\); (d) \(H = \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix}\) (is \((1,1)\) an eigenvector?).
B9. (the characteristic equation) \(\det(A-\lambda I) = (a-\lambda)(d-\lambda) - bc = 0\) finds the eigenvalues of any \(2\times2\). (a) Use it on \(A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}\) and compare with B3. Check that the product of the eigenvalues is \(\det A\). (b) Use it on \(A = \begin{pmatrix} 0 & 1 \\ -2 & 3 \end{pmatrix}\) from B5. This time nobody hands you a candidate: find both eigenvalues, then the eigenvector for each from \((A-\lambda I)\mathbf{v} = \mathbf{0}\), and check by multiplying. (c) Use it on \(A = \begin{pmatrix} 2 & 1 \\ 1 & 0 \end{pmatrix}\), which fits none of the patterns; the quadratic needs the quadratic formula. (d) Use it on the rotation from B6, and connect “no real root” to the geometry.
Explore
Turn the unit vector \(\mathbf{v}\) (black handle, or the “direction of v” slider) and watch \(A\mathbf{v}\) (orange). When \(A\mathbf{v}\) lands on the dotted line through \(\mathbf{v}\), it turns green and the demo shows \(\lambda\). “Sweep v around” turns \(\mathbf{v}\) once round and marks every direction it finds. Set \(A\) with the sliders or the presets.
E1. With the Symmetric preset (the matrix of B3), find both eigen-directions by turning \(\mathbf{v}\). Do the directions and \(\lambda\) values match your answer to B3? (The demo uses unit vectors: \((0.71, 0.71)\) is the same direction as \((1, 1)\).)
E2. Use the sliders to set the matrix of B5, \(\begin{pmatrix} 0 & 1 \\ -2 & 3 \end{pmatrix}\), and sweep. Which directions does it find, and do they match \((1, 2)\) and \((1, 1)\)?
E3. Set the first matrix of B4, \(\begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix}\). Find the direction with a negative \(\lambda\). What does \(A\mathbf{v}\) look like there?
E4. Before sweeping, predict how many eigen-directions each preset has: Shear, Rotate 90°, Projection, Scale ×2. Then sweep and compare with B6 and B8.
E1. \(\lambda = 3\) along \((0.71, 0.71)\), the direction of \((1, 1)\); \(\lambda = 1\) along \((0.71, -0.71)\), the direction of \((1, -1)\). Same as B3: the unit vectors are just \((1,1)\) and \((1,-1)\) shrunk to length 1.
E2. \(\lambda = 2\) along \((0.45, 0.89)\) and \(\lambda = 1\) along \((0.71, 0.71)\). Since \(0.89 / 0.45 = 2\), the first is the direction of \((1, 2)\); the second is the direction of \((1, 1)\). Trace check: \(2 + 1 = 3 = 0 + 3\).
E3. Along \((0.71, -0.71)\), i.e. \((1, -1)\): \(A\mathbf{v}\) points the opposite way, still on the dotted line, so \(A\mathbf{v} = -1\cdot\mathbf{v}\) and \(\lambda = -1\). (The other direction is \((1, 1)\) with \(\lambda = 3\).)
E4. Shear: one direction, the x-axis, \(\lambda = 1\). Rotate 90°: none, every \(A\mathbf{v}\) is turned by \(90^\circ\) (B6). Projection: two, \((1, 0)\) with \(\lambda = 1\) and \((0, 1)\) with \(\lambda = 0\) (there \(A\mathbf{v}\) shrinks to nothing). Scale ×2: every direction, \(\lambda = 2\), so \(A\mathbf{v}\) is always on the line.
In R
Use R only to confirm the hand answers above. (In Eigenvalues in R we use eigen() in earnest; today we lean on simple checks.)
Verify an eigen relation directly
A <- matrix(c(2, 1,
1, 2), nrow = 2, byrow = TRUE)
v <- c(1, 1) # claimed eigenvector
A %*% v # 3 3 -> equals 3 * v, so lambda = 3
3 * v # 3 3 -> matches# B5: is (1,2) an eigenvector of this A?
A <- matrix(c(0, 1,
-2, 3), nrow = 2, byrow = TRUE)
v <- c(1, 2)
A %*% v # 2 4 = 2 * (1,2) -> yes, lambda = 2Check eigenvalues with the trace
A <- matrix(c(2, 1,
1, 2), nrow = 2, byrow = TRUE)
sum(diag(A)) # trace = 4 -> should equal lambda1 + lambda2
# your hand answers were 3 and 1: 3 + 1 = 4 -> checks outConfirm two eigenvectors are orthogonal
v1 <- c(1, 1) # for lambda = 3
v2 <- c(1, -1) # for lambda = 1
sum(v1 * v2) # 0 -> orthogonal (as expected for symmetric A)Tasks
R1. Verify both eigenpairs from B3 with A %*% v and the trace block (you should already know the eigenvalues are 3 and 1).
R2. For B7, build C <- matrix(c(5,4,4,5), 2, byrow = TRUE), then verify your hand eigenvalues with sum(diag(C)), and confirm both eigenvectors satisfy C %*% v == lambda * v.
R3. Take the rotation matrix from B6, A <- matrix(c(0,-1,1,0), 2, byrow = TRUE). Pick any nonzero vector and compute A %*% v for a few different v. Convince yourself no nonzero real vector comes back as a multiple of itself (every vector is rotated).
Hints
Compute \(A\mathbf v\). If the result is a scalar multiple of \(\mathbf v\) — i.e. \(A\mathbf v = \lambda\mathbf v\) for one single number \(\lambda\) — then \(\mathbf v\) is an eigenvector and that \(\lambda\) is its eigenvalue. Read \(\lambda\) off by dividing entry by entry; both ratios must agree. (If an entry of \(\mathbf v\) is 0, the matching entry of \(A\mathbf v\) must be 0 too.)
The eigenvalues are on the diagonal. For an upper-triangular \(\begin{pmatrix} a & b \\ 0 & d \end{pmatrix}\), the x-axis \((1,0)\) is always an eigenvector, with eigenvalue \(a\): \(A\begin{pmatrix}1\\0\end{pmatrix}\) is the first column, \(\begin{pmatrix}a\\0\end{pmatrix}\).
For \(\begin{pmatrix} a & b \\ b & a \end{pmatrix}\) (equal diagonal entries, equal off-diagonal entries), multiply by \((1,1)\) and by \((1,-1)\): you get \((a+b)(1,1)\) and \((a-b)(1,-1)\). Watch the signs when \(b\) is negative.
Subtract \(\lambda\) from only the diagonal entries; the off-diagonals are unchanged. Write out the two equations \((A-\lambda I)\mathbf{v}=\mathbf{0}\). They say the same thing (or one is \(0 = 0\)) — with \(\mathbf v = (x, y)\), use one row to get \(y\) in terms of \(x\), then pick \(x = 1\) (or whatever gives nice integers).
Sum of eigenvalues = trace (sum of diagonal) = sum(diag(A)). If your two eigenvalues do not add up to the trace, one of them is wrong. If you know one eigenvalue, the trace gives you the other.
A rotation has no direction it leaves on its own line: every output points in a new direction, so no output is a multiple of its input. Compare the direction of \(A\mathbf v\) with that of \(\mathbf v\) for each test vector.
Write \(A - \lambda I\) by subtracting \(\lambda\) from the two diagonal entries only. Its determinant is (top-left)(bottom-right) \(-\) (top-right)(bottom-left): \((a-\lambda)(d-\lambda) - bc\). Multiply out, set it to 0, and solve: try to factor it as \((\lambda - p)(\lambda - q)\) with \(p + q\) = trace and \(pq = \det A\). A product is zero only when one of the factors is zero, so \(\lambda - p = 0\) or \(\lambda - q = 0\), that is, \(\lambda = p\) or \(\lambda = q\). If no nice numbers work, use the quadratic formula.
Solutions
B1. A diagonal matrix acts like a number on each axis, so the eigenvalues are the diagonal entries: \(\lambda_1 = 4\) with \(\mathbf v_1 = (1,0)\) and \(\lambda_2 = 2\) with \(\mathbf v_2 = (0,1)\). Verify: \(A\begin{pmatrix}1\\0\end{pmatrix}=\begin{pmatrix}4\\0\end{pmatrix}=4\begin{pmatrix}1\\0\end{pmatrix}\) ✓ and \(A\begin{pmatrix}0\\1\end{pmatrix}=\begin{pmatrix}0\\2\end{pmatrix}=2\begin{pmatrix}0\\1\end{pmatrix}\) ✓. Trace \(4+2=6=\lambda_1+\lambda_2\) ✓. Geometrically \(A\) stretches the x-axis by 4 and the y-axis by 2.
B2. (a) Triangular, so the eigenvalues are the diagonal entries: \(\lambda = 3\) and \(\lambda = 2\). (b) \(A\begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}3\\0\end{pmatrix} = 3\begin{pmatrix}1\\0\end{pmatrix}\), so \((1,0)\) is an eigenvector with \(\lambda = 3\). (c) For \(\lambda=2\): \(A - 2I = \begin{pmatrix}1&1\\0&0\end{pmatrix}\). Row 1: \(x+y=0\), so \(y = -x\) and \(\mathbf v=(1,-1)\). Verify: \(A\begin{pmatrix}1\\-1\end{pmatrix} = \begin{pmatrix}3-1\\0-2\end{pmatrix} = \begin{pmatrix}2\\-2\end{pmatrix} = 2\begin{pmatrix}1\\-1\end{pmatrix}\) ✓. (d) Trace \(3+2=5=3+2\) ✓.
B3. (a) Pattern with \(a = 2\), \(b = 1\): \((1,1)\) with \(\lambda = a+b = 3\), and \((1,-1)\) with \(\lambda = a-b = 1\). (b) \(A\begin{pmatrix}1\\1\end{pmatrix} = \begin{pmatrix}2+1\\1+2\end{pmatrix} = \begin{pmatrix}3\\3\end{pmatrix} = 3\begin{pmatrix}1\\1\end{pmatrix}\) ✓; \(A\begin{pmatrix}1\\-1\end{pmatrix} = \begin{pmatrix}2-1\\1-2\end{pmatrix} = \begin{pmatrix}1\\-1\end{pmatrix} = 1\cdot\begin{pmatrix}1\\-1\end{pmatrix}\) ✓. (c) Orthogonality: \((1)(1) + (1)(-1) = 0\) → orthogonal ✓ (expected, since \(A\) is symmetric). (d) Trace \(= 2+2 = 4 = 3+1\) ✓.
B4. First matrix \(\begin{pmatrix}1&2\\2&1\end{pmatrix}\): pattern with \(a=1\), \(b=2\). \((1,1)\): \(\lambda = 3\); \((1,-1)\): \(\lambda = 1-2 = -1\). Verify: \(A\begin{pmatrix}1\\-1\end{pmatrix} = \begin{pmatrix}1-2\\2-1\end{pmatrix} = \begin{pmatrix}-1\\1\end{pmatrix} = -1\cdot\begin{pmatrix}1\\-1\end{pmatrix}\) ✓. Trace \(2 = 3 + (-1)\) ✓. Largest: \(3\), along \((1,1)\). The negative eigenvalue means \(A\) flips the \((1,-1)\) direction.
Second matrix \(\begin{pmatrix}5&-2\\-2&5\end{pmatrix}\): pattern with \(a=5\), \(b=-2\). \((1,1)\): \(\lambda = 5 + (-2) = 3\); \((1,-1)\): \(\lambda = 5 - (-2) = 7\). Verify: \(A\begin{pmatrix}1\\-1\end{pmatrix} = \begin{pmatrix}5+2\\-2-5\end{pmatrix} = \begin{pmatrix}7\\-7\end{pmatrix} = 7\begin{pmatrix}1\\-1\end{pmatrix}\) ✓. Trace \(10 = 3+7\) ✓. Largest: \(7\), along \((1,-1)\): with a negative off-diagonal, the long axis is the other diagonal.
B5. \[A\mathbf{v} = \begin{pmatrix}0&1\\-2&3\end{pmatrix}\begin{pmatrix}1\\2\end{pmatrix} = \begin{pmatrix}0+2\\ -2+6\end{pmatrix} = \begin{pmatrix}2\\4\end{pmatrix} = 2\begin{pmatrix}1\\2\end{pmatrix}.\] So \(\mathbf v=(1,2)\) is an eigenvector with \(\lambda = 2\). \(A\mathbf w = (0+1,\ -2+3) = (1, 1) = 1\cdot\mathbf w\): also an eigenvector, with \(\lambda = 1\). \(A\mathbf u = (0, -2)\), not a multiple of \((1,0)\) (the second entry would have to be 0): not an eigenvector. Trace \(0 + 3 = 3 = 2 + 1\) ✓, so \(2\) and \(1\) are both eigenvalues of this \(2\times2\) matrix.
B6. \(A\begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}0\\1\end{pmatrix}\), \(A\begin{pmatrix}0\\1\end{pmatrix} = \begin{pmatrix}-1\\0\end{pmatrix}\), \(A\begin{pmatrix}1\\1\end{pmatrix} = \begin{pmatrix}-1\\1\end{pmatrix}\). Each output is the input turned by \(90^\circ\); none lies on the input’s own line, so none is a multiple of its input. \(A\) rotates every direction by \(90^\circ\), so there is no special unrotated direction and hence no real eigenvector (and no real eigenvalue).
B7. Pattern with \(a = 5\), \(b = 4\): \((1,1)\) with \(\lambda = 9\) and \((1,-1)\) with \(\lambda = 1\). Verify: \(C\begin{pmatrix}1\\1\end{pmatrix} = \begin{pmatrix}9\\9\end{pmatrix} = 9\begin{pmatrix}1\\1\end{pmatrix}\) ✓; \(C\begin{pmatrix}1\\-1\end{pmatrix} = \begin{pmatrix}1\\-1\end{pmatrix}\) ✓. The direction of greatest variation is the eigenvector with the largest eigenvalue, \(\mathbf v_1=(1,1)\); the variance along that axis is \(9\). Checks: trace \(=5+5=10=9+1\) ✓; orthogonal: \((1)(1)+(1)(-1)=0\) ✓.
B8. (a) \(P\) projects onto the y-axis: it keeps \((0,1)\) (\(\lambda = 1\)) and squashes \((1,0)\) to zero (\(\lambda = 0\)). Verify: \(P\begin{pmatrix}0\\1\end{pmatrix} = \begin{pmatrix}0\\1\end{pmatrix}\), \(P\begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}0\\0\end{pmatrix} = 0\cdot\begin{pmatrix}1\\0\end{pmatrix}\) ✓. Trace \(1 = 1 + 0\) ✓. (b) \(F\) mirrors in the y-axis: the mirror line \((0,1)\) stays (\(\lambda = 1\)), the perpendicular \((1,0)\) is flipped (\(\lambda = -1\)). Verify: \(F\begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}-1\\0\end{pmatrix}\) ✓. Trace \(0 = 1 + (-1)\) ✓. (c) \(S\) scales everything by 2: every nonzero vector is an eigenvector, with \(\lambda = 2\) (twice). Trace \(4 = 2+2\) ✓. (d) \(H\) is a shear (triangular): eigenvalue \(1\) twice, and the x-axis stays put: \(H\begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}1\\0\end{pmatrix}\) ✓. \(H\begin{pmatrix}1\\1\end{pmatrix} = \begin{pmatrix}3\\1\end{pmatrix}\), not a multiple of \((1,1)\), so no. A shear has only one eigen-direction.
B9. (a) \(\det(A-\lambda I) = (2-\lambda)^2 - 1 = 0\), so \((2-\lambda)^2 = 1\). Both \(1\) and \(-1\) square to \(1\): \(2-\lambda = 1\) gives \(\lambda = 1\), and \(2-\lambda = -1\) gives \(\lambda = 3\), as in B3. (Or multiply out: \(\lambda^2 - 4\lambda + 3 = (\lambda-3)(\lambda-1) = 0\), which is zero when \(\lambda - 3 = 0\) or \(\lambda - 1 = 0\).) Product check: \(3\cdot1 = 3 = \det A = 4 - 1\) ✓. (b) \((0-\lambda)(3-\lambda) - (1)(-2) = \lambda^2 - 3\lambda + 2 = 0\). Two numbers that add to \(3\) (the trace) and multiply to \(2\) (\(\det A\)) are \(2\) and \(1\), so \(\lambda^2 - 3\lambda + 2 = (\lambda-2)(\lambda-1)\). A product is zero only when one factor is zero: \(\lambda - 2 = 0\) gives \(\lambda = 2\), and \(\lambda - 1 = 0\) gives \(\lambda = 1\). For \(\lambda = 2\): \(A - 2I = \begin{pmatrix}-2&1\\-2&1\end{pmatrix}\). Row 1: \(-2x + y = 0\), so \(y = 2x\) and \(\mathbf v = (1, 2)\). Check: \(A\begin{pmatrix}1\\2\end{pmatrix} = \begin{pmatrix}2\\4\end{pmatrix} = 2\begin{pmatrix}1\\2\end{pmatrix}\) ✓. For \(\lambda = 1\): \(A - I = \begin{pmatrix}-1&1\\-2&2\end{pmatrix}\). Row 1: \(-x + y = 0\), so \(y = x\) and \(\mathbf v = (1, 1)\). Check: \(A\begin{pmatrix}1\\1\end{pmatrix} = \begin{pmatrix}1\\1\end{pmatrix}\) ✓. The same answer as B5, now found without a guess. Trace \(3 = 2 + 1\) ✓, \(\det A = 0\cdot3 - 1\cdot(-2) = 2 = 2\cdot1\) ✓. (c) \((2-\lambda)(-\lambda) - 1 = \lambda^2 - 2\lambda - 1 = 0\). The quadratic formula gives \(\lambda = \frac{2 \pm \sqrt{4 + 4}}{2} = 1 \pm \sqrt2 \approx 2.414,\ -0.414\). Trace check: \((1+\sqrt2) + (1-\sqrt2) = 2\) ✓. (d) \((-\lambda)^2 - (-1)(1) = \lambda^2 + 1 = 0\), so \(\lambda^2 = -1\): no real solution. The algebra (“no real root”) matches the geometry (“every direction is turned”).
R1.
A <- matrix(c(2, 1,
1, 2), nrow = 2, byrow = TRUE)
A %*% c(1, 1) # 3 3 = 3 * (1, 1)
A %*% c(1, -1) # 1 -1 = 1 * (1, -1)
sum(diag(A)) # 4 -> equals lambda1 + lambda2 = 3 + 1Both eigenpairs check out, and the eigenvalues add up to the trace.
R2.
C <- matrix(c(5, 4,
4, 5), nrow = 2, byrow = TRUE)
sum(diag(C)) # 10 -> = 9 + 1
v <- c(1, 1) # leading eigenvector from B7
lambda <- 9
C %*% v # 9 9
lambda * v # 9 9 -> identical, so C v = 9 v
C %*% c(1, -1) # 1 -1 -> = 1 * (1, -1)The trace (10) matches \(9+1\), and \(C\mathbf v = 9\mathbf v\) and \(C\begin{pmatrix}1\\-1\end{pmatrix} = 1\cdot\begin{pmatrix}1\\-1\end{pmatrix}\) confirm both eigenpairs.
R3. Multiply the rotation by several vectors and look at where each lands.
A <- matrix(c(0, -1,
1, 0), nrow = 2, byrow = TRUE)
A %*% c(1, 0) # 0 1 -> x-axis swings to the y-axis
A %*% c(2, 1) # -1 2 -> not a multiple of (2,1)
A %*% c(3, 3) # -3 3 -> not a multiple of (3,3)Each output is the input rotated \(90^\circ\); none lands on the same line as its input (no scalar \(\lambda\) makes \(A\mathbf v=\lambda\mathbf v\) for real \(\mathbf v\)), confirming there is no real eigenvector — exactly the B6 conclusion.
Where this leads
- Eigenvalues in R:
eigen(A)returns all eigenvalues and (unit-length) eigenvectors at once. You will read its$valuesand$vectors, sort them, verify \(A\mathbf{v}=\lambda\mathbf{v}\), and reconstruct \(A = V\Lambda V^{-1}\). - Covariance & PCA (later this week): the leading eigenvector of a covariance matrix (largest eigenvalue) is the first principal component — the main axis of variation in your data. B7 was a miniature PCA computation.
- Markov chains & Markov chains in R: the stationary distribution of a Markov chain is the eigenvector with eigenvalue \(\lambda = 1\) of its transition matrix.