Linear Algebra

Rank, Null Space, Column Space, and Conditioning

Rank says which outputs a matrix can reach, null space says which inputs disappear, and conditioning says how fragile those directions are numerically.

status: publishedimportance: criticaldifficulty 3/5math: undergraduateread: 18mlive demo

Concept Structure

Rank, Null Space, Column Space, and Conditioning

01Intuition

Start with the picture, metaphor, or geometric mechanism.

02Math

Make the objects explicit and connect them with notation.

03Code

Mirror the equations with runnable implementation details.

04Interactive Demo

Manipulate the mechanism and watch the idea respond.

5prerequisites
3next concepts
1related links

Learning map

Rank, Null Space, Column Space, and Conditioning
BeforeVector SpacesNow4/4 sections readyTryManipulate one control and predict the visible change.NextOrthogonality, Projections, and Least-Squares Geometry

Object flow

4/4 sections readyAsk about thisResearch room
ConceptRank, Null Space, Column Space, and ConditioningLinear Algebra
3 sources attachedLocal snapshot ready
concept:linear-algebra/rank-null-column-space-conditioning

Conceptual Bridge

What should feel connected as you move through this page.

Carry inVector Spaces

Bring the mental model from Vector Spaces; this page will reuse it instead of restarting from zero.

Work hereRank, Null Space, Column Space, and Conditioning

Rank says which outputs a matrix can reach, null space says which inputs disappear, and conditioning says how fragile those directions are numerically.

Carry outOrthogonality, Projections, and Least-Squares Geometry

The next edge should feel earned: use the demo prediction here before following Orthogonality, Projections, and Least-Squares Geometry.

Test the linkManipulate one control and predict the visible change.Then continue to Orthogonality, Projections, and Least-Squares Geometry
01

01

Intuition

Build the mental picture first so the rest of the page has something to attach to.

Section prompt

A matrix is a machine that turns input directions into output directions.

Some output directions are reachable. Those directions form the column space. If you ask the matrix to produce an output outside that space, no input vector can do it exactly.

Some input directions disappear. Those directions form the null space. If xx is in the null space of AA, then Ax=0Ax=0. Moving along that direction changes the coefficients but does not change the output.

The rank tells you how many independent output directions survive. If rank is low, the matrix has crushed the input space into a smaller output space. If a direction is almost crushed but not exactly zero, the matrix may still be full rank in exact algebra, but it can be numerically fragile. That is poor conditioning: tiny output perturbations can require huge changes in the input or coefficient vector.

This is why rank and conditioning sit underneath so much machine learning:

  • Least squares asks whether feature columns span the target direction well enough.
  • PCA and low-rank models ask which directions carry most variation.
  • Regularization damps directions that are poorly identified.
  • Numerical solvers become fragile when a matrix nearly loses a direction.

One sentence to carry through the page:

A matrix reaches its column space, hides its null space, and becomes unstable when a nearly hidden direction still has to be solved for.

02

02

Math

Translate the story into symbols, assumptions, and a derivation you can inspect.

Section prompt

Let

ARm×nA \in \mathbb{R}^{m \times n}

and define the linear map

T(x)=Ax,xRn.T(x)=Ax,\qquad x\in\mathbb{R}^n.

Write the columns of AA as

A=[a1,,an],aiRm.A=[a_1,\ldots,a_n],\qquad a_i\in\mathbb{R}^m.

The column space of AA is the set of all outputs the map can reach:

Col(A)=Im(T)={Ax:xRn}=span(a1,,an).\operatorname{Col}(A) =\operatorname{Im}(T) =\{Ax:x\in\mathbb{R}^n\} =\operatorname{span}(a_1,\ldots,a_n).

The rank is the dimension of that reachable output space:

rank(A)=dimCol(A).\operatorname{rank}(A)=\dim\operatorname{Col}(A).

The null space is the set of input directions that vanish:

Null(A)=ker(T)={xRn:Ax=0}.\operatorname{Null}(A) =\ker(T) =\{x\in\mathbb{R}^n:Ax=0\}.

Its dimension is the nullity:

nullity(A)=dimNull(A).\operatorname{nullity}(A)=\dim\operatorname{Null}(A).

Rank-nullity says that every input dimension either survives into the image or is lost in the kernel:

rank(A)+nullity(A)=n.\operatorname{rank}(A)+\operatorname{nullity}(A)=n.

For a square matrix ARn×nA\in\mathbb{R}^{n\times n}:

  • If rank(A)=n\operatorname{rank}(A)=n, the map has no nonzero null-space direction and is invertible.
  • If rank(A)<n\operatorname{rank}(A)<n, some nonzero direction disappears, so Ax=bAx=b cannot have a unique solution for every bb.

For rectangular matrices, "full rank" means

rank(A)=min(m,n).\operatorname{rank}(A)=\min(m,n).

That can still mean different things. A tall full-column-rank matrix has no nonzero null-space direction, but it cannot reach every vector in Rm\mathbb{R}^m. A wide full-row-rank matrix can reach every vector in Rm\mathbb{R}^m, but it has non-unique inputs because its null space is nontrivial.

Conditioning adds a numerical layer. Let the singular values of AA be

σ1σ2σr>0,\sigma_1\ge \sigma_2\ge \cdots \ge \sigma_r>0,

where r=rank(A)r=\operatorname{rank}(A). Singular values tell us how much AA stretches orthogonal input directions. A zero singular value is an exactly vanished direction. A tiny singular value is an almost vanished direction.

For a full-rank square matrix, the 2-norm condition number is

κ2(A)=σmax(A)σmin(A).\kappa_2(A)=\frac{\sigma_{\max}(A)}{\sigma_{\min}(A)}.

If σmin(A)=0\sigma_{\min}(A)=0, the matrix is singular and this ratio is infinite. If σmin(A)\sigma_{\min}(A) is merely tiny, the matrix may be exactly invertible but practically fragile.

That fragility appears when solving

Ax=b.Ax=b.

A small perturbation Δb\Delta b can produce a much larger change Δx\Delta x in the solution when AA has a tiny singular direction. In learning language: the predictions may barely change, but the coefficients can swing wildly. Regularization and SVD-based solvers handle this by damping or separating those fragile directions instead of pretending every direction is equally trustworthy.

Two caveats matter:

  1. Exact rank is a mathematical property. Numerical rank depends on a tolerance, the data scale, and floating-point precision.
  2. A large condition number is a sensitivity warning. It does not say every computation will fail; it says there are directions where small errors can be amplified.
03

03

Code

Keep the implementation aligned with the notation so the algorithm is legible.

Section prompt
import numpy as np

matrices = {
    "stable full rank": np.array([[1.0, 0.25], [0.0, 1.0]]),
    "ill-conditioned": np.array([[1.0, 1.00], [0.0, 0.02]]),
    "rank deficient": np.array([[1.0, 1.00], [0.0, 0.00]]),
}

x_true = np.array([1.0, -0.7])
noise = np.array([0.0, 1e-3])

for name, A in matrices.items():
    _, s, vh = np.linalg.svd(A)
    rank = np.linalg.matrix_rank(A, tol=1e-10)
    cond = np.inf if s[-1] < 1e-12 else s[0] / s[-1]
    hidden_direction = vh[-1]
    hidden_output = np.linalg.norm(A @ hidden_direction)
    b = A @ x_true
    b_noisy = b + noise

    x_hat, *_ = np.linalg.lstsq(A, b, rcond=None)
    x_noisy, *_ = np.linalg.lstsq(A, b_noisy, rcond=None)
    solution_change = np.linalg.norm(x_noisy - x_hat)

    print(f"\n{name}")
    print("singular values:", np.round(s, 6))
    print("rank:", rank, "condition:", cond)
    print("||A @ smallest-singular-vector||:", round(hidden_output, 6))
    print("solution change from tiny noise:", round(solution_change, 6))

The exact rank-deficient matrix has a true null-space direction: the smallest singular vector maps to zero. The ill-conditioned matrix is still full rank, but that same diagnostic is tiny, and the least-squares solution becomes much more sensitive to the same output perturbation.

04

04

Interactive Demo

Use direct manipulation to connect the explanation to a moving system.

Section prompt

Predict what kind of matrix you are seeing before revealing the diagnostics.

The left panel shows the input unit square. The right panel shows the same square after multiplication by AA. If the image stays like a healthy parallelogram, the matrix is stable full rank. If the parallelogram becomes a very thin sliver, the matrix is full rank but fragile. If it collapses onto a line, the matrix has lost rank.

After you commit a prediction, the reveal shows:

  • det(A)\det(A) as a 2D area signal
  • singular values σmax\sigma_{\max} and σmin\sigma_{\min}
  • the condition number κ2(A)\kappa_2(A)
  • a null or near-null input direction
  • how much a tiny output perturbation changes the recovered input

Live Concept Demo

Explore Rank, Null Space, Column Space, and Conditioning

The stage is code-native and interactive. Use it to test the explanation against the mechanism.

difficulty 3/5undergraduatecode-aligned
Demo Prediction Checkpoint

Manipulate one control and predict the visible change.

Commit to what Rank, Null Space, Column Space, and Conditioning should make visible before reading the result.

After The First Pass

Turn the concept into an inspected object.

Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.

Mechanism Storyboard

See the idea move before the page explains it

Rank says which outputs a matrix can reach, null space says which inputs disappear, and conditioning says how fragile those directions are numerically.

Prediction open01 / Intuition
Prediction lens

Start with the picture, metaphor, or geometric mechanism.

Commit first

Before reading further, choose the kind of change Rank, Null Space, Column Space, and Conditioning should make visible.

Visual Inquiry

Make the image answer a mathematical question

Rank says which outputs a matrix can reach, null space says which inputs disappear, and conditioning says how fragile those directions are numerically.

4/4 stages readyLive demo connected
Prediction

Which visible object should carry the first intuition?

Commit first

Pick the cue that should make Rank, Null Space, Column Space, and Conditioning easier to reason about before the page gives the answer.

Source Grounding

Canonical references for the mechanism on this page.

book · 2020Mathematics for Machine LearningDeisenroth, Faisal, and Ong

Primary source for rank, image/column space, kernel/null space, full rank, rank deficiency, rank-nullity, and SVD geometry.

Open source
book · 2016Deep Learning, Chapter 4: Numerical ComputationGoodfellow, Bengio, and Courville

Primary source for poor conditioning as rapid output change under small input perturbations and error amplification by matrix inversion.

Open source
documentation · 2026NumPy linear algebra reference: matrix_rank and condNumPy Developers

Documentation source for practical numerical-rank tolerance and condition-number helpers used in the runnable witness.

Open source

Claim Review

Rank says which outputs a matrix can reach, null space says which inputs disappear, and conditioning says how fragile those directions are numerically.

Status1 substantive review recorded

Claims without a substantive review badge still need exact source-support review.

Sources3 references

deisenroth-2020-mml-rank-nullity, goodfellow-2016-deep-learning-poor-conditioning, numpy-linalg-rank-cond-docs

Witnesses4 local objects

Use equation, code, and demo objects to check whether the source support is operational.

Substantively reviewedRank counts reachable independent output directions, nullity counts input directions that vanish, rank plus nullity equals the input dimension, and poor conditioning makes solves sensitive to tiny perturbations.Claim metadata: source checked

The page combines exact subspace facts from MML with the Deep Learning Book's numerical-conditioning warning, then uses NumPy's documented SVD-based helpers only for practical floating-point diagnostics.

Sources: Mathematics for Machine Learning, Deep Learning, Chapter 4: Numerical Computation, NumPy linear algebra reference: matrix_rank and condExact rank is algebraic, while numerical rank depends on tolerance. A large condition number is a sensitivity warning, not proof that every output or every solver will fail.A bounded review summary is present; still check caveats and exact source scope.

MML pages 53 and 64-66 support rank, column space/image, kernel/null space, full-rank/rank-deficient language, and rank-nullity. MML SVD sections support singular-value geometry. Deep Learning Book section 4.2 supports poor conditioning as sensitivity to small input perturbations and intrinsic error amplification.

Reviewer: codex-source-excerpt-audit; reviewed 2026-06-28

Practice Loop

Try the idea before it explains itself

Rank says which outputs a matrix can reach, null space says which inputs disappear, and conditioning says how fragile those directions are numerically.

Readiness0/3 checks ready
Predict

Before touching the demo, predict one visible change that should happen in Rank, Null Space, Column Space, and Conditioning.

Hint 1

Reveal when your model needs a nudge.

Hint 2

Reveal when your model needs a nudge.

Hint 3

Reveal when your model needs a nudge.

Object research drawerClose
ConceptRank, Null Space, Column Space, and ConditioningLinear Algebra
Code witness comparisonRank, Null Space, Column Space, and Conditioning code witness 1matrices = {Prediction before revealRank, Null Space, Column Space, and Conditioning interactive demoManipulate one control and predict the visible change.
Grounded room questionWhat is the smallest example that makes Rank, Null Space, Column Space, and Conditioning click without losing the math?Local snapshot ready

Research Room

Attach the question to an exact object

Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.
Next local actionNo local draft saved yet

Open the draft below to save one note and next action in this browser.

conceptLinear Algebra

Rank, Null Space, Column Space, and Conditioning

Anchored question

What is the smallest example that makes Rank, Null Space, Column Space, and Conditioning click without losing the math?

Local action draftNo local draft saved yetExpand only when ready to capture one local next action
Local action draft

This draft stays locally in this browser for concept:linear-algebra/rank-null-column-space-conditioning.

No local draft saved.
Evidence to inspect
  • Source ids to inspect: deisenroth-2020-mml-rank-nullity, goodfellow-2016-deep-learning-poor-conditioning, numpy-linalg-rank-cond-docs
  • Definition, prerequisite, and contrast concept links
  • The equation or code witness that makes the concept operational
  • One demo state that shows the invariant instead of a slogan
What would resolve this
  • The learner can state the mechanism in their own words
  • The learner can name the prerequisite that would repair confusion
  • The learner can predict how the mechanism changes under one perturbation
Grounded AI handoff

I am working in Continuous Function's research reading room. Object: concept - Rank, Null Space, Column Space, and Conditioning Object key: concept:linear-algebra/rank-null-column-space-conditioning Context: Linear Algebra Anchor id: concept/concept-notebook/linear-algebra/rank-null-column-space-conditioning Open question: What is the smallest example that makes Rank, Null Space, Column Space, and Conditioning click without losing the math? Evidence to inspect: - Source ids to inspect: deisenroth-2020-mml-rank-nullity, goodfellow-2016-deep-learning-poor-conditioning, numpy-linalg-rank-cond-docs - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.

Open source object
concept/concept-notebook/linear-algebra/rank-null-column-space-conditioning concept:linear-algebra/rank-null-column-space-conditioning