# Solving Linear equations using matrices/determinants

Math > Math Concepts >Algebra2  >  Linear Equations, Matrices and Determinants

 Topic Index Math - math concepts - by grade level Math Help - Math Help Forum - Math Tutoring - Math Blog for K-12 Math Games - Math Games Math Worksheets - math worksheets Math Books - Used Textbooks Resources - The Math Forum

## Using Matrices and Determinants to solve Linear Equations

First review: linear systems

Solve the following linear system of equations (3 methods shown):

 method 1: elimination and backward substitution: 3x + 4y = 20 2x - 10y = 8 first solve equation 1 for x and get x = (20 - 4y) / 3 substitute this into the second equation and solve for y 2 ( 20 – 4y )/ 3 - 10y = 8 40 – 8y - 30y = 24 y = 16 / 38 = 8 / 19 substitute this value for into the first equation: 3x + 4 (8 / 19) = 20 57x + 32 = 380 x = 348 / 57 = 116 / 19 check: 3( 116/19 ) + 4(8/19) = (348+32)/19 = 380/19 = 20. (either equation can be used) method 2: cancel terms by multiplying constants and adding equations 2{ 3x + 4y = 20} multiple the first equation by 2, and the second by -3, then add -3{2x - 10y = 8} after multiplication 6x + 8y = 40 -6x +30y = -24 now add 0x +38y = -16 38y = -16 y = -16/38 = -8/19 Now substitute this result back into either equation and solve for x. Instead let's use the multiplication technique to solve for x 5{ 3x + 4y = 20} 2{2x - 10y = 8} multiply the equations as shown to eliminate y 15x + 20y = 100 4x -20y = 16 now add the equations 19x +0 = 116 solve for x x = 116/19

 method 3: make coefficients along the diagonal 1 and all others zero. Original equations 3x + 4y = 20 2x -10y = 8 1 divide 1st equation by 3 1x + 4/3 y = 20/3 2x - 10y = 8 2 multiply 1st equation by -2 then add to second equation (to make that coefficient 0) -2x -8/3y = -40/3 0x -38/3 y = -16/3 3 rewrite the equations 1x + 4/3y = 20/3 -38/3y = -16/3 4 multiply the 2nd equation by -3/38 1 y = 16/38 = 8/19 5 rewrite the equations x + 4/3y = 20/3 the diagonals are both 1 now 1y = -8/19 6 multiply the 2nd equation by -4/3 and add the the first to eliminate the y term in the first equation -4/3y = -32/57 1x + 0y = 348/57 = 116/19 7 rewrite the equations x = 116/19 y = -8/19 Notice, that once we get coefficients equal to one along the diagonal and zero elsewhere we have the solution to the system.

Notice that the denominator is the same for x and y, 19. This is always the case. Also there is a relationship between the x and y coefficients that will yield the numerators of the answers. To see this we'll represent this system with a matrix. Using a matrix and its determinate can make solving systems of linear equations faster then the previous two methods. The formulas obtained are for explanation only! We will use visualization instead as explained later.

First, let's talk about matrices: (mā' - trə - sēs)

A matrix is a table of elements. These elements can be just about anything, usually the same class of objects. Addition, subtraction, multiplication, division and multiplication by a constant are defined for matrices. ( These operations will be discussed in a later course and are not important for their application solving linear systems of equations.)

Here are some matrices:

The first matrix has 2 rows and 2 columns: row one contains the elements 1 and 2, row two contains the elements 3 and 4

and 2 columns: column 1 contains the elements 1 and 3 and column 2 contains the elements 2 and 4.

The second matrix has only one row.

The third matrix has only one column.

The fourth matrix has two rows and three columns. This matrix is of interest for us to solve the previous system of linear equations.

In general terms it's customary to write the elements in a matrix for reference like so:

aij where i is the row number and j is the column number, both starting from 1.

for example:

So in the example matrices above, consider the first matrix:

a11 = 1    a12 = 2    a21 = 3    a22 = 4

Every matrix has a value associated with it called the determinant. It is found by multiplying crossing diagonals in a certain way. First it is represented like a matrix but instead of using parenthesis, vertical bars are used like so:

The determinate is found like so: ( a11 • a22 ) – ( a21 • a12 )

An easy way to remember how to calculate a determinant is visualizing the previous diagram. Note the direction of the arrows and the plus and minus signs.

Start at 1, multiply the elements along the diagonal starting at 1. Multiply the elements along the second diagonal starting at 2 and subtract that from the first product.

This method of solving linear equations is known as Cramer's Rule.

Now let's solve the previous system of equations.

First let's write our two equations in terms of a matrix, but before we do this let's simplify and reduce the equations as much as possible. Doing this will make the necessary calculations easier to do.

original:

3x + 4y = 20

2x - 10y = 8

The second equation can have a 2 factored out and we get:

3x + 4y = 20

x – 5y = 4

This matrix is the coefficients of the variables.

Now evaluate the determinant:

(3) ( -5 ) - (1)( 4) = – 15 – 4 = – 19

-19 is the denominator of the solutions for x and y. If this number is ever 0, then there is no solution to the system of equations.

Now the solutions for x and y also have similar determinants:

First x: replace the x column with the b column:

we have (20)(-5) - (4)(4) = -100 -16 = -116

Since this is the numerator for x we have x = -116/-19 = 116/19

Now for y:

Numerator for y is (3)(4) - (1)(20)

12 - 20 = -8

So y = -8 / -19 = 8/19

Solution is (116/19, 8/18)

Example: solve

5x + 4y = 42

-3x + y = -12

now mentally visualize the 3 determinants

the denominator is: (5)(1) - (-3)(4) = 5 + 12 = 17

the numerator for x is (42)(1) - (-12)(4) = 42 + 48 = 90

then numerator for y is (5)(-12) - (-3)(42) = -60 +126 = 66

solution x = 90/17, y = 66/17

check: 5(90/17) + 4(66/17) = 714/17 = 42

Another example:

2x – 5y = 16

x + 4y = 20

denominator: (2)(4) – (1)(-5) = 8 + 5 = 13

x: (4)(16) - (20)(-5) = 64 + 100 = 164

y: (2)(20) - (1)(16) = 40 -16 = 24

solution: x = 164/13 y = 24/13

check 2nd eq: 164/13 + 4*24/13 = (164 + 96)/13 = 260 / 13 = 20

Here's an alternate visualization (equivalent to before) to remember how to calculate the numerators for x and y.

If you look closely to the way we crossed out columns, what remains is the y or x column and the b column. In effect the b column replaces the column of the variable of interest. So what remains is:

for x:

for y:

If you carry out the multiplications and additions on these determinants as normal, you will find the same formulas given earlier.

Important note here: Do not memorize the formulas!!! Use visualization instead!

Solve a linear system of equations of 3 variables, x, y, and z.

The previous method will work (theoretically this is true for any number of variables, but practically becomes cumbersome and better techniques are available.)

Solve:

4x + y + z = 0

3x - y + z = -2

x + y + 2z = - 1

matrix:

determinant:

for the denominator we must find the value of the determinant:

The quickest way to evaluate this 3 by 3 determinant is to use Sarrus' rule. We'll copy the first two columns in the determinant past the last column to create 6 diagonals with 3 elements apiece then multiply them and add or subtract for the result.

Notice, in dark black are the columns of the original determinant. The first two columns are repeated in green as columns 4 and 5. We've 'augmented' this determinant so that we can create diagonals with 3 elements each. Now we need to multiple the elements for each diagonal and add the red diagonals together and subtract the blue diagonals from that sum. (Zero products will be shown in this example only for clarity.)

(4)(-1)(2) + (1)(1)(1) + (1)(3)(1) - (1)(-1)(1) - (1)(1)(4) - (2)(3)(1)

-8 + 1 + 3 + 1 - 4 - 6 = -13 ( which is the denominator)

Now x: (first column is replaced with the b column)

(0)(-1)(2) + (1)(1)(-1) + (1)(-2)(1) - (-1)(-1)(1) - (1)(1)(0) - (2)(-2)(1)

0 -1 - 2 - 1 - 0 + 4 = 0

Now y:

(4)(-2)(2) + (0)(1)(1) + (1)(3)(-1) - (1)(-2)(1) - (-1)(1)(4) - (2)(3)(0)

-16 + 0 - 3 + 2 + 4 - 0 = -13

Now z:

(4)(-1)(-1) + (1)(-2)(1) + (0)(3)(1) - (1)(-1)(0) - (1)(-2)(4) - (-1)(3)(1)

4 - 2 + 0 - 0 + 8 + 3 = 13

x = 0, y = -13/-13 = 1, z = 13/-13 = -1

(x,y,z) = (0, 1, -1)

Verify that this solution does solve the three original equations.

Below are the plots of these three planes, showing how each pair intersect in a line then how all three intersect in one point.

about us | site index | topic index