Type at least 2 letters. Enter opens the first result, Esc closes.

    Linear Algebra · Lesson 2 · Start here: matrices and subspaces

    Rank, rank–nullity and the four fundamental subspaces

    Beginner 70 min 3 interactive figures 3 videos Colab notebook

    Before this lesson: lesson 01 (matrices as maps, span, basis, independence). Time: about 70 minutes, plus the notebook.


    Why this matters #

    Rank answers one question: how many independent directions survive the map x↦Axx \mapsto Ax? This one number decides whether Ax=bAx = b has a solution, whether the solution is unique, and how much a matrix can be compressed. Low rank is everywhere in ML: a LoRA update BABA has rank at most rr, an attention score matrix QK⊤QK^\top has rank at most the head dimension, and PCA keeps a low-rank part of the data. In science, the four subspaces of a graph's incidence matrix describe Kirchhoff's laws for electric circuits.

    1. Predict first #

    2. The picture #

    AA is an m×nm \times n matrix, so it maps Rn→Rm\mathbb{R}^n \to \mathbb{R}^m.

    • The column space C(A)={Ax:x∈Rn}⊆RmC(A) = \{Ax : x \in \mathbb{R}^n\} \subseteq \mathbb{R}^m is the set of all outputs.
    • The null space N(A)={x:Ax=0}⊆RnN(A) = \{x : Ax = 0\} \subseteq \mathbb{R}^n is the set of inputs that are sent to zero.
    • The rank r=dim⁡C(A)r = \dim C(A) is the number of independent output directions.

    Start with a square example in R3\mathbb{R}^3. A matrix of rank 3 turns the unit cube into a solid box. A matrix of rank 2 flattens the cube into a parallelogram inside a plane: one input direction is lost. A matrix of rank 1 flattens everything onto a line: two input directions are lost.

    Interactive figure: loading…

    Press Squash (play), or move the slider tt from 0 to 1. Every point moves from xx to AxAx. The aqua cube becomes a flat parallelogram in the plane C(A)C(A), and the orange null-space line shrinks to the point 0. Read the count: rank 2 + nullity 1 = 3. Switch to rank 1: the image is a line and a whole plane of inputs goes to 0 (1 + 2 = 3). Edit the matrix: the count always gives 3.

    Rank–nullity is a counting statement about the nn input dimensions. Some of them are sent to 0 (that is dim⁡N(A)\dim N(A)). The rest are carried one-to-one onto the output directions (that is rr). So r+dim⁡N(A)=nr + \dim N(A) = n: each input direction is counted exactly once.

    Two more subspaces come from A⊤A^\top: the row space C(A⊤)⊆RnC(A^\top) \subseteq \mathbb{R}^n (all combinations of the rows of AA) and the left null space N(A⊤)={y:A⊤y=0}⊆RmN(A^\top) = \{y : A^\top y = 0\} \subseteq \mathbb{R}^m.

    Interactive figure: loading…

    All four subspaces of a 2×32 \times 3 matrix. On the left is the input space R3\mathbb{R}^3: the row space and the null space meet at a right angle. On the right is the output space R2\mathbb{R}^2: the column space and the left null space. Move xx with the sliders: it splits into xrow+xnullx_{\text{row}} + x_{\text{null}}, and only xrowx_{\text{row}} changes AxAx. Switch to rank 1 and watch every dimension in the table move by one.

    The figure is the whole lesson in one picture. AA sends the row space one-to-one onto the column space (both have dimension rr), and it sends the null space to 0. The two pieces on each side are perpendicular, and their dimensions add up to nn on the input side and to mm on the output side.

    Quick check

    A 2×32 \times 3 matrix AA has rank 2. What is its null space?

    3. Definitions and main results #

    Echelon form, pivots and free columns #

    Gaussian elimination subtracts multiples of one row from another (and swaps rows when needed) until the matrix has a staircase shape. Take

    B=(1130237−1124−1).B = \begin{pmatrix} 1 & 1 & 3 & 0 \\ 2 & 3 & 7 & -1 \\ 1 & 2 & 4 & -1 \end{pmatrix}.
    1. Row 2 − 2·row 1 gives (0,1,1,−1)(0, 1, 1, -1). Row 3 − row 1 gives (0,1,1,−1)(0, 1, 1, -1).
    2. Row 3 − row 2 gives (0,0,0,0)(0, 0, 0, 0). This is the echelon form:
    U=(1130011−10000).U = \begin{pmatrix} \boxed{1} & 1 & 3 & 0 \\ 0 & \boxed{1} & 1 & -1 \\ 0 & 0 & 0 & 0 \end{pmatrix}.

    The first nonzero entry of each nonzero row is a pivot (boxed). Each pivot sits to the right of the pivot above it. Columns 1 and 2 contain pivots: they are the pivot columns. Columns 3 and 4 have no pivot: they are the free columns, and x3,x4x_3, x_4 are the free variables of Bx=0Bx = 0.

    1. To reach the reduced row echelon form (RREF), make every pivot 1 and clear the entries above each pivot. Here row 1 − row 2 gives (1,0,2,1)(1, 0, 2, 1):
    R=rref⁡(B)=(1021011−10000).R = \operatorname{rref}(B) = \begin{pmatrix} \boxed{1} & 0 & 2 & 1 \\ 0 & \boxed{1} & 1 & -1 \\ 0 & 0 & 0 & 0 \end{pmatrix}.

    Rank by elimination #

    Elimination multiplies AA on the left by an invertible matrix EE (the product of the row operations) and gives R=EAR = EA. Three facts make this useful:

    1. The null space does not change. Ax=0  ⟺  EAx=0Ax = 0 \iff EAx = 0, because EE is invertible.
    2. The row space does not change. Every row of RR is a combination of rows of AA, and the other way round (use E−1E^{-1}).
    3. The column space does change, but the dependencies between columns do not. A combination of columns is zero in AA exactly when it is zero in RR (this is fact 1: the coefficients form a null vector).

    Fact 3 on the example. In RR you can read the dependencies at once: column 3 of RR is (2,1,0)=2⋅(column 1)+1⋅(column 2)(2, 1, 0) = 2 \cdot (\text{column 1}) + 1 \cdot (\text{column 2}), and column 4 is (1,−1,0)=column 1−column 2(1, -1, 0) = \text{column 1} - \text{column 2}. The same holds in BB:

    2(121)+(132)=(374)=column 3 of B,(121)−(132)=(0−1−1)=column 4 of B.2\begin{pmatrix}1\\2\\1\end{pmatrix} + \begin{pmatrix}1\\3\\2\end{pmatrix} = \begin{pmatrix}3\\7\\4\end{pmatrix} = \text{column 3 of } B, \qquad \begin{pmatrix}1\\2\\1\end{pmatrix} - \begin{pmatrix}1\\3\\2\end{pmatrix} = \begin{pmatrix}0\\-1\\-1\end{pmatrix} = \text{column 4 of } B.

    But the columns themselves changed: column 1 of BB is (1,2,1)(1, 2, 1), while column 1 of RR is (1,0,0)(1, 0, 0).

    So the rank is the number of pivots. A basis of C(A)C(A) is given by the pivot columns of the original AA, and a basis of C(A⊤)C(A^\top) by the nonzero rows of RR.

    Quick check

    For BB above, which vectors form a basis of the column space C(B)C(B)?

    Row rank = column rank, and A=CRA = CR #

    The pivot columns of AA and the nonzero rows of RR give a factorization. Let CC be the m×rm \times r matrix of pivot columns of AA, and let RrR_r be the r×nr \times n matrix of nonzero rows of rref⁡(A)\operatorname{rref}(A). Then

    A=C Rr.A = C\,R_r .

    Why. Column jj of RrR_r lists how column jj of rref⁡(A)\operatorname{rref}(A) is built from its pivot columns, which are e1,…,ere_1, \dots, e_r. By fact 3, column jj of AA is built from the pivot columns of AA with the same coefficients: column jj of AA =C⋅(column j of Rr)= C \cdot (\text{column } j \text{ of } R_r). This is the column view of the product (lesson 01).

    For the example, CC holds columns 1 and 2 of BB:

    B=(112312)(1021011−1).B = \begin{pmatrix} 1 & 1 \\ 2 & 3 \\ 1 & 2 \end{pmatrix} \begin{pmatrix} 1 & 0 & 2 & 1 \\ 0 & 1 & 1 & -1 \end{pmatrix}.

    Check column 4: 1⋅(1,2,1)−1⋅(1,3,2)=(0,−1,−1)1 \cdot (1, 2, 1) - 1 \cdot (1, 3, 2) = (0, -1, -1) ✓.

    Theorem (row rank = column rank). For every matrix, dim⁡C(A⊤)=dim⁡C(A)\dim C(A^\top) = \dim C(A).

    Proof.

    1. Let r=dim⁡C(A)r = \dim C(A) (the column rank). Write A=CRrA = CR_r with RrR_r of size r×nr \times n.
    2. By the row view of the product, every row of AA is a combination of the rr rows of RrR_r. So the row space of AA is spanned by rr vectors: dim⁡C(A⊤)≤dim⁡C(A)\dim C(A^\top) \le \dim C(A).
    3. Apply step 2 to A⊤A^\top, whose rows are the columns of AA: dim⁡C(A)≤dim⁡C(A⊤)\dim C(A) \le \dim C(A^\top).
    4. The two inequalities give equality. ■\blacksquare

    The factorization also shows the rank in the outer-product view: A=CRrA = CR_r is a sum of rr rank-1 matrices (column kk of CC times row kk of RrR_r). LoRA, low-rank attention and the truncated SVD (lesson 08) all use this form.

    Quick check

    u,v,w,zu, v, w, z are nonzero vectors in R5\mathbb{R}^5. What can you say about rank⁡(uv⊤+wz⊤)\operatorname{rank}(uv^\top + wz^\top)?

    Rank–nullity #

    Theorem (rank–nullity). For A∈Rm×nA \in \mathbb{R}^{m \times n}: rank⁡(A)+dim⁡N(A)=n.\quad \operatorname{rank}(A) + \dim N(A) = n.

    Proof.

    1. Reduce AA to echelon form RR. By fact 1, N(R)=N(A)N(R) = N(A).
    2. RR has rr pivot columns and n−rn - r free columns.
    3. For each free variable jj: set xj=1x_j = 1, set the other free variables to 00, and solve for the pivot variables by back substitution. Call the result sjs_j (a special solution).
    4. The sjs_j are independent: sjs_j has a 11 in position jj, where every other special solution has a 00.
    5. The sjs_j span N(A)N(A): for any x∈N(A)x \in N(A), the vector x−∑jxjsjx - \sum_j x_j s_j is in N(A)N(A) and has all free variables equal to 00; back substitution then forces its pivot variables to 00 too, so it is the zero vector.
    6. Hence dim⁡N(A)=n−r\dim N(A) = n - r. ■\blacksquare

    For BB: the free variables are x3x_3 and x4x_4. With x3=1,x4=0x_3 = 1, x_4 = 0 the rows of RR give x1=−2x_1 = -2, x2=−1x_2 = -1, so s3=(−2,−1,1,0)s_3 = (-2, -1, 1, 0). With x3=0,x4=1x_3 = 0, x_4 = 1: x1=−1x_1 = -1, x2=1x_2 = 1, so s4=(−1,1,0,1)s_4 = (-1, 1, 0, 1). Two special solutions, and 4−2=24 - 2 = 2 ✓.

    The four subspaces #

    Subspace Lives in Dimension
    column space C(A)C(A) Rm\mathbb{R}^m rr
    left null space N(A⊤)N(A^\top) Rm\mathbb{R}^m m−rm - r
    row space C(A⊤)C(A^\top) Rn\mathbb{R}^n rr
    null space N(A)N(A) Rn\mathbb{R}^n n−rn - r

    The last two rows use rank–nullity for AA; the first two use it for A⊤A^\top (which has mm columns and the same rank rr).

    N(A)⊥C(A⊤)N(A) \perp C(A^\top). If Ax=0Ax = 0, then every row ai⊤a_i^\top of AA satisfies ai⊤x=0a_i^\top x = 0: xx is orthogonal to every row, so also to every combination of rows. The same argument for A⊤A^\top gives C(A)⊥N(A⊤)C(A) \perp N(A^\top). More is true: the two pieces fill their space.

    Theorem (orthogonal complements). N(A)N(A) and C(A⊤)C(A^\top) are orthogonal complements in Rn\mathbb{R}^n: every x∈Rnx \in \mathbb{R}^n splits in exactly one way as x=xrow+xnullx = x_{\text{row}} + x_{\text{null}} with xrow∈C(A⊤)x_{\text{row}} \in C(A^\top) and xnull∈N(A)x_{\text{null}} \in N(A). The same holds for C(A)C(A) and N(A⊤)N(A^\top) in Rm\mathbb{R}^m.

    Proof: the two pieces fill Rn\mathbb{R}^n
    1. They share only 0. If xx is in both, then x⊥xx \perp x, so ∥x∥2=x⊤x=0\|x\|^2 = x^\top x = 0 and x=0x = 0.
    2. Their bases together are independent. Take a basis r1,…,rrr_1, \dots, r_r of C(A⊤)C(A^\top) and a basis s1,…,sn−rs_1, \dots, s_{n-r} of N(A)N(A). Suppose ∑iairi+∑jbjsj=0\sum_i a_i r_i + \sum_j b_j s_j = 0. Then u=∑iairi=−∑jbjsju = \sum_i a_i r_i = -\sum_j b_j s_j lies in both subspaces, so u=0u = 0 by step 1. Each basis is independent, so all ai=0a_i = 0 and all bj=0b_j = 0.
    3. They span Rn\mathbb{R}^n. Step 2 gives r+(n−r)=nr + (n - r) = n independent vectors in Rn\mathbb{R}^n, so they form a basis of Rn\mathbb{R}^n (lesson 01). Every xx is a combination of them: the part with the rir_i is xrowx_{\text{row}}, the part with the sjs_j is xnullx_{\text{null}}.
    4. The split is unique. If x=p+q=p′+q′x = p + q = p' + q' with p,p′p, p' in the row space and q,q′q, q' in the null space, then p−p′=q′−qp - p' = q' - q lies in both subspaces, so it is 0 by step 1.
    5. For C(A)C(A) and N(A⊤)N(A^\top), apply steps 1–4 to A⊤A^\top. ■\blacksquare

    Two consequences you will use again and again:

    • Solvability: Ax=bAx = b has a solution exactly when b∈C(A)b \in C(A), that is, when y⊤b=0y^\top b = 0 for every y∈N(A⊤)y \in N(A^\top). (By the theorem, b∈C(A)b \in C(A) exactly when bb has no part in N(A⊤)N(A^\top).)
    • Splitting: every xx splits as x=xrow+xnullx = x_{\text{row}} + x_{\text{null}}. AA ignores xnullx_{\text{null}} and maps the row space one-to-one onto the column space.

    rank⁡(A⊤A)=rank⁡(A)\operatorname{rank}(A^\top A) = \operatorname{rank}(A) #

    Theorem. For every real matrix AA, N(A⊤A)=N(A)N(A^\top A) = N(A), and so rank⁡(A⊤A)=rank⁡(A)\operatorname{rank}(A^\top A) = \operatorname{rank}(A).

    Proof.

    1. If Ax=0Ax = 0, then A⊤Ax=A⊤0=0A^\top A x = A^\top 0 = 0. So N(A)⊆N(A⊤A)N(A) \subseteq N(A^\top A).
    2. If A⊤Ax=0A^\top A x = 0, multiply on the left by x⊤x^\top: 0=x⊤A⊤Ax=(Ax)⊤(Ax)=∥Ax∥20 = x^\top A^\top A x = (Ax)^\top (Ax) = \|Ax\|^2. So Ax=0Ax = 0, and N(A⊤A)⊆N(A)N(A^\top A) \subseteq N(A).
    3. Both matrices have nn columns, so rank–nullity gives rank⁡(A⊤A)=n−dim⁡N(A⊤A)=n−dim⁡N(A)=rank⁡(A)\operatorname{rank}(A^\top A) = n - \dim N(A^\top A) = n - \dim N(A) = \operatorname{rank}(A). ■\blacksquare

    Lessons 08 (SVD) and 12 (least squares) use this: A⊤AA^\top A is invertible exactly when AA has independent columns.

    Answers to section 1. (1) No: r≤3r \le 3, so dim⁡N(A)=5−r≥2\dim N(A) = 5 - r \ge 2, and nonzero solutions always exist. (2) Yes, but only when r=3r = 3, because then C(A)=R3C(A) = \mathbb{R}^3.

    4. Worked example #

    A=(120124143615)A = \begin{pmatrix} 1 & 2 & 0 & 1 \\ 2 & 4 & 1 & 4 \\ 3 & 6 & 1 & 5 \end{pmatrix}

    Eliminate. Row 2 − 2·row 1 gives (0,0,1,2)(0, 0, 1, 2). Row 3 − 3·row 1 gives (0,0,1,2)(0, 0, 1, 2). Then row 3 − row 2 gives 00:

    R=(120100120000)R = \begin{pmatrix} 1 & 2 & 0 & 1 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 0 & 0 \end{pmatrix}

    Pivots in columns 1 and 3, so r=2r = 2. Free variables: x2,x4x_2, x_4. (RR is already reduced: the pivots are 1 and the entries above them are 0.)

    Interactive figure: loading…

    Step through the elimination. Press Next step to apply one row operation at a time. Each operation acts on AA and on II together, so the right block becomes the matrix EE with EA=REA = R. Pivot columns and free columns are marked as soon as elimination decides them. At the end the widget reads off bases of all four subspaces, in the colours of the figures above; the last row of EE is the left null vector (−1,−1,1)(-1, -1, 1). Try needs a row swap, or type your own matrix.

    Special solutions.

    • x2=1,x4=0x_2 = 1, x_4 = 0: row 2 gives x3=0x_3 = 0; row 1 gives x1=−2x_1 = -2. So s1=(−2,1,0,0)s_1 = (-2, 1, 0, 0).
    • x2=0,x4=1x_2 = 0, x_4 = 1: row 2 gives x3=−2x_3 = -2; row 1 gives x1=−1x_1 = -1. So s2=(−1,0,−2,1)s_2 = (-1, 0, -2, 1).

    All four subspaces.

    • C(A)C(A): columns 1 and 3 of AA: (1,2,3)(1,2,3) and (0,1,1)(0,1,1). Dimension 2.
    • N(A)N(A): spanned by s1,s2s_1, s_2. Dimension 4−2=24 - 2 = 2. ✓
    • C(A⊤)C(A^\top): rows (1,2,0,1)(1,2,0,1) and (0,0,1,2)(0,0,1,2) of RR. Dimension 2.
    • N(A⊤)N(A^\top): row 3 = row 1 + row 2, so y=(−1,−1,1)y = (-1, -1, 1) gives A⊤y=0A^\top y = 0. Dimension 3−2=13 - 2 = 1. ✓

    A=CRA = CR. The pivot columns (1,2,3)(1, 2, 3) and (0,1,1)(0, 1, 1) times the two nonzero rows of RR: column 4 of AA is 1⋅(1,2,3)+2⋅(0,1,1)=(1,4,5)1 \cdot (1, 2, 3) + 2 \cdot (0, 1, 1) = (1, 4, 5) ✓, and column 2 is 2⋅(1,2,3)2 \cdot (1, 2, 3) ✓.

    Checks. s1⋅(1,2,0,1)=−2+2=0s_1 \cdot (1,2,0,1) = -2 + 2 = 0 and s2⋅(0,0,1,2)=−2+2=0s_2 \cdot (0,0,1,2) = -2 + 2 = 0: null space ⟂ row space. Ax=bAx = b is solvable exactly when y⊤b=−b1−b2+b3=0y^\top b = -b_1 - b_2 + b_3 = 0, that is, b3=b1+b2b_3 = b_1 + b_2.

    Quick check

    For this AA, which right-hand side bb gives a solvable system Ax=bAx = b?

    5. In code #

    The library computes all four subspaces, so you can check the hand computation. The notebook for this lesson has these cells and the exercises.

    import numpy as np
    from scipy.linalg import null_space, orth
    
    A = np.array([[1, 2, 0, 1],
                  [2, 4, 1, 4],
                  [3, 6, 1, 5]], dtype=float)
    r  = np.linalg.matrix_rank(A)   # counts singular values above a tolerance
    N  = null_space(A)              # orthonormal basis of N(A),  shape (4, 2)
    LN = null_space(A.T)            # orthonormal basis of N(Aᵀ), shape (3, 1)
    Rb = orth(A.T)                  # orthonormal basis of C(Aᵀ), shape (4, 2)
    print(r, N.shape[1], LN.shape[1])   # 2 2 1
    print(np.abs(Rb.T @ N).max())       # ~6e-16: row space ⟂ null space
    print(np.linalg.matrix_rank(A.T @ A))   # 2: rank(AᵀA) = rank(A)
    

    In floating point, rank is a numerical idea: matrix_rank counts singular values above σmax⁡⋅max⁡(m,n)⋅ε\sigma_{\max} \cdot \max(m,n) \cdot \varepsilon. A tiny perturbation makes almost every matrix full rank, so in practice you look at the singular values (lessons 08 and 13).

    6. Where it shows up #

    • Least squares and identifiability. If two features are collinear, N(X)≠{0}N(X) \ne \{0\} and infinitely many weight vectors fit equally well. Ridge regression picks one.
    • Low rank in ML. LoRA: rank⁡(BA)≤r\operatorname{rank}(BA) \le r. Attention: rank⁡(QK⊤)≤dk\operatorname{rank}(QK^\top) \le d_k. Outer product: rank⁡(uv⊤)=1\operatorname{rank}(uv^\top) = 1. In general rank⁡(AB)≤min⁡(rank⁡A,rank⁡B)\operatorname{rank}(AB) \le \min(\operatorname{rank} A, \operatorname{rank} B).
    • Graphs and conservation laws. The incidence matrix AA of a directed graph has one row per edge and one column per node, with +1+1 at the start node and −1-1 at the end node of each edge (the convention of the notebook). Then:
      • AvAv gives the potential differences along the edges;
      • for a connected graph, N(A)N(A) is the constant potentials (dimension 1);
      • A⊤y=0A^\top y = 0 means flows that are conserved at every node (Kirchhoff's current law); dim⁡N(A⊤)=E−N+1\dim N(A^\top) = E - N + 1, the number of independent loops;
      • A⊤AA^\top A is the graph Laplacian, the basis of spectral graph methods and GNNs.

    7. Common mistakes #

    • Taking the pivot columns of RR as a basis of C(A)C(A). Elimination changes the column space; take those columns from the original AA.
    • Mixing up home spaces. N(A)⊆RnN(A) \subseteq \mathbb{R}^n (inputs), C(A)⊆RmC(A) \subseteq \mathbb{R}^m (outputs).
    • Wrong nullity for A⊤A^\top. It is m−rm - r, not n−rn - r.
    • "Full rank means invertible." Only for square matrices. A 3×53 \times 5 matrix of rank 3 has full row rank, but its null space has dimension 2.
    • Exact rank on floats. Use a tolerance on singular values.

    8. Check yourself #

    1. AA is 5×35 \times 3 with rank 3. Give the dimensions of the four subspaces.
      AnswerC(A)C(A): 3 (in R5\mathbb{R}^5); N(A⊤)N(A^\top): 2; C(A⊤)C(A^\top): 3, so all of R3\mathbb{R}^3; N(A)N(A): 0.
    2. Why do row operations not change the null space?
      AnswerThey multiply by an invertible EE, and EAx=0  ⟺  Ax=0EAx = 0 \iff Ax = 0.
    3. What is rank⁡(AA⊤)\operatorname{rank}(AA^\top)?
      Answerrank⁡(A)\operatorname{rank}(A). Apply the theorem rank⁡(M⊤M)=rank⁡(M)\operatorname{rank}(M^\top M) = \operatorname{rank}(M) to M=A⊤M = A^\top: rank⁡(AA⊤)=rank⁡(A⊤)=rank⁡(A)\operatorname{rank}(AA^\top) = \operatorname{rank}(A^\top) = \operatorname{rank}(A) (row rank = column rank).
    4. In the worked example, what happens for b=(1,1,0)b = (1, 1, 0)?
      Answerb3≠b1+b2b_3 \ne b_1 + b_2, so y⊤b=−2≠0y^\top b = -2 \ne 0: no solution. Only a least-squares solution exists.
    5. Can a 4×44 \times 4 matrix have C(A)=N(A)C(A) = N(A)?
      AnswerYes, with r=2r = 2 (needs r=4−rr = 4 - r) and A2=0A^2 = 0. Example: ones at positions (1,3) and (2,4), zeros elsewhere; then C(A)=N(A)=span⁡(e1,e2)C(A) = N(A) = \operatorname{span}(e_1, e_2).
    6. Write (123246)\begin{pmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \end{pmatrix} as CRCR.
      AnswerRank 1: row 2 = 2·row 1, and the only pivot column is column 1. C=(12)C = \begin{pmatrix} 1 \\ 2 \end{pmatrix}, R=(123)R = \begin{pmatrix} 1 & 2 & 3 \end{pmatrix}, so the matrix is the outer product (12)(123)\begin{pmatrix} 1 \\ 2 \end{pmatrix}\begin{pmatrix} 1 & 2 & 3 \end{pmatrix}.
    Recall cardsAnswer in your head first, then reveal. Add the cards to your review deck to see them again just before you would forget.
    1. Define the rank of a matrix AA.

    2. State rank–nullity for A∈Rm×nA \in \mathbb{R}^{m \times n}.

    3. An m×nm \times n matrix has rank rr. Give the dimensions of C(A)C(A), N(A⊤)N(A^\top), C(A⊤)C(A^\top) and N(A)N(A).

    4. Why is N(A)N(A) orthogonal to the row space C(A⊤)C(A^\top)?

    5. After elimination A→RA \to R, where do you take a basis of C(A)C(A) from?

    6. How do you test with the left null space whether Ax=bAx = b has a solution?

    7. What are CC and RR in the factorization A=CRA = CR?

    8. Why does row rank equal column rank?

    9. Why is rank⁡(A⊤A)=rank⁡(A)\operatorname{rank}(A^\top A) = \operatorname{rank}(A)?

    10. A 3×53 \times 5 matrix has rank 3. What is dim⁡N(A)\dim N(A)?

    Open the review →

    9. Interview angle #

    • "What is the rank of uv⊤uv^\top? Of ABAB?" — 1 (for nonzero u,vu, v); at most min⁡(rank⁡A,rank⁡B)\min(\operatorname{rank} A, \operatorname{rank} B).
    • "When does least squares have a unique solution?" — when XX has full column rank (N(X)={0}N(X) = \{0\}), which is when X⊤XX^\top X is invertible.
    • "Why is LoRA cheap, and what can it not represent?" — r(m+n)r(m+n) parameters instead of mnmn; it cannot represent an update of rank above rr.
    • "What does the null space of a graph Laplacian tell you?" — the connected components (one constant vector per component).

    10. Practice #

    The notebook for this lesson runs in Colab. It has four exercises, each with a check cell and a folded solution:

    1. Write rref: Gauss–Jordan elimination with a tolerance, returning RR and the pivot columns.
    2. Build a basis of N(A)N(A) from the special solutions, and check rank–nullity on random low-rank matrices.
    3. Decide whether Ax=bAx = b is solvable with the left null space: y⊤b=0y^\top b = 0 for every y∈N(A⊤)y \in N(A^\top).
    4. Build the incidence matrix of a small circuit graph and read Kirchhoff's laws from its four subspaces: one constant potential, E−N+1E - N + 1 loops, and A⊤AA^\top A = the graph Laplacian.

    11. Watch and read #

    Open on YouTube · the player loads from youtube-nocookie.com when you press play
    Open on YouTube · the player loads from youtube-nocookie.com when you press play
    Open on YouTube · the player loads from youtube-nocookie.com when you press play