## How do you write a system of equations as a matrix equation?

In section 3.2, you learned how to multiply two matrices. This process involved multiplying the entries in the row of one matrix by the columns of another matrix and then adding those products. For instance, suppose we multiply

Since we are multiplying a 2 x 2 matrix by a 2 x 1 matrix, the product is a 2 x 1 matrix. Working out the product, we get

When the product is written this way, we can easily identify the product of the numbers in the rows of the first matrix with the numbers in the second matrix as well as the sum.

Instead of multiplying the first matrix by a constant column matrix, let’s try multiplying by a matrix containing two variables *x* and *y*,

When we carry out the multiplication now, we get

The entries in the product look a lot like the part of a system of equations. In fact, if we set this equal to a 2 x 1 matrix with constants,

we can write the matrix equation as an equivalent system of equations.

These matrices are equal when the corresponding entries are equal or when

In other words,

When a system of equations is written in terms of matrices, we call it a matrix equation. In this matrix equation, the three matrices are typically called *A*, *X* and *B*.

The matrix A is called the coefficient matrix and it entries are the coefficients on the variables when they are written in the same order in each equation. The matrix X is called the variable matrix and contains the two variables in the problem. The matrix B is called the constant matrix and contains the constants from the right hand side of the matrix equation.

To match the different matrices with their entries, each equation must have the variables on the left side with the variable terms listed in the same order. The constants must be on the right side. Once each equation has this format, we can read the entries in each matrix.

### Example 1 Write a Linear System as a Matrix Equation

Write the system of linear equations

as the matrix equation *AX* = *B*.

**Solution** The system is in the proper format to determine the coefficient matrix and the constant matrix. The variable matrix for this system is

Using the coefficients on the variables, define the coefficient matrix and constant matrix as

With these definitions, the product *AX* is equal to

When this matrix is set equal to the constant matrix *B*, we get

These matrices are equal when *x* + *y* = -5 and 3*x* + 4*y* = 1. This means the matrix equation is equivalent to the original system of equations.

We can use the same strategy to write larger systems of equations as matrix equations. This leads to larger matrices. We incorporate different variable names into the variable matrix X as shown in the next example.

### Example 2 Write a Linear System as a Matrix Equation

Write the system of linear equations

as a matrix equation *AX* = *B*.

**Solution** Before we can define the matrices, we need to put each equation in the proper format. In the first and second equations, all variable terms are on one side of the equation and the constant terms are on the other side of the equations. In the third equation, there are variable terms on both sides of the equation. We can put the third equation in the proper format by subtracting from both sides of the equation,

This leads to the system

The variable matrix is

The coefficients on the variables give the coefficient matrix,

Note that any signs are included in the coefficients and variables that are missing correspond to a coefficient of zero.

The constant matrix,

matches the constants on the right hand of the system.

We can check to see that the matrix equation *AX* = *B* is equivalent to the system by carrying out the product *AX*:

If we set this matrix equal to *B*,

the corresponding entries must be equal. This is equivalent to the original system after it had been modified to put it into the proper format.

Once a system of linear equations is written as a matrix equation , we can use the inverse of the matrix *A* to find the solution to the system. In the next question, we’ll learn how to do this and use it to solve an application.