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:

2x1 + 3x2 - x3  =  4
x1 - x2 + 3x3  =  -5
2x2 - 5x3  =  3

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

2x2 - 5x3 = 0x1 + 2x2 - 5x3 = 3

If we organize the coefficients of x1, x2, and x3 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 x1, x2, x3 is the same as finding a vector x = [x1, x2, x3]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.