Stat Trek

Teach yourself statistics

Stat Trek

Teach yourself statistics


Simultaneous Linear Equations

This lesson explains how to use matrix methods to (1) represent a system of linear equations compactly and (2) solve simulataneous linear equations efficiently.

How to Represent a System of Linear Equations In Matrix Form

Suppose you have n linear equations with n unknowns. Using ordinary algebra, those equations might be expressed as:

A11x1 + A12x2 + A13x3 + . . . + A1nxn = y1
A21x1 + A22x2 + A23x3 + . . . + A2nxn = y2
A31x1 + A32x2 + A33x3 + . . . + A3nxn = y3
. . .
An1x1 + An2x2 + An3x3 + . . . + Annxn = yn

where

xj is an unknown value
Aij is the known coefficient of xj in equation i
yj is a known quantity in equation j

This set of equations can be expressed compactly in matrix form as follows:

Ax = y

where

x is an n x 1 column vector of unknown values x1, x2, . . . , xn
A is an n x n matrix of the known coefficients Aij
y is an n x 1 column vector of known values y1, y2, . . . , yn

How to Solve Simultaneous Linear Equations Using Matrix Methods

Here is how to solve a system of n linear equations in n unknowns, using matrix methods.

  • Express the set of n linear equations compactly in matrix form.

    Ax = y

  • Premultiply both sides of the equation by A-1, the inverse of A.

    A-1Ax = A-1y

  • Since A-1Ax = Ix = x, we know the following.

    x = A-1y

Thus, as long as the inverse A-1 exists, we can solve for x, the vector of unknown values. If the inverse does not exist, the set of equations does not have a unique solution.

Solving Simultaneous Linear Equations: An Example

To illustrate how to solve simultaneous linear equations using matrix methods, consider the following system of equations.

  x1 + 2x2 + 2x3 = 1
2x1 + 2x2 + 2x3 = 2
  2x1 + 2x2 + x3 = 3

We want to solve for the unknown quantities: x1, x2, and x3.

  • Our first step is to express these equations in matrix form as Ax = y.
1 2 2
2 2 2
2 2 1
 
x1
x2
x3
   =   
1
2
3
A x y
  • Next, we premultiply both sides of the equation by A-1, the inverse of matrix A. This results in the following relationship.

    A-1Ax = A-1y

    Recall that we showed how to find the inverse of matrix A in a previous lesson.

  • And finally, since A-1Ax = Ix = x, we know that x = A-1y. Thus,
x1
x2
x3
   =   
-1 1 0
1 -1.5 1
0 1 -1
 
1
2
3
   =   
1
1
-1
x A-1 y

Thus, we have solved for the unknown quantities: x1 = 1, x2 = 1, and x3 = -1.

Test Your Understanding

Problem 1

Consider the following system of linear equations.

  3x1 + x2 = 3
9x1 + 4x2 = 6

Using matrix methods, solve for the unknown quantities: x1and x2.

Solution

Our solution involves a three-step process.

  • The first step is to express these equations in matrix form as Ax = y.
3 1
9 4
 
x1
x2
   =   
3
6
A x y
  • Next, we premultiply both sides of the equation by A-1, the inverse of matrix A. This results in the following relationship.

    A-1Ax = A-1y

    Recall that we showed how to find the inverse of matrix A in a previous lesson.

  • And finally, since A-1Ax = Ix = x, we know the following.
x1
x2
   =   
4/3 -1/3
-3 1
 
3
6
   =   
2
-3
x A-1 y

Thus, we have solved for the unknown quantities: x1 = 2 and x2 = -3.