Math Core

Lesson 1.4 · Systems of Linear Equations

The matrix equation Ax = b

You have now seen the same problem in two costumes: a system of equations and a vector equation. A third notation, the matrix equation Ax=bA\mathbf{x} = \mathbf{b}, packages both into a single compact statement. It also reframes the question "does this system have a solution?" as "which vectors b\mathbf{b} can the matrix AA produce?"

The product of a matrix and a vector

Definition

Matrix-vector product

If AA is an m×nm \times n matrix with columns a1,…,an\mathbf{a}_1, \dots, \mathbf{a}_n, and x\mathbf{x} is a vector in Rn\mathbb{R}^n, then

Ax=[a1a2⋯an][x1x2⋮xn]=x1a1+x2a2+⋯+xnan.A\mathbf{x} = \begin{bmatrix} \mathbf{a}_1 & \mathbf{a}_2 & \cdots & \mathbf{a}_n \end{bmatrix}\begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix} = x_1\mathbf{a}_1 + x_2\mathbf{a}_2 + \cdots + x_n\mathbf{a}_n.

AxA\mathbf{x} is defined only when the number of columns of AA equals the number of entries in x\mathbf{x}, and the result lies in Rm\mathbb{R}^m.

So AxA\mathbf{x} is a linear combination of the columns of AA, with the entries of x\mathbf{x} as weights. For example,

[12−10−53][437]=4[10]+3[2−5]+7[−13]=[36].\begin{bmatrix} 1 & 2 & -1 \\ 0 & -5 & 3 \end{bmatrix}\begin{bmatrix} 4 \\ 3 \\ 7 \end{bmatrix} = 4\begin{bmatrix} 1 \\ 0 \end{bmatrix} + 3\begin{bmatrix} 2 \\ -5 \end{bmatrix} + 7\begin{bmatrix} -1 \\ 3 \end{bmatrix} = \begin{bmatrix} 3 \\ 6 \end{bmatrix}.

For hand computation there is a faster way to organize the same arithmetic. Entry ii of AxA\mathbf{x} collects the ii-th entry of each column times its weight, which is the sum of products of row ii of AA with the entries of x\mathbf{x}:

Row-vector rule

The ii-th entry of AxA\mathbf{x} is ai1x1+ai2x2+⋯+ainxna_{i1}x_1 + a_{i2}x_2 + \cdots + a_{in}x_n, the sum of the products of the entries in row ii of AA with the corresponding entries of x\mathbf{x}.

In the example, row 1 gives 1(4)+2(3)−1(7)=31(4) + 2(3) - 1(7) = 3 and row 2 gives 0(4)−5(3)+3(7)=60(4) - 5(3) + 3(7) = 6. Keep both viewpoints: the row rule for computing, the column rule for thinking.

Three equivalent formulations

With the definition in hand, the system

x1+2x2−x3=4−5x2+3x3=1\begin{aligned} x_1 + 2x_2 - x_3 &= 4 \\ -5x_2 + 3x_3 &= 1 \end{aligned}

is the vector equation x1[10]+x2[2−5]+x3[−13]=[41]x_1\begin{bmatrix} 1 \\ 0 \end{bmatrix} + x_2\begin{bmatrix} 2 \\ -5 \end{bmatrix} + x_3\begin{bmatrix} -1 \\ 3 \end{bmatrix} = \begin{bmatrix} 4 \\ 1 \end{bmatrix}, which is the matrix equation

[12−10−53][x1x2x3]=[41].\begin{bmatrix} 1 & 2 & -1 \\ 0 & -5 & 3 \end{bmatrix}\begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} = \begin{bmatrix} 4 \\ 1 \end{bmatrix}.

One problem, three notations

If AA is m×nm \times n with columns a1,…,an\mathbf{a}_1, \dots, \mathbf{a}_n and b\mathbf{b} is in Rm\mathbb{R}^m, then the matrix equation Ax=bA\mathbf{x} = \mathbf{b}, the vector equation x1a1+⋯+xnan=bx_1\mathbf{a}_1 + \cdots + x_n\mathbf{a}_n = \mathbf{b}, and the linear system with augmented matrix [ a1  ⋯  an∣b ][\,\mathbf{a}_1 \;\cdots\; \mathbf{a}_n \mid \mathbf{b}\,] all have the same solution set.

Consequently, Ax=bA\mathbf{x} = \mathbf{b} has a solution if and only if b\mathbf{b} is a linear combination of the columns of AA.

Worked example: Solving a matrix equation

Solve Ax=bA\mathbf{x} = \mathbf{b} for A=[110011101]A = \begin{bmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \\ 1 & 0 & 1 \end{bmatrix} and b=[354]\mathbf{b} = \begin{bmatrix} 3 \\ 5 \\ 4 \end{bmatrix}.

Row reduce [ A∣b ][\,A \mid \mathbf{b}\,]: R3−R1R_3 - R_1 gives [ 0    −1    1∣1 ][\,0 \;\; {-1} \;\; 1 \mid 1\,], then R3+R2R_3 + R_2 gives [ 0    0    2∣6 ][\,0 \;\; 0 \;\; 2 \mid 6\,]:

[110301150026].\left[\begin{array}{ccc|c} 1 & 1 & 0 & 3 \\ 0 & 1 & 1 & 5 \\ 0 & 0 & 2 & 6 \end{array}\right].

So x3=3x_3 = 3, x2=5−3=2x_2 = 5 - 3 = 2 and x1=3−2=1x_1 = 3 - 2 = 1: x=[123]\mathbf{x} = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix}. Check with the row rule: Ax=[1+22+31+3]=[354]A\mathbf{x} = \begin{bmatrix} 1 + 2 \\ 2 + 3 \\ 1 + 3 \end{bmatrix} = \begin{bmatrix} 3 \\ 5 \\ 4 \end{bmatrix}.

When is Ax=bA\mathbf{x} = \mathbf{b} solvable for every b\mathbf{b}?

For a fixed matrix AA, some right-hand sides may be reachable and others not. The set of reachable b\mathbf{b} is exactly Span⁡{a1,…,an}\operatorname{Span}\{\mathbf{a}_1, \dots, \mathbf{a}_n\}. The best possible situation is that this span is all of Rm\mathbb{R}^m.

Worked example: A matrix whose columns do not span

Let A=[123257134]A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 5 & 7 \\ 1 & 3 & 4 \end{bmatrix}. For which b\mathbf{b} is Ax=bA\mathbf{x} = \mathbf{b} consistent?

Row reduce [ A∣b ][\,A \mid \mathbf{b}\,] with R2−2R1R_2 - 2R_1, R3−R1R_3 - R_1, then R3−R2R_3 - R_2:

[123b1011b2−2b1011b3−b1]→[123b1011b2−2b1000b1−b2+b3].\left[\begin{array}{ccc|c} 1 & 2 & 3 & b_1 \\ 0 & 1 & 1 & b_2 - 2b_1 \\ 0 & 1 & 1 & b_3 - b_1 \end{array}\right] \to \left[\begin{array}{ccc|c} 1 & 2 & 3 & b_1 \\ 0 & 1 & 1 & b_2 - 2b_1 \\ 0 & 0 & 0 & b_1 - b_2 + b_3 \end{array}\right].

The system is consistent exactly when b1−b2+b3=0b_1 - b_2 + b_3 = 0. That is the equation of a plane through the origin in R3\mathbb{R}^3, so the columns of AA span only a plane, not all of R3\mathbb{R}^3. For example b=(1,0,0)\mathbf{b} = (1, 0, 0) is unreachable.

The trouble in that example came from the zero row in the coefficient part: it left the last entry as a condition on b\mathbf{b}. If every row of AA had a pivot, no such condition could arise.

Spanning theorem

Let AA be an m×nm \times n matrix. The following statements are either all true or all false.

  1. For each b\mathbf{b} in Rm\mathbb{R}^m, the equation Ax=bA\mathbf{x} = \mathbf{b} has a solution.
  2. Each b\mathbf{b} in Rm\mathbb{R}^m is a linear combination of the columns of AA.
  3. The columns of AA span Rm\mathbb{R}^m.
  4. AA has a pivot position in every row.

A quick consequence: an m×nm \times n matrix has at most nn pivots (one per column), so if nn is less than mm the columns cannot span Rm\mathbb{R}^m. Two vectors can never span R3\mathbb{R}^3.

Common mistake

Statement 4 is about the coefficient matrix AA, not the augmented matrix [ A∣b ][\,A \mid \mathbf{b}\,]. An augmented matrix can have a pivot in every row precisely because its last column is a pivot column, which means the system is inconsistent, the opposite of what you want.

Linearity of AxA\mathbf{x}

Directly from the column definition, for vectors u,v\mathbf{u}, \mathbf{v} in Rn\mathbb{R}^n and a scalar cc,

A(u+v)=Au+AvandA(cu)=c Au.A(\mathbf{u} + \mathbf{v}) = A\mathbf{u} + A\mathbf{v} \qquad\text{and}\qquad A(c\mathbf{u}) = c\,A\mathbf{u}.

For instance, A(u+v)=(u1+v1)a1+⋯+(un+vn)anA(\mathbf{u} + \mathbf{v}) = (u_1 + v_1)\mathbf{a}_1 + \cdots + (u_n + v_n)\mathbf{a}_n, and regrouping gives Au+AvA\mathbf{u} + A\mathbf{v}. These two rules will drive the next lesson's description of solution sets, and later the whole theory of linear transformations.

Tip

To check a solution of Ax=bA\mathbf{x} = \mathbf{b}, multiply AxA\mathbf{x} with the row-vector rule and compare with b\mathbf{b}. It takes seconds and doesn't depend on your row reduction being right.

Practice

Practice 1

Compute AxA\mathbf{x} for A=[12−1034]A = \begin{bmatrix} 1 & 2 & -1 \\ 0 & 3 & 4 \end{bmatrix} and x=[213]\mathbf{x} = \begin{bmatrix} 2 \\ 1 \\ 3 \end{bmatrix}. Give the result as an ordered pair.

Enter a point like (2, -3)

Practice 2

Which matrix equation represents the system 3x1−x2=23x_1 - x_2 = 2,   x1+4x3=0\;x_1 + 4x_3 = 0?

Practice 3

Suppose Au=[12]A\mathbf{u} = \begin{bmatrix} 1 \\ 2 \end{bmatrix} and Av=[3−1]A\mathbf{v} = \begin{bmatrix} 3 \\ -1 \end{bmatrix}. Find A(2u−v)A(2\mathbf{u} - \mathbf{v}) as an ordered pair.

Enter a point like (2, -3)

Practice 4

Solve Ax=bA\mathbf{x} = \mathbf{b} for A=[121013230]A = \begin{bmatrix} 1 & 2 & 1 \\ 0 & 1 & 3 \\ 2 & 3 & 0 \end{bmatrix} and b=[121]\mathbf{b} = \begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix}. Give x\mathbf{x} as (x1,x2,x3)(x_1, x_2, x_3).

Enter a point like (2, -3)

Practice 5

Let A=[123257134]A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 5 & 7 \\ 1 & 3 & 4 \end{bmatrix} (the matrix from the example above) and b=[13b3]\mathbf{b} = \begin{bmatrix} 1 \\ 3 \\ b_3 \end{bmatrix}. For what value of b3b_3 is Ax=bA\mathbf{x} = \mathbf{b} consistent?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 6

Do the columns of B=[102213011]B = \begin{bmatrix} 1 & 0 & 2 \\ 2 & 1 & 3 \\ 0 & 1 & 1 \end{bmatrix} span R3\mathbb{R}^3?

Practice 7

AA is a 5×35 \times 3 matrix. What is the largest number of pivot positions AA can have? (Use your answer to decide whether the columns of AA can span R5\mathbb{R}^5.)

Enter a number. Fractions like 3/4 and sqrt(2) are OK.