Linear Algebra, Live
Strang §3.3 · The complete solution to Ax = b

Solving Ax = b completely: one solution plus the nullspace

Slide 3 found every input that does nothing. Now the right side is a real target b. Think of walking to the bakery. You know one route that gets you there. Before you leave, add any stroll that brings you back to your own door, and you still end up at the bakery. Those strolls are the nullspace vectors. So once you have one solution, the particular solution x_p, every solution is x_p plus a nullspace vector. That is the complete solution. And if the bakery can't be reached at all, because b is not in the column space, there is no solution.

Lesson 4 · slide 4Complete solution
x = x_p + x_null     Ax_p = b,   Ax_null = 0
Key ideas
  1. If Ax_p = b, then every solution is x = x_p + x_null with x_null in N(A).
  2. Ax = b is solvable exactly when b is in the column space C(A).
  3. To find x_p, eliminate on [A | b], set all free variables to 0 and read off the pivot variables.
  4. The four cases on this slide show how r, m and n decide what can happen: 0, 1 or infinitely many solutions.

One route plus a loop

Take A = 1224 from slide 2 and b = 48. One solution is easy to see: x_p = 40, four of column 1. Now add the nullspace vector −21:

x = 40 + −21 = 21  →  Ax = 2 + 24 + 4 = 48 ✓

Add it twice and you get 02, another solution: two of column 2.

x = 02: no column 1, two of column 2. It reaches the same b = 48 as x_p = 40 does. Two different inputs, one output.

Why every solution has this form

  • Adding a nullspace vector keeps a solution: A(x_p + x_null) = Ax_p + Ax_null = b + 0 = b.
  • Any two solutions differ by a nullspace vector: if Ax = b and Ay = b, then A(x − y) = b − b = 0. Check: 02 − 40 = −42 = 2·−21 ✓

So the solutions form a line parallel to N(A), shifted to pass through x_p. In the row picture from lesson 2 you can see that line directly:

x + 2y = 4 and 2x + 4y = 8 draw the same line, one on top of the other. Every point on it is a solution: 40, 21, 02 and more.

The nullspace is the parallel line x + 2y = 0 through the origin. Slide the nullspace over by x_p and you get the solution line.

How to find x_p

Write b as an extra column after A, with a bar between them: [A | b]. This is the augmented matrix from lesson 2. Row operations act on whole rows, so they change the b column too.

1. Eliminate on [A | b] until the part before the bar is R.
2. A row of zeros before the bar with a nonzero number after it says 0 = that number. Then there is no solution.
3. Otherwise set every free variable to 0. Each nonzero row now says: its pivot variable = the number after the bar. That is x_p.

For our A and b = 48: row 2 − 2·row 1 turns 24|8 into 00|0, leaving 12|4. The free variable is x₂. Set x₂ = 0, then x₁ = 4, so x_p = 40. With N(A) = all c·−21:

x = 40 + c·−21 = 4 − 2cc
c = 2: x = 02. Check: 0 + 2·2 = 4 and 0 + 4·2 = 8 ✓

When there is no solution

Change b to 412. Row 2 − 2·row 1 gives 0 = 12 − 2·4 = 4. Impossible. b = 412 is not a multiple of 12, so it is off the column space line.

x + 2y = 4 and 2x + 4y = 12 (that is, x + 2y = 6) are parallel lines. They never cross, so no x solves both.

Keep reading with the full course

Finish lesson 4 and you will be able to: write down every solution of Ax = b, not just one.

Still locked here:

  • The rest of this explanation
  • 4 more examples with step-by-step solutions
  • Five extra members-only problems with worked solutions

$20 once, lifetime access. Lessons 1 to 3 stay free.

Examples

Example 1 · One equation, two unknowns

x + y = 2.

Show solutionHide solution
x_p = 20; N(A) = multiples of −11
x = 2 − cc
Exercise Find a different solution of Ax = b, not (4, 0). Edit the code and press Run.
slide_4.py Loading Python…
1
Output · Ctrl+Enter runs
Press Run to execute this slide's code. Ctrl+Enter works too.

Questions and comments

Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.

The full course

From Ax = b to PCA, by running it

Lessons 1 to 3 are free. Finish all eight and you will be able to:

You get: all 8 lessons with Python labs · every worked example and solution · 5 extra problems per lesson · your progress tracked · answers to your questions · every future update.

$20 once · lifetime access
Continue to checkout →

Already a member? Log in to the course