Why is the shear matrix [[1,1],[0,1]] not diagonalizable as A = P D P^-1?
answer
- count the eigenvalues, then count the directions
- one repeated root, one lonely eigenvector
- the columns of P must be independent
- geometric multiplicity below algebraic multiplicity
- defective, so no eigenbasis exists
basics
~20 sIts characteristic equation (1 - lambda)^2 = 0 repeats lambda = 1, but the eigenspace is only the line through (1,0). One independent eigenvector instead of two means no eigenbasis, so no invertible P exists: the matrix is defective.
solid answer
~40 sDiagonalizing means writing `A = P D P^-1`, where `D` holds the eigenvalues and the columns of `P` are the matching eigenvectors. That requires `P` to be invertible, which requires `n` linearly independent eigenvectors — an eigenbasis. For the shear `[[1,1],[0,1]]`, the characteristic polynomial is `(1 - lambda)^2`, so `lambda = 1` has algebraic multiplicity 2. But `A - I = [[0,1],[0,0]]`, whose null space is only `{(x,0)}`, a single line. Geometric multiplicity 1 is less than algebraic multiplicity 2, so the matrix is **defective** and no such `P` exists. The contrast worth naming is the spectral theorem: every real symmetric matrix is guaranteed real eigenvalues and a full orthonormal eigenbasis, so a symmetric matrix can never fail this way.
go deeper
Know that A = P D P^-1 puts eigenvalues in D and eigenvectors in the columns of P, and that P has to be invertible for the formula to make sense at all.
Be ready to compute both multiplicities for a repeated eigenvalue and to state the exact criterion: diagonalizable when every eigenspace has dimension equal to the eigenvalue's algebraic multiplicity.
Demonstrate the numerical angle: near-defective matrices have nearly parallel eigenvectors, an ill-conditioned P, and eigenvectors that swing wildly under tiny perturbations, so eigen-based results there need scepticism.
Own the choice of decomposition for the team. Symmetry buys a guaranteed orthonormal eigenbasis and cheap inverses; when the operator is not symmetric, decide whether to symmetrize the problem or move to a factorization that always exists.
## What diagonalization asks for To diagonalize `A` is to find an invertible `P` and a diagonal `D` with ``` A = P D P^-1 ``` Read column by column, `AP = PD` says that the `i`-th column of `P` is an eigenvector of `A` with eigenvalue `D[i][i]`. So diagonalizability is not really a statement about determinants or inverses — it is the statement that **`A` has `n` linearly independent eigenvectors**, enough to form a basis of the whole space. In that basis `A` is nothing but independent scalings along the axes. ## Where the shear fails Take `A = [[1,1],[0,1]]`, which leaves the x-coordinate alone and slides points horizontally in proportion to their height. Characteristic polynomial (the matrix is triangular, so the diagonal entries are the eigenvalues): ``` det(A - lambda I) = (1 - lambda)(1 - lambda) - (1)(0) = (1 - lambda)^2 ``` So `lambda = 1` is a root twice: its **algebraic multiplicity** is 2. Now find the eigenspace: ``` A - I = [[0, 1], [0, 0]] ``` The system `(A - I)v = 0` reduces to the single equation `v2 = 0`, so the eigenvectors are exactly the nonzero multiples of `(1,0)`. The eigenspace is one-dimensional: the **geometric multiplicity** is 1. One independent eigenvector is not enough to fill a 2x2 `P`. Any attempt puts two parallel columns in `P`, making it singular and `P^-1` nonexistent. A matrix with geometric multiplicity strictly below algebraic multiplicity for some eigenvalue is called **defective**, and defective matrices are precisely the non-diagonalizable ones. Geometrically the picture is clear: the shear fixes the horizontal axis and tilts everything else. There is no *second* independent direction that merely gets rescaled, so there is no coordinate system in which the shear is a pure scaling. ## The rules that decide the question 1. `A` is diagonalizable if and only if for every eigenvalue, geometric multiplicity equals algebraic multiplicity. 2. If `A` has `n` **distinct** eigenvalues, it is diagonalizable. Eigenvectors from distinct eigenvalues are automatically independent, so you get a full basis for free. This is sufficient, not necessary. 3. Repeated eigenvalues do **not** by themselves block diagonalization. The identity matrix has `lambda = 1` with algebraic multiplicity `n`, and its eigenspace is the entire space, so it is already diagonal. The failure needs a *deficient* eigenspace, as in the shear. ## The symmetric guarantee The **spectral theorem** says that a real symmetric matrix (`A = A^T`) always has real eigenvalues and an orthonormal basis of eigenvectors, so it can always be written ``` A = Q D Q^T ``` with `Q` orthogonal (`Q^-1 = Q^T`) and `D` real diagonal. Two things are stronger here than in the general case: existence is guaranteed — no symmetric matrix is ever defective, even with repeated eigenvalues — and the change of basis is a pure rotation or reflection, so it preserves lengths and angles and `P^-1` costs nothing to form. This is why the eigen-machinery is so well behaved on the symmetric matrices that dominate statistics and machine learning, such as covariance and Gram matrices, and why the shear's pathology never appears there. The shear is not symmetric: `A[0][1] = 1` while `A[1][0] = 0`. ## Why anyone cares whether A is diagonalizable Diagonalization turns hard matrix operations into scalar ones. Since ``` A^k = (P D P^-1)^k = P D^k P^-1 ``` repeated application just raises each eigenvalue to the `k`-th power, which is what makes long-run behaviour of iterated linear maps easy to predict: the direction with the largest `|lambda|` dominates. Coupled linear systems decouple in the eigenbasis, and functions of matrices are defined by applying the function to the diagonal entries. When `A` is defective, none of that is available in this form and one must fall back on a more general triangular factorization. ## Near-defective is a practical problem too In floating point, exact defectiveness is rare, but *nearly* defective matrices are common and they behave almost as badly. If two eigenvectors are nearly parallel, `P` is nearly singular, `P^-1` has huge entries, and the computed eigenvectors are extremely sensitive to tiny perturbations of the input. So the interview-worthy conclusion is not merely 'this matrix cannot be diagonalized' but 'eigenvector-based reasoning is only trustworthy when the eigenvectors are well separated, which symmetry guarantees and general matrices do not'.
- Does a repeated eigenvalue always prevent diagonalization?No. The identity matrix has eigenvalue 1 repeated `n` times and is already diagonal, because its eigenspace is the whole space. What blocks diagonalization is a *deficient* eigenspace: geometric multiplicity strictly less than algebraic multiplicity for some eigenvalue. Repetition only creates the opportunity for that deficiency; it does not cause it.
- What does the spectral theorem guarantee for a real symmetric matrix?That all its eigenvalues are real and that an orthonormal basis of eigenvectors always exists, so `A = Q D Q^T` with `Q` orthogonal. Symmetric matrices are therefore never defective, even with repeated eigenvalues, and the inverse of the change of basis is just a transpose. This is why covariance and Gram matrices are so well behaved.
- Why does diagonalizability matter in practice at all?Because `A^k = P D^k P^-1` reduces repeated application to raising scalars to a power, which makes long-run behaviour of iterated linear maps predictable and decouples coupled linear systems. When the eigenvectors are missing or nearly parallel, that machinery is unavailable or numerically untrustworthy, and a more general factorization must be used instead.
Diagonalizing is finding a set of axes the map only stretches along. The shear leaves exactly one such axis, so like a tripod missing a leg, there is nothing to build a full coordinate frame from.
saying these in an interview costs you the question
- Says any repeated eigenvalue makes a matrix non-diagonalizable
- Claims every square matrix is diagonalizable
- Confuses non-diagonalizable with singular
- Thinks P must always be orthogonal
- Counts eigenvalues instead of independent eigenvectors
- Believes a nonzero determinant implies an eigenbasis exists