# Solving linear systems

Matrices can be used to describe a linear system of equations as well as solve them using matrix multiplication. Say we are given a system of n linear equations and n unknowns:

2x_{1} + 3x_{2} - x_{3} |
= | 4 |

x_{1} - x_{2} + 3x_{3} |
= | -5 |

2x_{2} - 5x_{3} |
= | 3 |

In this case, n = 3. Whenever we have missing variables, such as in the last equation, 2x_{2} - 5x_{3} = 3, we can artificially introduce x_{1} into the equation by setting the coefficient of x_{1} to 0. In other words,

2x_{2} - 5x_{3} = 0x_{1} + 2x_{2} - 5x_{3} = 3

If we organize the coefficients of x_{1}, x_{2}, and x_{3} into a matrix A, we get:

If we organize the constants on the right-hand side of each equation into a column vector b, we get

Then in the language of matrix multiplication, solving for x_{1}, x_{2}, x_{3} is the same as finding a vector x = [x_{1}, x_{2}, x_{3}]^{T} such that

which is eqivalent to Ax = b. We can use Gaussian elimination on the augmented matrix,

which through Gaussian elimination reduces to:

Therefore,

See also matrix notation.