使用逆矩阵求解方程组

Before this, know方程组用作矩阵

Read · 3 min

Matrices and Systems

Let's say you're in algebra and you're given a system of equations. You could certainly use substitution or graphing to solve it, but there is an even cooler way (in my opinon) to attack these problems.

You can use Matrices!

The Problem

Let's start out with a simple equation

x+2y=4x+2y =4

3x−5y=13x-5y=1

First we notice that there are two things given, the coefficients of xx and yy and the solutions to the equations

Furthermore, we realize that we are looking for the solutions to x and y

Let's think about how we put the matrices together. Well, if we think about it, the given coeffiecients, multiplied by some unique values of x and y will give us the solutions.

We now might have an idea of how to form our matrices!

The format, as many of you have probably guessed, is

[The coefficient matrix] [The variable matrix]= [The solution matrix]

Convention has it so we call the coefficient matrix "A", the variable matrix "X", and the solution matrix "B"

Or, in terms of our equation

Matrix A:

Matrix X:

Matrix B:

When we put them in the format initially given by the equation we get the following matrix equation:

Okay, so we've gotten this far but we need to find x and y, as this is the ultimate goal of this exercise.

As in any other situation, we are going to want to isolate the variable(s)!

Isolation

Our goal is to make one be the coefficient of Matrix X. This would mean we should multiply both sides by its inverse.

Let's think about how we find the inverse matrix. I'll tell you now it isn't as easy as finding the inverse of a single number. In a 2x2 matrix, however, there is an easy way to go about this.

Instead we have to use the determinant and a special operation within the matrix itself. Let's explore this.

2x2 Matrix Inversion

Matrix A:

Matrix A −1^{-1} :

The portion given as ad−bc{ad-bc} is referred to as the determinant.

Now, given our values, we can plug in and find A−1^{-1}

This simplifies to

Thus we realize that A−1^{-1} is

Solving

Now that we've found the inverse matrix of A we can solve for Matrix X, also, notice that our expression has now taken the form X=A−1BX = A^{-1}B

So with this in find, we can solve:

Now all we need to do is multiply Matrix A−1^{-1} by Matrix B. You can review this by reading our lessons on multiplying a matrix by another matrix.

In the end we find that the solution is

Thus x=2 and y=1

As the systems and matrices get larger, this method can begin to get tedious when done by hand. However, in systems with three equations a 3x3 matrix set up can really expidite the problem solving!

Interesting Side Note

When you multiply AA−1^{-1} you will find that the matrix that results will be the following:

Interestingly enough, this will be the result any time you multiply any version of A and A−1^{-1} together. You can learn more with the invertible matrix theorem.

This matrix is called The identity matrix and much like the identity in basic arithmetic, it is used to get the original input as the output (This of it as multiplying by one)

Illustrated · 3 min

While solving systems of equations through direct methods (like substitution, graphing, and elimination) is often quicker, sometimes you'll be asked to use a matrix. Or, maybe you're just a lover of matrices and prefer that approach. No judgement here!

Matrices are another totally acceptable option for solving systems of equations. You can check your solutions from a matrix against any of the other methods, and vice versa.

Let's take a look at a system of equations and how you can use a matrix to solve it.

3x−y=7 2x+3y=13x - y = 7 \\\ 2x + 3y = 1

Before we set up a matrix, let's make sure we can identify the parts of our system of equations.

The coefficient of the xx-term in the second equation is 22. The coefficient of the yy-term in the first equation is −1-1.

Here's the matrix that represents our equations:

matrix 3&-1 \\ 2&3 
multiplied by column vector x&y
equals
column vector 7&1

Image source: by Hannah Bonville

To get to this matrix, the first thing you need to do is make sure your equations have the variables on one side of the equation. You'll also want to make sure your variables are in the same order in both equations (e.g., we've got the xx first in both equations).

If you're a little unsure of how we set up the matrix, check out the color-coding below:

Image source: by Hannah Bonville

To solve for xx and yy, we need to multiply both sides of this equation by the inverse of our coefficient matrix. In our example, that's the part that's purple and green.

Now, the inverse of a matrix is not exactly the same as the inverse of something like a fraction that we can just flip over.

Let's take a look at finding the inverse of our matrix:

Step 1. Find the determinant.

To determine the inverse of a matrix, you first need to multiply diagonally.

  1. Multiply the number in the top left by the number in the bottom right. We highlighted those values in pink. (3x3=93x3 = 9)

  2. Multiply the number in the top right by the number in the bottom left. We highlighted those in purple. (−1x2=−2-1x2 = -2)

  3. Subtract the second value from the first.

    For our example, that gives us 9−(−2)=119-(-2) = 11.

    Our determinant = 1111.

Image source: by Hannah Bonville

Step 2. Find the adjoint.

Now, we need to take our coefficient matrix and flip it around a little bit.

  1. Swap the top left and bottom right numbers in the matrix (highlighted above in pink).
  2. Multiply the top right and bottom left numbers in the matrix (highlighted in purple), by −1-1. (Don't swap them like you did in the step prior. Just multiply by −1-1).

This gives us a new matrix, called the adjoint. The adjoint in our example looks like this:

Image source: by Hannah Bonville

Now, to finally find our inverse, we need to multiply 11 over the determinant (1111) by the adjoint. That looks like this:

Image source: by Hannah Bonville

Phew! We finally have our inverse, highlighted in yellow.

We're almost there!

We now need to multiply our inverse by the last column in our original set-up. (FYI, this last column is called the constant matrix.)

Image source: by Hannah Bonville

Multiplying the inverse by the constant matrix to solve for xx and yy

1. Multiply the top left value in the inverse by the top number in the constant matrix

2. Multiply the top right value in the inverse by the bottom number in the constant matrix

This gives us:

Image source: by Hannah Bonville

3. Multiply the bottom left value in the inverse by the top number in the constant matrix

4. Multiply the bottom right value in the inverse by the bottom number in the constant matrix

This gives us:

Image source: by Hannah Bonville

The last step is to add the values in the product matrix horizontally. So, we'll add together the top two values and then we'll add together the bottom two values.

This will give us the values of xx and yy.

Image source: by Hannah Bonville

This means that x=2x=2 and y=−1y=-1.

It is a very good idea to plug these values back into the original system of equations (waaaaaaay at the top of this explanation) to make sure they are correct.

Video

(Video) Cramer's Rule

by patrickJMT

In this video, patrickJMT walks you through the proof for Cramer's Rule.

Summary

Cramer's Rule is a way to solve a system of linear equations. This proof looks at situations where there are two equations and two unknowns, but this proof will also work with more equations.

The solutions to:

a1x+b1y=c1a2x+b2y=c2\begin{align} a_1x + b_1y = c_1 \\ a_2x + b_2y = c_2 \\ \end{align}

are: x=DxDx=\frac{D_x}{D} , y=DyDy=\frac{D_y}{D},

where: D=[a1b1a2b2]D = \begin{bmatrix} a_1&b_1 \\ a_2&b_2 \\ \end{bmatrix}

and: Dx=[c1b1c2b2]D_x = \begin{bmatrix} c_1&b_1 \\ c_2&b_2 \\ \end{bmatrix}, Dy=[a1c1a2c2]D_y = \begin{bmatrix} a_1&c_1 \\ a_2&c_2 \\ \end{bmatrix}

To get the value of the determinant, we cross-multiplication. For example, D=[a1b1a2b2]=a1b2−a2b1D = \begin{bmatrix} a_1&b_1 \\ a_2&b_2 \\ \end{bmatrix} = a_1b_2 - a_2b_1

He then uses elimination to move through the rest of the proof. With this foundation, watch the video to learn the proof!

Illustrated · 1 min

Solving Systems Using an Inverse Matrix

Now that we understand that we can use matrices to solve systems of linear equations, we will learn how to use the inverse matrix specifically.

Solve Systems: Inverse Matrix
Given a matrix, we can multiply the vector B by the inverse of the matrix.

Image source: by Anusha Rahman

Step 1: Define the System of Equations

Convert the system of equations into a matrix equation.

Step 2: Introduce the Inverse Matrix

By multiplying both sides of the matrix equation by A−1A^{-1}, we can isolate XX.

Step 3:: Compute the Inverse of Matrix AA

The determinant is calculated as ad−bcad-bc.

Step 4: Multiply the Inverse Matrix by Vector BB

We're going back to the equation we set up earlier.

Step 5: Solve for XX

We can now solve the matrix equation!

In summary, here is what we did:

A⋅X=B→X=A−1⋅BA \cdot X = B \rightarrow X = A^{-1} \cdot B

As we can see, inverse matrices are a powerful way to solve systems of linear equations. The inverse matrix "undoes" the effect of the original coefficient matrix AA, allowing us to isolate and solve for the unknown variables in vector XX.

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems