BetaFree coursewareRewritten from MIT OpenCourseWareCC BY-NC-SA 4.0
Open CosmologyPhysics & cosmology, from high school to a graduate year

Solving Ax = b: the complete solution

Elimination on the augmented matrix [A b] decides whether Ax = b has a solution and finds all of them. For the matrix of Lecture 7, whose third row is the sum of the first two, the zero row of U turns into the condition b₃ − b₂ − b₁ = 0: if a combination of the rows gives the zero row, the same combination of the entries of b must give 0, which is the same as saying b is in the column space. A particular solution comes from setting the free variables to 0 and solving for the pivot variables: for b = (1, 5, 6), x_p = (−2, 0, 3/2, 0). The complete solution is x_p plus anything in the nullspace, because A(x_p + x_n) = b + 0; here it is a two-dimensional flat surface in R⁴ that misses the origin. The rank r of an m × n matrix satisfies r ≤ m and r ≤ n. With full column rank (r = n) there are no free variables and 0 or 1 solutions; with full row rank (r = m) every b has a solution, with n − m free variables; when r = m = n the matrix is invertible and R = I; and when r is less than both, there are 0 or infinitely many solutions. The rank tells the number of solutions.

You need this first

Full reading path (12 pages)
  1. Vectors (8.01)
  2. Vectors and the dot product (18.02)
  3. Determinants and the cross product (18.02)
  4. Planes through three points, and matrices (18.02)
  5. Equations of planes and square systems (18.02)
  6. The geometry of linear equations (18.06)
  7. Elimination with matrices (18.06)
  8. Matrix multiplication and inverse matrices (18.06)
  9. Factorization into A = LU (18.06)
  10. Transposes, permutations and vector spaces (18.06)
  11. Column space and nullspace (18.06)
  12. Solving Ax = 0: pivot variables and special solutions (18.06)
On this page · 4 sections
  1. When is there a solution?
  2. The complete solution
  3. Rank and the number of solutions
  4. Summary

This is the lecture where linear equations are solved completely: decide whether Ax=bAx = b has a solution, and if so, find them all (transcript, p. 1). It continues solving Ax = 0 with the same matrix.

When is there a solution?#

The matrix of the last lecture has rows (1,2,2,2)(1, 2, 2, 2), (2,4,6,8)(2, 4, 6, 8) and (3,6,8,10)(3, 6, 8, 10); the third row is the sum of the first two (transcript, p. 1). So the third left-hand side is the sum of the first two, and b3b_3 must be b1+b2b_1 + b_2: with b1=1b_1 = 1 and b2=5b_2 = 5, only b3=6b_3 = 6 works, and (1,5,17)(1, 5, 17) would have no solution (p. 1). Elimination discovers this. Work on the augmented matrix [A    b][A\;\;b], doing to bb what is done to the rows (p. 2):

Elimination on [A b] (last column: the right-hand side)
(1222b12468b236810b3)→(1222b10024b2−2b10000b3−b2−b1)\begin{pmatrix} 1 & 2 & 2 & 2 & b_1 \\ 2 & 4 & 6 & 8 & b_2 \\ 3 & 6 & 8 & 10 & b_3 \end{pmatrix} \to \begin{pmatrix} 1 & 2 & 2 & 2 & b_1 \\ 0 & 0 & 2 & 4 & b_2 - 2b_1 \\ 0 & 0 & 0 & 0 & b_3 - b_2 - b_1 \end{pmatrix}
In words

1 2 2 2 b one; 2 4 6 8 b two; 3 6 8 10 b three goes to 1 2 2 2 b one; 0 0 2 4 b two minus 2 b one; 0 0 0 0 b three minus b two minus b one

The last equation says 0=b3−b2−b10 = b_3 - b_2 - b_1, the condition for solvability (pp. 2–3). For b=(1,5,6)b = (1, 5, 6) the right side becomes (1,3,0)(1, 3, 0), and the last equation is 0=00 = 0 (p. 3).

Two ways to say when Ax=bAx = b is solvable (pp. 3–4):

  • bb is in the column space C(A)C(A): bb is a combination of the columns (p. 3);
  • if a combination of the rows of AA gives the zero row, the same combination of the entries of bb gives 0 (p. 4).

They are equivalent, though not obviously so, because both are equivalent to solvability (p. 4).

The complete solution#

Step 1, a particular solution (transcript, p. 5). Set all free variables to zero and solve for the pivot variables. Here x2=x4=0x_2 = x_4 = 0, leaving x1+2x3=1x_1 + 2x_3 = 1 and 2x3=32x_3 = 3, so x3=32x_3 = \frac32 and x1=−2x_1 = -2 (pp. 5–6):

A particular solution
xp=(−203/20)x_p = \begin{pmatrix} -2 \\ 0 \\ 3/2 \\ 0 \end{pmatrix}
In words

x sub p equals minus 2; 0; 3 over 2; 0

Strang urges checking it in the original equations (p. 6): −2+3=1-2 + 3 = 1, −4+9=5-4 + 9 = 5, −6+12=6-6 + 12 = 6.

Step 2, add the nullspace (pp. 6–7). Any xnx_n with Axn=0Ax_n = 0 can be added, since (p. 7)

Particular plus nullspace
Axp=b,Axn=0  ⇒  A(xp+xn)=b+0=bA x_p = b, \quad A x_n = 0 \;\Rightarrow\; A(x_p + x_n) = b + 0 = b
In words

capital A x sub p equals b, capital A x sub n equals 0 which gives capital A the quantity x sub p plus x sub n, equals b plus 0 equals b

This pattern turns up throughout mathematics, wherever equations are linear (p. 6). With the special solutions of Lecture 7 (pp. 7–8):

The complete solution
xcomplete=(−203/20)+c1(−2100)+c2(20−21)x_{\text{complete}} = \begin{pmatrix} -2 \\ 0 \\ 3/2 \\ 0 \end{pmatrix} + c_1\begin{pmatrix} -2 \\ 1 \\ 0 \\ 0 \end{pmatrix} + c_2\begin{pmatrix} 2 \\ 0 \\ -2 \\ 1 \end{pmatrix}
In words

x complete equals minus 2; 0; 3 over 2; 0 plus c one minus 2; 1; 0; 0 plus c two 2; 0; minus 2; 1

There is no free constant in front of xpx_p: A(3xp)=3bA(3x_p) = 3b, not bb. The nullspace part is a whole subspace (p. 8). (Strang recalls the special solutions on the spot and slightly misquotes the first equation while checking them; the values above are the ones from Lecture 7.)

The picture (pp. 9–10). xx has four components, so the picture lives in R4\mathrm{R}^4. The nullspace is a two-dimensional subspace (two free constants), and the solutions are that flat surface shifted to pass through xpx_p: flat like a subspace, but not containing zero, so not a subspace (pp. 9–10).

Rank and the number of solutions#

Now any m×nm \times n matrix of rank rr, the number of pivots (transcript, p. 10). There can be no more pivots than rows, and none than columns, since a row or column holds at most one pivot (pp. 10–11):

Bounds on the rank
r≤m,r≤nr \le m, \qquad r \le n
In words

r is less than or equal to m, r is less than or equal to n

Full column rank, r=nr = n (pp. 11–15). A pivot in every column, no free variables, so N(A)N(A) is only the zero vector, and x=xpx = x_p is the unique solution if it exists: 0 or 1 solutions (pp. 11–12). Many applications are like this (p. 12). The example is tall and thin (p. 13):

Full column rank
A=(13216151),R=(10010000)A = \begin{pmatrix} 1 & 3 \\ 2 & 1 \\ 6 & 1 \\ 5 & 1 \end{pmatrix}, \qquad R = \begin{pmatrix} 1 & 0 \\ 0 & 1 \\ 0 & 0 \\ 0 & 0 \end{pmatrix}
In words

capital A equals 1 3; 2 1; 6 1; 5 1, capital R equals 1 0; 0 1; 0 0; 0 0

Four equations in two unknowns usually have no solution. But b=(4,3,7,6)b = (4, 3, 7, 6), the sum of the two columns, has exactly one: x=(1,1)x = (1, 1) (pp. 14–15).

Full row rank, r=mr = m (pp. 15–17). A pivot in every row, so elimination produces no zero rows and puts no condition on bb: Ax=bAx = b is solvable for every bb (p. 15). There are n−r=n−mn - r = n - m free variables (p. 16). The example is the transpose of the last one, with rows (1,2,6,5)(1, 2, 6, 5) and (3,1,1,1)(3, 1, 1, 1): rank 2, pivots in columns 1 and 2, and RR has the identity in those columns and a free part FF beside it, with no zero rows (pp. 16–17).

Full rank, r=m=nr = m = n (pp. 17–18). The matrix is square and invertible, like (1231)\begin{pmatrix} 1 & 2 \\ 3 & 1 \end{pmatrix}; its reduced form is R=IR = I, its nullspace is only zero, every bb is allowed, and the solution is unique (pp. 17–18).

The four cases
r=m=nR=I1 solutionr=n<mR=(I0)0 or 1 solutionr=m<nR=(IF)∞ solutionsr<m,  r<nR=(IF00)0 or ∞ solutions\begin{array}{ccc} r = m = n & R = I & \text{1 solution} \\ r = n < m & R = \begin{pmatrix} I \\ 0 \end{pmatrix} & \text{0 or 1 solution} \\ r = m < n & R = \begin{pmatrix} I & F \end{pmatrix} & \infty \text{ solutions} \\ r < m,\; r < n & R = \begin{pmatrix} I & F \\ 0 & 0 \end{pmatrix} & 0 \text{ or } \infty \text{ solutions} \end{array}
In words

c c c r equals m equals n capital R equals capital I 1 solution; r equals n less than m capital R equals capital I; 0 0 or 1 solution; r equals m less than n capital R equals capital I F infinity solutions; r less than m, r less than n capital R equals capital I F; 0 0 0 or infinity solutions

When r=m<nr = m < n, the II and FF may be interleaved if the pivot columns do not come first (p. 19). (Strang first labels the row with R=(I0)R = \begin{pmatrix} I \\ 0 \end{pmatrix} and 0 or 1 solution as r=m<nr = m < n, then corrects it to r=n<mr = n < m; for r=m<nr = m < n he first says one or infinitely many, then settles on infinitely many, since there is always a nullspace, pp. 18–19.) The rank tells everything about the number of solutions; only the actual entries need the matrix itself (p. 20).

Worked example

A complete solution of your own

For B=(130226171328)B = \begin{pmatrix} 1 & 3 & 0 & 2 \\ 2 & 6 & 1 & 7 \\ 1 & 3 & 2 & 8 \end{pmatrix} (the example of the last page): (a) find the condition on bb for Bx=bBx = b to be solvable; (b) solve Bx=(1,4,5)Bx = (1, 4, 5) completely.

(a) The condition

Eliminating: row 2 becomes (0,0,1,3)(0, 0, 1, 3) with right side b2−2b1b_2 - 2b_1; row 3 becomes (0,0,2,6)(0, 0, 2, 6) with right side b3−b1b_3 - b_1, and then a zero row with right side b3−b1−2(b2−2b1)=b3−2b2+3b1b_3 - b_1 - 2(b_2 - 2b_1) = b_3 - 2b_2 + 3b_1. So Bx=bBx = b is solvable exactly when b3=2b2−3b1b_3 = 2b_2 - 3b_1. Indeed row 3 of BB is 2(row 2)−3(row 1)2(\text{row } 2) - 3(\text{row } 1).

(b) Particular solution

b=(1,4,5)b = (1, 4, 5) passes: 2⋅4−3=52 \cdot 4 - 3 = 5. The right side becomes (1,2,0)(1, 2, 0). With x2=x4=0x_2 = x_4 = 0: x1=1x_1 = 1 and x3=2x_3 = 2, so xp=(1,0,2,0)x_p = (1, 0, 2, 0). Check: Bxp=(1,2+2,1+4)=(1,4,5)B x_p = (1, 2 + 2, 1 + 4) = (1, 4, 5).

(b) Complete solution

Add the special solutions found before: x=(1,0,2,0)+c1(−3,1,0,0)+c2(−2,0,−3,1)x = (1, 0, 2, 0) + c_1(-3, 1, 0, 0) + c_2(-2, 0, -3, 1). The rank 2 is less than both m=3m = 3 and n=4n = 4, the "0 or infinitely many" case; this bb gives infinitely many.

Summary#

Symbols on this page

Show the 32 symbols used here
∞\infty infinity.
Infinity: larger than any number. Say it: “infinity”.
≤\le less than or equal.
Is less than or equal to. Say it: “is less than or equal to”.
≠\neq not equal.
Is not equal to. Say it: “is not equal to”.
→\to arrow.
Goes to (tends to), or becomes. Say it: “goes to”.
⇒\Rightarrow implies.
Implies: what follows is a consequence of what came before. Say it: “which gives”.
×\times times.
Times (multiplication). Between two vectors: the cross product. Say it: “times”.
⋅\cdot dot.
Times (multiplication). Between two vectors: the dot product. Say it: “times”.
cc c.
A number multiplying the particular solution, in A(cxₚ) = cb. Say it: “c”.
xx x.
The vector of unknowns. Say it: “x”.
nn n.
The number of columns (unknowns). Say it: “n”.
mm m.
The number of rows (equations). Say it: “m”.
FF F.
The free part of R. Say it: “F”.
rr r.
The rank: the number of pivots. Say it: “r”.
AA A.
The matrix of the system; first the 3 × 4 matrix of Lecture 7, then the examples of each rank case. Say it: “capital A”.
BB B.
The 3 × 4 matrix of the worked example. Say it: “capital B”.
CC C.
As in C(A): the column space of A. Say it: “capital C”.
bb b.
The right-hand side vector. Say it: “b”.
NN N.
As in N(A): the nullspace of A. Say it: “capital N”.
RR R.
The reduced row echelon form. Say it: “capital R”.
x1x_{1} x 1.
The first unknown (a pivot variable). Say it: “x one”.
x2x_{2} x 2.
The second unknown (a free variable). Say it: “x two”.
x4x_{4} x four.
The fourth unknown (a free variable). Say it: “x four”.
xnx_{n} x n.
Any vector in the nullspace: Axₙ = 0. Say it: “x sub n”.
x3x_{3} x three.
The third unknown (a pivot variable). Say it: “x three”.
II I.
An identity matrix, in the pivot rows and columns of R. Say it: “capital I”.
c1c_{1} c one.
The multiple of the first special solution. Say it: “c one”.
c2c_{2} c two.
The multiple of the second special solution. Say it: “c two”.
b1b_{1} b 1.
The first component of the right-hand side b. Say it: “b one”.
b2b_{2} b 2.
The second component of the right-hand side b. Say it: “b two”.
b3b_{3} b 3.
The third component of the right-hand side b. Say it: “b three”.
xpx_{p} x sub p.
A particular solution of Ax = b (free variables set to 0). Say it: “x sub p”.
xcompletex_{\text{complete}} x complete.
The complete solution of Ax = b: a particular solution plus the whole nullspace. Say it: “x complete”.

Tap or click a symbol in a formula to see the same explanation. All symbols: symbols and notation.

Words on this page

Show the 20 words used here

New here

full rank.
Of a matrix: having rank as large as its size allows; full column rank means independent columns, full row rank independent rows.

Also used

linear.
Of a map, operator or equation: respecting sums and multiples, so that L(au + bv) = aL(u) + bL(v). Explained in The geometry of linear equations.
p..
Page, in a reference to a source; pp. means pages, as in pp. 3–5.
matrix.
A rectangular table of numbers, which acts on vectors to give new ones and so describes a linear change of coordinates. Explained in Planes through three points, and matrices.
elimination.
Solving equations by subtracting multiples of one from another until each unknown can be found in turn. Explained in The geometry of linear equations.
augmented matrix.
A matrix with an extra column, the right-hand side b, added to it, so that elimination works on the equations and b together. Explained in Elimination with matrices.
column space.
All the vectors made by combining the columns of a matrix; Ax = b can be solved exactly when b lies in it. Explained in Matrix multiplication and inverse matrices.
particular solution.
Any one solution of the full equation, input term included; adding the complementary solution gives all the others. Explained in Inhomogeneous equations, particular solutions and stability.
free variable.
An unknown whose column has no pivot, so it can be given any value; the other unknowns are then fixed by the equations.
pivot variable.
An unknown whose column has a pivot; once the free variables are chosen, the pivot variables are found by back substitution. Explained in Solving Ax = 0: pivot variables and special solutions.
nullspace.
All the vectors x that a matrix sends to zero, that is, all solutions of Ax = 0. Explained in Column space and nullspace.
special solution.
A solution of Ax = 0 found by setting one free variable to 1 and the others to 0; together they build every solution. Explained in Solving Ax = 0: pivot variables and special solutions.
subspace.
A set of vectors inside a larger space that is a space itself: sums and multiples of its vectors stay inside it. Explained in Transposes, permutations and vector spaces.
rank.
The number of independent columns of a matrix, which always equals the number of independent rows. Explained in Similar matrices and the Jordan form.
pivot.
In elimination, the first nonzero number in a row, used to clear out the entries below it. Explained in Positive definite matrices and minima.
zero vector.
The vector whose components are all zero; adding it to any vector changes nothing. Explained in Transposes, permutations and vector spaces.
transpose.
The matrix made by writing the rows of a matrix as columns, flipping it across its main diagonal. Explained in Planes through three points, and matrices.
invertible.
Of a square matrix or operator: having an inverse that undoes it; for a matrix this happens exactly when its determinant is not zero. Explained in The geometry of linear equations.
pivot column.
A column of a matrix that contains a pivot after elimination; the matching columns of the original matrix form a basis for its column space. Explained in Column space and nullspace.

Academic

transcript.
A written record of exactly what was said in a recorded lecture, word for word.

Tap or click a word, here or in the text, for its meaning in this lesson. All words: the glossary. How many words are marked in the text: Reading options (the “Aa” button).

Where this leads

In cosmology

31 more cosmology pages that build on this

Pages that build on this

Practise

Check your understanding

  1. Why can the particular solution not be multiplied by an arbitrary constant, as nullspace vectors can?
  2. A 5×35 \times 3 matrix has rank 3. How many solutions can Ax=bAx = b have?
  3. For which matrices does Ax=bAx = b have a solution for every bb?
0 of 3 answered

Flashcards

1 / 3