Skip to main content

Matrices — Diagnostic Tests

Unit Tests

Tests edge cases, boundary conditions, and common misconceptions for matrices.

UT-1: Non-Commutativity and the Commutator Equation

Question:

Let A=(1201)A = \begin{pmatrix} 1 & 2 \\ 0 & -1 \end{pmatrix} and B=(0110)B = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}.

(a) Show that ABBAAB \neq BA.

(b) Find all 2×22 \times 2 matrices XX such that AX=XAAX = XA, where AA is as defined above.

(c) A student claims that since AA and BB do not commute, no matrix can commute with AA. Explain the error.

[Difficulty: hard. Tests understanding of matrix non-commutativity and solving the commutator equation.]

Solution:

(a)

AB=(1201)(0110)=(2110)AB = \begin{pmatrix} 1 & 2 \\ 0 & -1 \end{pmatrix}\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} = \begin{pmatrix} 2 & 1 \\ -1 & 0 \end{pmatrix}

BA=(0110)(1201)=(0112)BA = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 0 & -1 \end{pmatrix} = \begin{pmatrix} 0 & -1 \\ 1 & 2 \end{pmatrix}

Since AB=(2110)(0112)=BAAB = \begin{pmatrix} 2 & 1 \\ -1 & 0 \end{pmatrix} \neq \begin{pmatrix} 0 & -1 \\ 1 & 2 \end{pmatrix} = BA, the matrices do not commute.

(b) Let X=(abcd)X = \begin{pmatrix} a & b \\ c & d \end{pmatrix}. Then:

AX=(a+2cb+2dcd)AX = \begin{pmatrix} a + 2c & b + 2d \\ -c & -d \end{pmatrix}

XA=(a2a+bc2c+d)XA = \begin{pmatrix} a & 2a + b \\ c & 2c + d \end{pmatrix}

Setting AX=XAAX = XA:

  • (1,1)(1,1): a+2c=a    c=0a + 2c = a \implies c = 0
  • (2,1)(2,1): c=c    c=0-c = c \implies c = 0 (consistent)
  • (1,2)(1,2): b+2d=2a+b    2d=2a    d=ab + 2d = 2a + b \implies 2d = 2a \implies d = a
  • (2,2)(2,2): d=2c+d    d=d    d=0-d = 2c + d \implies -d = d \implies d = 0, and therefore a=0a = 0.

So X=(0b00)X = \begin{pmatrix} 0 & b \\ 0 & 0 \end{pmatrix} for any b{R}b \in \mathbb{'\{'}R{'\}'}.

(c) The student's error is a logical fallacy: the fact that BB does not commute with AA does not imply that no matrix commutes with AA. The identity matrix II, the zero matrix OO, and all scalar multiples of II trivially commute with every matrix. Part (b) shows that there is in fact a one-parameter family of matrices commuting with AA.


UT-2: 3x3 Eigenvalues with Complex Roots

Question:

Let M=(210020003)M = \begin{pmatrix} 2 & 1 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix}.

(a) Find the eigenvalues and eigenvectors of MM.

(b) A student claims that since MM is triangular, the eigenvalues are simply the diagonal entries, so there should be three linearly independent eigenvectors. Is this correct?

[Difficulty: hard. Tests eigenvalue computation for a matrix with a repeated eigenvalue and the concept of defective matrices.]

Solution:

(a) The characteristic equation is det(MλI)=0\det(M - \lambda I) = 0:

det(2λ1002λ0003λ)=(2λ)2(3λ)=0\det\begin{pmatrix} 2 - \lambda & 1 & 0 \\ 0 & 2 - \lambda & 0 \\ 0 & 0 & 3 - \lambda \end{pmatrix} = (2 - \lambda)^2(3 - \lambda) = 0

Eigenvalues: λ1=2\lambda_1 = 2 (repeated, algebraic multiplicity 2), λ2=3\lambda_2 = 3.

For λ1=2\lambda_1 = 2: (M2I){v}={0}(M - 2I)\mathbf{'\{'}v{'\}'} = \mathbf{'\{'}0{'\}'}:

(010000001)(xyz)=(000)\begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}\begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}

This gives y=0y = 0 and z=0z = 0, with xx free. So the eigenvectors are (100)\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix} times any scalar. There is only one linearly independent eigenvector for λ=2\lambda = 2.

For λ2=3\lambda_2 = 3: (M3I){v}={0}(M - 3I)\mathbf{'\{'}v{'\}'} = \mathbf{'\{'}0{'\}'}:

(110010000)(xyz)=(000)\begin{pmatrix} -1 & 1 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 0 \end{pmatrix}\begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}

This gives y=0y = 0, x=0-x = 0 so x=0x = 0, with zz free. Eigenvector: (001)\begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}.

(b) The student is incorrect. While it is true that the eigenvalues of a triangular matrix are the diagonal entries, the number of linearly independent eigenvectors is not necessarily equal to the number of eigenvalues (counting multiplicity). Here λ=2\lambda = 2 has algebraic multiplicity 22 but geometric multiplicity 11. The matrix is defective — it cannot be diagonalised.


Integration Tests

Tests synthesis of matrices with other topics.

IT-1: Diagonalisation for Computing Matrix Powers

Question:

Let A=(5622)A = \begin{pmatrix} 5 & -6 \\ 2 & -2 \end{pmatrix}.

(a) Find the eigenvalues and eigenvectors of AA.

(b) Write A=PDP1A = PDP^{-1} where DD is a diagonal matrix.

(c) Hence find A5A^5.

(d) A student claims that since AA has two distinct eigenvalues, AnA^n can always be computed as PDnP1PD^nP^{-1} for any positive integer nn. Is this correct? What conditions must be verified?

[Difficulty: hard. Combines eigenvalue computation, diagonalisation, and matrix exponentiation.]

Solution:

(a) Characteristic equation: det(AλI)=(5λ)(2λ)+12=0\det(A - \lambda I) = (5 - \lambda)(-2 - \lambda) + 12 = 0

λ23λ10+12=λ23λ+2=0\lambda^2 - 3\lambda - 10 + 12 = \lambda^2 - 3\lambda + 2 = 0

(λ1)(λ2)=0    λ1=1,  λ2=2(\lambda - 1)(\lambda - 2) = 0 \implies \lambda_1 = 1, \; \lambda_2 = 2

For λ1=1\lambda_1 = 1: (AI){v}={0}(A - I)\mathbf{'\{'}v{'\}'} = \mathbf{'\{'}0{'\}'}:

(4623)(xy)=(00)    4x6y=0    2x=3y\begin{pmatrix} 4 & -6 \\ 2 & -3 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \end{pmatrix} \implies 4x - 6y = 0 \implies 2x = 3y

Eigenvector: {v}1=(32)\mathbf{'\{'}v{'\}'}_1 = \begin{pmatrix} 3 \\ 2 \end{pmatrix}.

For λ2=2\lambda_2 = 2: (A2I){v}={0}(A - 2I)\mathbf{'\{'}v{'\}'} = \mathbf{'\{'}0{'\}'}:

(3624)(xy)=(00)    x2y=0\begin{pmatrix} 3 & -6 \\ 2 & -4 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \end{pmatrix} \implies x - 2y = 0

Eigenvector: {v}2=(21)\mathbf{'\{'}v{'\}'}_2 = \begin{pmatrix} 2 \\ 1 \end{pmatrix}.

(b)

P=(3221),D=(1002)P = \begin{pmatrix} 3 & 2 \\ 2 & 1 \end{pmatrix}, \quad D = \begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix}

detP=34=1\det P = 3 - 4 = -1

P1=(1223)=(1223)P^{-1} = -\begin{pmatrix} 1 & -2 \\ -2 & 3 \end{pmatrix} = \begin{pmatrix} -1 & 2 \\ 2 & -3 \end{pmatrix}

Verify: PDP1=(3221)(1002)(1223)=(3422)(1223)PDP^{-1} = \begin{pmatrix} 3 & 2 \\ 2 & 1 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix}\begin{pmatrix} -1 & 2 \\ 2 & -3 \end{pmatrix} = \begin{pmatrix} 3 & 4 \\ 2 & 2 \end{pmatrix}\begin{pmatrix} -1 & 2 \\ 2 & -3 \end{pmatrix}

=(3+86122+446)=(5622)=A= \begin{pmatrix} -3 + 8 & 6 - 12 \\ -2 + 4 & 4 - 6 \end{pmatrix} = \begin{pmatrix} 5 & -6 \\ 2 & -2 \end{pmatrix} = A

(c)

D5=(150025)=(10032)D^5 = \begin{pmatrix} 1^5 & 0 \\ 0 & 2^5 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 32 \end{pmatrix}

A5=PD5P1=(3221)(10032)(1223)A^5 = PD^5P^{-1} = \begin{pmatrix} 3 & 2 \\ 2 & 1 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & 32 \end{pmatrix}\begin{pmatrix} -1 & 2 \\ 2 & -3 \end{pmatrix}

=(364232)(1223)=(3+12861922+64496)= \begin{pmatrix} 3 & 64 \\ 2 & 32 \end{pmatrix}\begin{pmatrix} -1 & 2 \\ 2 & -3 \end{pmatrix} = \begin{pmatrix} -3 + 128 & 6 - 192 \\ -2 + 64 & 4 - 96 \end{pmatrix}

=(1251866292)= \begin{pmatrix} 125 & -186 \\ 62 & -92 \end{pmatrix}

(d) The student's claim is correct with the caveat that the matrix must be diagonalisable. Two distinct eigenvalues are a sufficient condition for diagonalisability, since each eigenvalue contributes at least one eigenvector and eigenvectors corresponding to distinct eigenvalues are linearly independent. So with two distinct eigenvalues for a 2×22 \times 2 matrix, we are guaranteed two linearly independent eigenvectors, meaning PP is invertible.

However, the student should verify that PP is indeed invertible (i.e., detP0\det P \neq 0) before using this method. If the eigenvectors were accidentally computed incorrectly (e.g., picking a dependent pair), P1P^{-1} would not exist.