Vectors and Matrices in a Brutal Love Triangle II—Matrices, Vectors, and Systems of Equations

ln

So that’s how you see systems of equations? They look completely different to me. I’ve sent you the post. Open it if you think you can handle it 😎

Content translated by ChatGPT.

You’ve probably seen your fair share of systems of equations.

Back in middle school, our teachers showed us how to put two equations with two unknowns together and solve them.

Here’s a simple example.

{x1+x2=3x1−x2=1\begin{cases} x_1 + x_2 = 3 \\ x_1 - x_2 = 1 \end{cases}

We want to find x1x_1 and x2x_2. Add the second equation to the first and we get 2x1=42x_1=4, so the answer is {x1=2x2=1\begin{cases} x_1 = 2 \\ x_2 = 1 \end{cases}.

How should we think about a system like this in a vector space?

Zero. What Is a System of Linear Equations Actually Doing?

From the previous post 👉 Eigenvalues and Eigenvectors, we know that a system of linear equations can be written as a matrix times a column vector of unknowns. Our example becomes

(111−1)(x1x2)=(31)\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} = \begin{pmatrix} 3 \\ 1 \end{pmatrix}

What does this tell us?

By definition, matrix multiplication takes each row of the matrix on the left and each column of the matrix on the right, multiplies their corresponding entries, and adds the products.

Now, with an astonishing feat of concentration, compare the matrix with the original equations. The entries in the left column (11)\begin{pmatrix} 1 \\ 1 \end{pmatrix} always get multiplied by x1x_1, and the entries in the right column (1−1)\begin{pmatrix} 1 \\ -1 \end{pmatrix} always get multiplied by x2x_2. So what the matrix is actually doing is

(11)x1+(1−1)x2=(31)\begin{pmatrix} 1 \\ 1 \end{pmatrix}x_1+\begin{pmatrix} 1 \\ -1 \end{pmatrix}x_2=\begin{pmatrix} 3 \\ 1 \end{pmatrix}

That’s right. The question at the heart of a system of linear equations is whether we can choose coefficients so that a linear combination of the given vectors produces the result we want.

More generally, suppose we have an m×nm\times n matrix A=(α1,α2,…,αn)A=(\boldsymbol{\alpha_1},\boldsymbol{\alpha_2},\ldots,\boldsymbol{\alpha_n}). Can we find coefficients x1,x2,…,xnx_1,x_2,\ldots,x_n such that the linear combination x1α1+x2α2+⋯+xnαnx_1\boldsymbol{\alpha_1}+x_2\boldsymbol{\alpha_2}+\cdots+x_n\boldsymbol{\alpha_n} gives us the vector b=(b1,b2,…,bm)\boldsymbol{b}=(b_1,b_2,\ldots,b_m)?

That’s how we can write any system of linear equations as

AX=b\boxed{AX=\boldsymbol{b}}

The linear algebra perspective puts the focus on how we combine the vectors αi\boldsymbol{\alpha_i} and what transformation the matrix performs.

A system of linear equations gives us three questions to work with.

  • Existence. Can we combine the vectors to get b\boldsymbol{b}?
  • Uniqueness. How many ways can we do it?
  • Structure of the solution set. If there are several ways to do it, how are they related?

One. Matrix Rank

I spent quite a while wondering where to start with systems of linear equations. After thinking it over, I decided to start with matrices.

You might have heard of the rank of a matrix. It tells us the maximum number of linearly independent columns or rows in the matrix. One way to find it is to reduce the matrix using elementary row or column operations and inspect the result.

1. Rank and Variables

Let’s look at a simple augmented matrix.

(1131−11)\begin{pmatrix} \begin{array}{cc|c} 1 & 1 & 3\\ 1 & -1 & 1 \end{array} \end{pmatrix}

An augmented matrix places the coefficient matrix and the column vector of constants side by side, usually with a vertical line between them.

Add the second row to the first to get

(2041−11)\begin{pmatrix} \begin{array}{cc|c} 2 & 0 & 4\\ 1 & -1 & 1 \end{array} \end{pmatrix}

Then subtract half the first row from the second to get

(2040−1−1)\begin{pmatrix} \begin{array}{cc|c} 2 & 0 & 4\\ 0 & -1 & -1 \end{array} \end{pmatrix}

Divide the first row by two and multiply the second row by −1-1.

(102011)\begin{pmatrix} \begin{array}{cc|c} 1 & 0 & 2\\ 0 & 1 & 1 \end{array} \end{pmatrix}

Notice that we get the same values of x1x_1 and x2x_2 as we did by solving the equations directly.

Writing the matrix back out as equations gives us

{x1+0=20+x2=1\begin{cases} x_1 + 0 = 2 \\ 0 + x_2 = 1 \end{cases}

Now suppose we have a matrix like this.

(102000)\begin{pmatrix} \begin{array}{cc|c} 1 & 0 & 2\\ 0 & 0 & 0 \end{array} \end{pmatrix}

The corresponding equations are

{x1+0=20+0=0\begin{cases} x_1 + 0 = 2 \\ 0 + 0 = 0 \end{cases}

Here, x2x_2 can take any value.

This gives us an intuitive conclusion. The rank of the coefficient matrix is the number of pivot variables in the system.

A pivot variable, also called a basic variable, corresponds to a pivot column of the coefficient matrix. In a consistent system, its value is determined once we choose the free variables.

2. Linear Independence and Pivot Variables

We also know that the rank is the maximum number of linearly independent columns in the matrix.

Putting that together with the previous section, we get as many pivot variables as there are columns in a basis for the column space.

Why should those two numbers happen to agree? Let’s start with what the matrix itself does.

1) Matrix Rank and the Corresponding Linear Transformation

Suppose AA is an m×nm\times n matrix. Applying it to a vector XX gives AX=bAX=b. What is it doing in a vector space?

As we saw in the previous post 👉 The Geometry Behind Matrix Multiplication, multiplying by AA transforms XX geometrically.

Think of AA as a machine. Feed it XX, and it follows a rule to spit out bb.

You might have heard that when AA has full column rank, r(AB)=r(B)r(AB)=r(B).

The number of columns of AA gives the dimension of its input space, while its rank tells us how many independent directions survive the transformation. A matrix with full column rank preserves all of them.

Why? Suppose A=(α1,α2,α3)A=(\boldsymbol{\alpha_1},\boldsymbol{\alpha_2},\boldsymbol{\alpha_3}), where α1\boldsymbol{\alpha_1} and α2\boldsymbol{\alpha_2} are linearly independent and α3\boldsymbol{\alpha_3} is a linear combination of the two. In other words,

α3=c1α1+c2α2\boldsymbol{\alpha_3}=c_1\boldsymbol{\alpha_1}+c_2\boldsymbol{\alpha_2}

The three-dimensional input space has three linearly independent standard basis vectors e1,e2,e3\boldsymbol{e_1},\boldsymbol{e_2},\boldsymbol{e_3}.

Let’s apply AA to each of them. Each standard basis vector has a single 11 and zeros everywhere else, so multiplying by it picks out a single column of AA.

Ae1=α1Ae2=α2Ae3=α3\begin{aligned} Ae_1&=\boldsymbol{\alpha_1}\\ Ae_2&=\boldsymbol{\alpha_2}\\ Ae_3&=\boldsymbol{\alpha_3} \end{aligned}

Here’s where things get interesting. After applying AA, we can express Ae3A\boldsymbol{e_3} as a linear combination of α1\boldsymbol{\alpha_1} and α2\boldsymbol{\alpha_2}, which are Ae1Ae_1 and Ae2Ae_2!

That direction has lost its independence in the output.

In other words, if a 3×33\times3 matrix AA has rank 22, the three independent directions in its input yield only two linearly independent directions in its output.

Now let v=e3−c1e1−c2e2v=e_3-c_1e_1-c_2e_2. Then

Av=A(e3−c1e1−c2e2)=α3−c1α1−c2α2=0Av=A(e_3-c_1e_1-c_2e_2)=\boldsymbol{\alpha_3}-c_1\boldsymbol{\alpha_1}-c_2\boldsymbol{\alpha_2}=0

So AA sends some nonzero vector to zero.

2) Rank and Pivot Variables

Now we can explain why the rank equals the number of pivot variables.

Suppose AA is an m×nm\times n matrix with

r(A)=rr(A)=r

Its column space has a basis of rr linearly independent columns.

ap1,ap2,…,apra_{p_1},a_{p_2},\ldots,a_{p_r}

Every output has a unique representation in this basis.

AX=c1ap1+⋯+craprAX=c_1a_{p_1}+\cdots+c_ra_{p_r}

So when we specify an output bb in the column space, the rr coefficients are uniquely determined.

Now consider

AX=x1a1+⋯+xnan=bAX=x_1a_1+\cdots+x_na_n=b

After labeling the basis columns and their variables first, we can write each of the remaining n−rn-r columns as a linear combination of the first rr.

Collecting terms gives us

(x1+f1(xr+1,…,xn))a1+(x2+f2(xr+1,…,xn))a2⋮+(xr+fr(xr+1,…,xn))ar=b\begin{aligned} &(x_1+f_1(x_{r+1},\ldots,x_n))a_1\\ +{}&(x_2+f_2(x_{r+1},\ldots,x_n))a_2\\ &\qquad\vdots\\ +{}&(x_r+f_r(x_{r+1},\ldots,x_n))a_r=b \end{aligned}

Here, f1,…,frf_1,\ldots,f_r are linear combinations of the free variables.

This gives us rr pivot variables, x1,x2,…,xrx_1,x_2,\ldots,x_r. The coefficient of each basis vector is fixed, so the free variables xr+1,…,xnx_{r+1},\ldots,x_n determine their values.

Two. Homogeneous Systems of Linear Equations

Set every entry of the constant vector bb to zero and you get a homogeneous system of linear equations.

We write it as

AX=0\boxed{AX=0}

It has a curious property. When AA has full column rank, the only solution is X=0X=0.

This is easy enough to see. We can write the equation as

α1x1+α2x2+⋯+αnxn=0\alpha_1x_1+\alpha_2x_2+\cdots+\alpha_nx_n=0

When AA has full column rank, its columns are linearly independent. By definition, the only way their linear combination can give zero is if every coefficient xix_i is zero.

1. A Basis for the Null Space

Always ending up with zero is pretty boring, right?

When AA lacks full column rank, the homogeneous system has infinitely many solutions.

In terms of linear dependence, the columns (α1,α2,…,αn)(\alpha_1,\alpha_2,\ldots,\alpha_n) are linearly dependent. So there is a choice of coefficients, with at least one nonzero, such that

α1x1+α2x2+⋯+αnxn=0\alpha_1x_1+\alpha_2x_2+\cdots+\alpha_nx_n=0

All coefficient vectors that satisfy this equation make up the null space.

Following the same reasoning as before, if r(A)=rr(A)=r, we can rewrite the equation as

(x1+f1(xr+1,…,xn))a1+(x2+f2(xr+1,…,xn))a2⋮+(xr+fr(xr+1,…,xn))ar=0\begin{aligned} &(x_1+f_1(x_{r+1},\ldots,x_n))a_1\\ +{}&(x_2+f_2(x_{r+1},\ldots,x_n))a_2\\ &\qquad\vdots\\ +{}&(x_r+f_r(x_{r+1},\ldots,x_n))a_r=0 \end{aligned}

Since these rr vectors are linearly independent, their coefficients must all be zero. That gives us

x1+f1(xr+1,…,xn)=0x2+f2(xr+1,…,xn)=0⋮xr+fr(xr+1,…,xn)=0\begin{aligned} &x_1+f_1(x_{r+1},\ldots,x_n)=0\\ &x_2+f_2(x_{r+1},\ldots,x_n)=0\\ &\qquad\vdots\\ &x_r+f_r(x_{r+1},\ldots,x_n)=0 \end{aligned}

Each of the rr pivot variables x1,x2,…,xrx_1,x_2,\ldots,x_r can be expressed in terms of the n−rn-r free variables.

So we can write the vector XX as

X=xr+1(ab⋮c)+xr+2(de⋮f)+⋯X=x_{r+1}\begin{pmatrix} a \\ b \\ \vdots \\ c \end{pmatrix} +x_{r+2}\begin{pmatrix} d \\ e \\ \vdots \\ f \end{pmatrix}+\cdots

This is the general solution of the homogeneous system. The set of linearly independent vectors in this expression forms a basis for the null space.

This also gives us an important result.

Number of vectors in a null-space basis=n−r(A)\boxed{\text{Number of vectors in a null-space basis}=n-r(A)}

Does that look a little weird? Fair. It takes a special kind of nerd to derive a null-space basis this way 😰. As for why I explained it this way…

I ran out of ways to force a segue from the previous section. (Ducks.)

So let’s look at an actual example.

Consider the homogeneous system

{x1+x2+x3=0x2+x3=0\begin{cases} x_1+x_2+x_3=0\\ x_2+x_3=0 \end{cases}

Simplifying gives us

{x1=0x2=−x3\begin{cases} x_1=0\\ x_2=-x_3 \end{cases}

Set the free variable x3=tx_3=t. Then

X=(0−tt)=t(0−11)X=\begin{pmatrix}0\\-t\\t\end{pmatrix} =t\begin{pmatrix}0\\-1\\1\end{pmatrix}

Here, tt can be any real number.

So a single vector generates all infinitely many solutions.

ξ1=(0−11)\boxed{\xi_1=\begin{pmatrix}0\\-1\\1\end{pmatrix}}

The set {ξ1}\{\xi_1\} is a basis for the null space.

2. How Multiplying by Another Matrix Affects the Null Space

Suppose we have a system of linear equations

AX=0AX=0

We multiply on the left by another matrix BB to get

BAX=0BAX=0

How does this affect the basis for the null space?

First, if AX=0AX=0, then of course

BAX=B0=0BAX=B0=0

Every solution of AX=0AX=0 is therefore a solution of BAX=0BAX=0. In other words, the null space of AA is contained in the null space of BABA.

ker⁡(A)⊆ker⁡(BA)\boxed{\ker(A)\subseteq\ker(BA)}

ker⁡(A)\ker(A) denotes the null space of AA, the set of all solutions to AX=0AX=0, including the zero vector.

Equal Null Spaces

Something special happens when r(BA)=r(A)r(BA)=r(A). The two null spaces are equal.

We can see this directly from the dimensions. If r(BA)=r(A)r(BA)=r(A), then

dim⁡ker⁡(BA)=n−r(BA)=n−r(A)=dim⁡ker⁡(A)\dim\ker(BA)=n-r(BA)=n-r(A)=\dim\ker(A)

dim⁡\dim denotes dimension. The dimension dim⁡ker⁡(A)\dim\ker(A) is the number of vectors in a basis for the null space of AA.

So a basis for either null space has exactly n−rn-r vectors. Since ker⁡(A)⊆ker⁡(BA)\ker(A)\subseteq\ker(BA) and the dimensions are equal, the null spaces must be equal.

Is this just a lucky encounter between two theorems? We can also see what’s happening by looking at the transformations themselves.

The matrices act from right to left, so for BAXBAX we have

X→AY→BZX\xrightarrow{A}Y\xrightarrow{B}Z

In other words, AA transforms XX into YY, and then BB transforms YY into ZZ.

The equality r(BA)=r(A)r(BA)=r(A) tells us that the number of independent directions surviving AA is the same as the number surviving both AA and BB. The transformation BB preserves all the independent directions in the output of AA.

That is, BB is injective on the image of AA.

Injectivity on the image of AA is all we need for r(BA)=r(A)r(BA)=r(A), even if BB itself has linearly dependent columns.

Three. Nonhomogeneous Systems of Linear Equations

What other kinds of linear systems are there besides homogeneous ones?

All the other ones. (Ducks.)

A nonhomogeneous system is one whose constant vector bb is nonzero. We write it as

AX=b\boxed{AX=b}

To determine whether a nonhomogeneous system has a solution, we usually compare the rank of its coefficient matrix with that of its augmented matrix.

Take this simple example.

(113001)\begin{pmatrix} \begin{array}{cc|c} 1 & 1 & 3\\ 0 & 0 & 1 \end{array} \end{pmatrix}

We get 0+0=10+0=1, so the system clearly has no solution. In other words, if the coefficient matrix has lower rank than the augmented matrix, the system has no solution.

The General Solution of a Nonhomogeneous System

Nonhomogeneous systems have an interesting property. The difference between any two particular solutions is a solution of the corresponding homogeneous system.

Suppose the nonhomogeneous system has two distinct solutions η1\eta_1 and η2\eta_2. Then

Aη1−Aη2=b−bA(η1−η2)=0\begin{aligned} A\eta_1-A\eta_2&=b-b \\ A(\eta_1-\eta_2)&=0 \end{aligned}

Call the difference ξ=η1−η2\xi=\eta_1-\eta_2. The equation becomes

Aξ=0A\xi=0

So ξ\xi is a solution of the homogeneous system.

Let’s take this a step further. Suppose XX is any solution of AX=bAX=b, and η\eta is a fixed particular solution. Then

A(X−η)=0A(X-\eta)=0

So X−ηX-\eta is always a solution of the homogeneous system. Conversely, if Aξ=0A\xi=0, then A(η+ξ)=bA(\eta+\xi)=b.

It follows that the general solution of the nonhomogeneous system is X=η+ξX=\eta+\xi, where η\eta is a particular solution and ξ\xi ranges over all solutions of the corresponding homogeneous system.

Comments

Feel free to leave your thoughts here. 💭💡

After signing in, click “Subscribe by Email” in the comment box to receive updates by email.

Loading comments…