← Visualization Hub
Linear Systems

Solving \(A\mathbf x=\mathbf b\) — the Complete Solution

Not every system has one answer. Some have none, some have infinitely many. The four subspaces tell you which — and the complete solution always splits the same way: one particular solution in the row space, plus anything in the null space.

1The big picture — after Strang

The four fundamental subspaces, redrawn from Gilbert Strang’s original Big Picture.

The four subspaces and the solutions of Ax=b: x_r in the row space and x=x_r+x_n both map to the same b in the column space; x_n in the null space maps to the output origin zero. The row space and null space are orthogonal complements in R^n, with dimensions r and n minus r. The column space and the left null space of A transpose are orthogonal complements in R^m, with dimensions r and m minus r.
Swipe to explore the diagram View full-size diagram
A sends the whole row space one-to-one onto the column space; it sends the entire null space to the single point 0.
The pairs are orthogonal complements: \(C(A^{\mathsf T})\) \(\perp\) \(N(A)\) fill \(\mathbb R^n\)  ·  \(C(A)\) \(\perp\) \(N(A^{\mathsf T})\) fill \(\mathbb R^m\)  ·  \(r+(n-r)=n\),   \(r+(m-r)=m\).
Recreated from the supplied original “Big Picture” diagram. See Gilbert Strang’s four-subspaces overview in MIT OpenCourseWare.

2The complete solution

Particular + null: one point that hits b, plus every direction that hits 0.

To solve \(A\mathbf x=\mathbf b\), find one solution \(\mathbf x_r\) (the particular solution), then add anything the matrix sends to zero. Every vector in the null space can be added without changing \(A\mathbf x\), because \(A(\mathbf x_r+\mathbf x_n)=A\mathbf x_r+A\mathbf x_n=\mathbf b+\mathbf 0=\mathbf b\).

$$\begin{gathered} \mathbf x=\textcolor{#f0883e}{\mathbf x_r}+\textcolor{#f85149}{\mathbf x_n}\\[2pt] A\,\textcolor{#f0883e}{\mathbf x_r}=\textcolor{#58a6ff}{\mathbf b}, \qquad \textcolor{#f85149}{\mathbf x_n}\in N(A) \end{gathered}$$

Three outcomes, decided by the rank \(r\) (with \(A\) an \(m\times n\) matrix):

$$\begin{aligned} r=n,\ \mathbf b\in C(A)\quad &\Longrightarrow\quad \text{exactly one solution}\quad(N(A)=\{\mathbf 0\})\\ r<n,\ \mathbf b\in C(A)\quad &\Longrightarrow\quad \text{infinitely many}\quad(\mathbf x_r+\text{any null vector})\\ \mathbf b\notin C(A)\quad &\Longrightarrow\quad \text{no solution}\quad(\text{the system is inconsistent}) \end{aligned}$$

The particular solution can always be chosen inside the row space — that is the unique minimum-norm solution, the one the picture above draws as \(\mathbf x_r\).

3Drag the input — watch \(\mathbf b=A\mathbf x\) respond

Move \(\mathbf x\) on the left; the output \(\mathbf b=A\mathbf x\) answers on the right in real time.

\(\mathbb R^2\) inputs — drag \(\mathbf x\)
\(A\)
→
\(\mathbb R^2\) outputs — \(\mathbf b=A\mathbf x\)

4Solve a \(3\times3\) system yourself

Type any \(A\) and \(\mathbf b\) (or pick a preset). The solver runs elimination and reports the complete solution.

\(A\)
\(\mathbf x\) = \(\mathbf b\)
Robotics: with \(A\) a Jacobian \(J\) and \(\mathbf b\) a desired end-effector velocity, this is inverse kinematics. No solution = the task leaves the reachable set (past a singularity); infinitely many = a redundant arm, free to pick the joint motion that also does something useful (avoid a limit, stay clear of an obstacle) using the null-space term.

5See the null space in 3D — a \(4\times4\) with two free columns

Rank 2 ⇒ 2 pivot columns + 2 free columns. The null space is a whole 2-D plane, and the complete solution of \(A\mathbf x=\mathbf b\) is a parallel plane. (\(\mathbb R^4\) is shown in a symmetric 3-D projection — drag with mouse or one finger to orbit · scroll or pinch to zoom.)

drag / one finger: orbit · scroll / pinch: zoom
\(x_1\) axis \(x_2\) axis \(x_3\) axis \(x_4\) axis null plane solution plane

\(A\) (reduced) — 2 pivots, 2 free

pivotfreepivotfree
\(r=2\) · nullity \(=2\)
\(\mathbf n_1=(-2,1,0,0)\)  [free \(x_2=1\)]
\(\mathbf n_2=(1,0,-2,1)\)  [free \(x_4=1\)]

Move along the null plane

0.6
-0.4

Show

Why a plane? Two free columns mean two independent directions (\(\mathbf n_1\), \(\mathbf n_2\)) that \(A\) sends to \(\mathbf 0\). Every point on the green null plane solves \(A\mathbf x=\mathbf 0\); slide it to the particular solution \(\mathbf x_p\) and the whole plane lifts to the solution set of \(A\mathbf x=\mathbf b\) — while \(A\mathbf x\) stays equal to \(\mathbf b\) the entire time.

6A genuine 3-D case — \(3\times3\), rank 2

No projection this time. 2 pivots + 1 free column ⇒ the null space is a line, and the complete solution of \(A\mathbf x=\mathbf b\) is a line parallel to it through the particular solution. Drag to orbit.

input \(\mathbb R^3\) (domain) — where \(\mathbf x\) lives
drag with mouse or one finger to orbit · scroll or pinch to zoom
row space (plane) null space (line) solution line \(\mathbf x_p\) \(\mathbf x\)
output \(\mathbb R^3\) (codomain) — the column space
drag with mouse or one finger to orbit · scroll or pinch to zoom
column space \(C(A)\) \(\mathbf c_1=(1,0,1)\) \(\mathbf c_2=(2,1,3)\) \(\mathbf c_3\) (dependent) left null (line) \(\mathbf b\)

\(A\) — 2 pivots, 1 free

pivotpivotfree
\(r=2\) · nullity \(=1\)
\(\mathbf n=(2,-1,1)\)  [free \(x_3=1\)]
\(\mathbf b=(1,0,1)\)

Move along the solution line

0.5

Show

Read it: the green solution line misses the origin (\(\mathbf b\neq\mathbf 0\)) — it is the particular solution \(\mathbf x_p\) plus the whole red null line. Every point on it satisfies \(A\mathbf x=\mathbf b=(1,0,1)\). Elimination hands you \(\mathbf x_p=(1,0,0)\) by setting the free variable to zero, and that point is not the shortest one: \(\mathbf x_p\cdot\mathbf n=2\neq0\), so it still carries a null-space component. The row-space plane is perpendicular to the null line, and the minimum-norm solution \(\tfrac13(1,1,-1)\) is the single point where the green line pierces that plane.

7And when there is no solution?

The third outcome from §2 — \(\mathbf b\notin C(A)\) — needs a different idea.

Everything above assumed \(A\mathbf x=\mathbf b\) was consistent. Elimination told us so: no row ever read [0 0 0 | nonzero]. But in real data that row shows up constantly — more equations than unknowns, and \(\mathbf b\) sitting off the column space. Then the solution set is genuinely empty: no \(\mathbf x\) whatsoever satisfies every equation.

\[\mathbf b\notin C(A)\;\Longrightarrow\;\text{no exact }\mathbf x\qquad\text{so instead solve}\qquad A^{\mathsf T}A\,\hat{\mathbf x}=A^{\mathsf T}\mathbf b\]

The fix is to stop demanding \(A\mathbf x=\mathbf b\) and ask for the closest reachable point: project \(\mathbf b\) straight down onto the column space and solve there. That projection is exactly the geometry of §1 read in the output space — and it turns an unsolvable system into a solvable one.

▶ Continue: Projection & Least Squares — the projection matrix \(P=A(A^{\mathsf T}A)^{-1}A^{\mathsf T}\) and a live best-fit line