In this explainer, we will learn how to express a system of linear equations as a matrix equation.

One of the most important applications of matrix operations is to solve a system of linear equations. While we can solve a system of two or three equations by using either the substitution or elimination methods, these methods quickly become overwhelming for a larger number of equations and unknown constants. We could program a computer to solve these problems for us, but how do we program a computer to perform such operations?

When we convert a system of linear equations into a matrix equation of the form , we can use this format to concisely enter our matrix into a computer. In this explainer, we will not discuss entering the matrix equation into a computer, but we will focus on how to write a matrix equation equivalent to a given linear system of equations.

Let us begin by considering the simplest system, which has two equations and two unknowns.

### How To: Writing Matrix Equations Equivalent to a System of Two Equations

Consider a system of equations given by for some known constants , , , , , . We can write this system of two equations as one matrix equation

The matrix on the left-hand side is called the coefficient matrix, the column matrix on the left-hand side is called the variable matrix, and the column matrix on the right-hand side is called the constant matrix. We can concisely express this equation as where is the coefficient matrix, is the variable matrix, and is the constant matrix.

If we carry out the matrix multiplication on the left-hand side of the matrix equation, this will be the same as

Equating the corresponding entries of the matrices on both sides of this equation leads back to the system of two linear equations. Hence, this matrix equation is equivalent to the system of two linear equations.

We can see that the coefficients of and in the system of equations formed the entries of the matrix, hence the name coefficient matrix. When writing down the coefficient matrix, we need to be careful about the order of the entries, which must agree with the order of entries in the variable matrix. Since the variable matrix has as its first entry, the coefficients of go in the first column. Hence, the same coefficient matrix is used even if the first equation in the system is written as . Rather than following the order of the coefficients written in the given equation, we need to consider which variable it is the coefficient of.

We also note that the column matrix on the right-hand side of the matrix equation contains the constant terms from the right-hand sides of the system of equations, hence the name constant matrix. The order of these constants must be consistent with the order of the rows in the coefficient matrix. Since the coefficients of the first equation, , are written in the first row of the coefficient equation, the constant from this equation must also appear in the first row of this equation.

In our first example, we will write a matrix equation that is equivalent to a given system of two equations.

### Example 1: Expressing a Pair of Simultaneous Equations as a Matrix Equation

Express the simultaneous equations as a matrix equation.

### Answer

In this example, we need to find a matrix equation that is equivalent to the given pair of simultaneous equations. Recall that a pair of simultaneous equations given by can be written as the matrix equation

We can see that the given pair of simultaneous equation has the same form as our formula. More specifically,

- all variables are on the left-hand sides,
- all constants are on the right-hand sides,
- variables are arranged in alphabetical order.

Hence, we can form the coefficient matrix and constant matrix by taking the numbers in the corresponding location within the simultaneous equations. The only part to be careful about here is to note that the coefficient of in the second equation is equal to 1 since there is no visible coefficient. To make this fact clear, we can write 1 as its coefficient:

This leads to the coefficient and constant matrices, respectively,

Substituting these matrices into the matrix equation, we have

In the previous example, we found a matrix equation from a pair of simultaneous equations in standard form.

### Definition: Standard Form of a System of Equations

A system of equations is in standard form if

- all variables are on the left-hand sides,
- all constants are on the right-hand sides,
- variables are arranged in alphabetical order (or the order specified in the variable matrix).

Starting with a system of equations in standard form is very helpful when we need to find an equivalent matrix equation. If we are given a system of equations that is not in standard form, we can begin by rearranging the system into standard form.

In the next example, we will first write a given system of two equations in its standard form and then find a matrix equation corresponding to the system.

### Example 2: Expressing a Pair of Simultaneous Equations as a Matrix Equation

Express the simultaneous equations as a matrix equation.

### Answer

In this example, we need to find a matrix equation that is equivalent to the given pair of simultaneous equations. Recall that a pair of simultaneous equations given by can be written as the matrix equation

Here, it is important to note that the entries of the coefficient matrix are the coefficients of the simultaneous equations in the order given in the variable matrix . This means that the first column of the coefficient matrix contains the coefficients of variable , while the second column contains the coefficients of variable .

Our given equations are not in the correct format since some of the variables appear on the right-hand sides of the equations, and some of the constants appear on the left-hand sides. Recall that a system of equation is in standard form if

- all variables are on the left-hand sides,
- all constants are on the right-hand sides,
- variables are arranged in alphabetical order.

We begin by rearranging the given pair of simultaneous equations into standard form:

Hence, we can form the coefficient matrix and constant matrix by taking the numbers in the corresponding location within the simultaneous equations. The only part to be careful about here is to note that the coefficients in the second equation are equal to 1. To make this fact clear, we can write 1 as its coefficient:

This gives the coefficient and constant matrices, respectively,

Substituting the coefficient and constant matrices into the matrix equation, we obtain

Now that we know how to write a matrix equation corresponding to a system of two linear equations, let us consider how to write a matrix equation for a larger system. Before we discuss examples of larger systems, we need to understand how the number of equations and the number of unknowns in a system of equations relates to the order of the coefficient matrix.

Our previous examples contained a system of two equations with two unknowns. Consequently, the equivalent matrix forms of these systems have had coefficient matrices of order . In larger systems, we have the following relation.

### Definition: Order of Coefficient Matrices

Let be the matrix form of an equivalent system of linear equations. Then the order of the coefficient matrix is given by

This means that we can find the number of equations and unknowns in a system of equations when we are given the order of its coefficient matrix. Equivalently, if we are given a system of linear equations with unknowns, this means that the order of the coefficient matrix will be . Following from this, since there are unknowns, the order of the variable matrix will be . Finally, since there are equations, hence constants on the right-hand sides, the order of the constant matrix will be . Altogether, the orders of the matrices in the equation are as follows:

Thus, we can confirm that the matrix multiplication is valid. We note that both and are always column matrices in this case.

In the next example, we will find the number of equations in a system from the order of its coefficient matrix.

### Example 3: Order of a System of Equations

Consider a system of linear equations written in matrix form as . If the order of matrix is and the order of matrix is , how many equations does the system have?

### Answer

In this example, we need to find the number of equations in a system of equations where we are given the order of matrices involved in a matrix equation. In the matrix equation , we know that is the coefficient matrix, is the variable matrix, and is the constant matrix. Recall that the order of the coefficient matrix in a matrix equation is given by

We know that the coefficient matrix, , is of order . Hence, the number of equations in the corresponding system is .

In the next example, we will perform matrix multiplication to identify the coefficient matrix from a given matrix equation.

### Example 4: Finding an Unknown Matrix in a Matrix Equation

Find the matrix such that

### Answer

In this example, we need to find a matrix satisfying the given matrix equation. Let us begin by finding the order of the matrix. We know that, to multiply a pair of matrices, the number of columns of the first matrix must equal the number of rows of the second matrix. Since the second matrix has 4 rows, matrix must have 4 columns.

We recall that multiplying an matrix to an matrix results in an matrix. We can see that the order of the matrix on the right-hand side of the given matrix equation is . This gives . Together with the number of columns we found earlier, we obtain the order of matrix , which is .

We can write

To multiply the matrix to a column matrix, we need to first pick each row of the matrix and multiply it to the column matrix. To multiply a row to the column matrix, we multiply the corresponding entries from each matrix and add up the products. Using different colors, we can indicate the corresponding entries from the first row:

Multiplying the row with the column, we obtain

We can match the coefficients of corresponding terms from both sides of the equation. However, the coefficient of is not visible, and also there is no term on the right-hand side containing . This means that the coefficient of is 1 and the coefficient of is 0. We can write these coefficients into the equation to write

This tells us the entries in the first row of matrix :

We can continue this process to fill all rows of matrix . The multiplication of the second row of with the column should result in . We need to rearrange this order so that is written first and also add zeros as coefficients of the terms that do not appear in the expression. Hence, we obtain

This gives us the second row of :

Multiplying the third and fourth row to the column matrix should produce, respectively,

This leads to the matrix

In the previous example, we found the matrix from the given matrix equation by working out the matrix multiplication backward. This process can be used to write a matrix equation from the given system of linear equations. Matrix in this example is a coefficient matrix. We were able to find this coefficient matrix by rearranging the variable expressions in the correct order, as indicated in the variable matrix, and writing coefficients of the variables as entries of the matrix.

In the next example, we will find an equivalent system of equations as a given matrix equation.

### Example 5: Identifying a Set of Simultaneous Equations from a Matrix Equation

Write down the set of simultaneous equations that could be solved using the given matrix equation:

### Answer

In this example, we need to find a set of simultaneous equations that is equivalent to the given matrix equation. We can do this by working out the matrix multiplication on the left-hand side of the equation above. Before we multiply matrices, let us check to see if the multiplication is well-defined. Recall that, to multiply a pair of matrices, the number of columns of the first matrix must equal the number of rows of the second matrix. We can see that the first matrix on the left-hand side has 3 columns, and the variable matrix has 3 rows. Hence, the multiplication is well-defined.

Computing the matrix multiplication,

Substituting this matrix to the left-hand side of the given equation,

Recall that a pair of matrices are equal if each corresponding entries in the two matrices are equal. Hence, we obtain the set of simultaneous equations:

In the previous example, we found a system of equations equivalent to a given matrix equation. Reversing this process gives us a method of writing a matrix equation from a given system of equations. We can see that this process is very similar to how we wrote a matrix equation corresponding to a system of two equations and two unknowns.

### How To: Writing Matrix Equations Equivalent to a System of 𝑚 Equations

Consider a system of linear equations with unknowns given by

This system of equations can be written as the matrix equation:

We can concisely express this equation as where is the coefficient matrix, is the variable matrix, and is the constant matrix.

Similar to the system of two equations, it is helpful to first write the system of equations in the standard form by ensuring

- all variables are on the left-hand sides,
- all constants are on the right-hand sides,
- variables are arranged in the order specified in the variable matrix.

Additionally, it is also helpful to vertically align terms corresponding to the same variable. For instance, consider the system of equations

We can see that these equations are in the standard form if the variable matrix is given by . We can also see a blank space in the first equation due to the fact that it is missing the term. This means that the coefficient of is zero in this case. This leads to the matrix equation:

Hence, once we write the system of linear equations in standard form and vertically aligned, it is simple to write down a matrix equation corresponding to the system.

In our final example, we will find the matrix equation corresponding to a system of three linear equations.

### Example 6: Expressing a Set of Simultaneous Equations as a Matrix Equation

Express the following set of simultaneous equations as a matrix equation:

### Answer

Before we begin, we should note that there are 3 equations and 3 variables: , , and . This means that the coefficient matrix will be of order . Our goal will be to find the matrix equation of the form which reproduces the system of linear equations in the statement of the question.

We begin by taking the first of the three given equations, which is

By using the definition of matrix multiplication, we can populate the first row of the coefficient matrix as

We still need to take the second and third lines in the system of equations and write these into the coefficient matrix. The second equation is which we can embed into the second row of the coefficient matrix, crucially without changing the first row. This gives

Now, we only have the third equation, which we can write into the third row of the coefficient matrix without affecting the entries in the two rows above. This gives

This represents the full representation of the system of linear equations in matrix form.

Let us finish by recapping a few important concepts from the explainer.

### Key Points

- Given a system of equations, we can write an equivalent matrix equation of the form . Here is the coefficient matrix, is the variable matrix, and is the constant matrix.
- A system of equations is in standard form if
- all variables are on the left-hand sides,
- all constants are on the right-hand sides,
- variables are arranged in alphabetical order (or the order specified in the variable matrix).

- The order of the coefficient matrix from an equivalent system of equations is given by
- Consider a system of linear equations with unknowns given by This system of equations can be written as the matrix equation