Every­thing in this course comes together here. A sys­tem of lin­ear equa­tions can be writ­ten as one matrix equa­tion AX=BAX = B, and then solved in three ways: by the inverse matrix, by Cramer's rule using deter­mi­nants, or by row oper­a­tions (the Gauss-Jor­dan method). The deter­mi­nant of AA also tells you in advance whether the sys­tem has exactly one solu­tion. This les­son works through each method on the same sys­tems so that you can com­pare them.

Writ­ing a sys­tem as a matrix equa­tion

Take the sys­tem

2x+3y=8,x−y=−12x + 3y = 8, \qquad x - y = -1

Col­lect the coef­fi­cients, the unknowns and the con­stants into matri­ces:

A=[231−1],X=[xy],B=[8−1]A = \begin{bmatrix} 2 & 3 \\ 1 & -1 \end{bmatrix}, \qquad X = \begin{bmatrix} x \\ y \end{bmatrix}, \qquad B = \begin{bmatrix} 8 \\ -1 \end{bmatrix}

Mul­ti­ply­ing out, AX=[2x+3yx−y]AX = \begin{bmatrix} 2x + 3y \\ x - y \end{bmatrix}, so the sys­tem is exactly the sin­gle equa­tion AX=BAX = B. Here AA is called the coef­fi­cient matrix.

Method 1: the inverse matrix

If ∣A∣≠0|A| \neq 0, mul­ti­ply both sides of AX=BAX = B on the left by A−1A^{-1}:

A−1AX=A−1B  ⟹  IX=A−1B  ⟹  X=A−1BA^{-1}AX = A^{-1}B \implies IX = A^{-1}B \implies X = A^{-1}B

The sys­tem then has exactly one solu­tion. (The mul­ti­pli­ca­tion must be on the left of both sides, because matrix mul­ti­pli­ca­tion is not com­mu­ta­tive.)

Exam­ple 1

Solve 2x+3y=82x + 3y = 8, x−y=−1x - y = -1 by the inverse matrix.

∣A∣=−2−3=−5≠0|A| = -2 - 3 = -5 \neq 0, so

A−1=1−5[−1−3−12]=15[131−2]\displaystyle A^{-1} = \frac{1}{-5}\begin{bmatrix} -1 & -3 \\ -1 & 2 \end{bmatrix} = \frac{1}{5}\begin{bmatrix} 1 & 3 \\ 1 & -2 \end{bmatrix}

X=A−1B=15[131−2][8−1]=15[8−38+2]=15[510]=[12]\displaystyle X = A^{-1}B = \frac{1}{5}\begin{bmatrix} 1 & 3 \\ 1 & -2 \end{bmatrix}\begin{bmatrix} 8 \\ -1 \end{bmatrix} = \frac{1}{5}\begin{bmatrix} 8 - 3 \\ 8 + 2 \end{bmatrix} = \frac{1}{5}\begin{bmatrix} 5 \\ 10 \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}

So x=1x = 1, y=2y = 2. Check: 2+6=82 + 6 = 8 and 1−2=−11 - 2 = -1.

Exam­ple 2

Solve by the inverse matrix:

x+2y+z=8,2x−y+z=3,x+y−z=0x + 2y + z = 8, \qquad 2x - y + z = 3, \qquad x + y - z = 0

Here A=[1212−1111−1]A = \begin{bmatrix} 1 & 2 & 1 \\ 2 & -1 & 1 \\ 1 & 1 & -1 \end{bmatrix} and B=[830]B = \begin{bmatrix} 8 \\ 3 \\ 0 \end{bmatrix}.

∣A∣=1(1−1)−2(−2−1)+1(2+1)=0+6+3=9|A| = 1(1 - 1) - 2(-2 - 1) + 1(2 + 1) = 0 + 6 + 3 = 9

Work­ing out the nine cofac­tors and trans­pos­ing gives

adj A=[0333−2131−5]\text{adj}\,A = \begin{bmatrix} 0 & 3 & 3 \\ 3 & -2 & 1 \\ 3 & 1 & -5 \end{bmatrix}

X=19[0333−2131−5][830]=19[0+9+024−6+024+3+0]=19[91827]=[123]\displaystyle X = \frac{1}{9}\begin{bmatrix} 0 & 3 & 3 \\ 3 & -2 & 1 \\ 3 & 1 & -5 \end{bmatrix}\begin{bmatrix} 8 \\ 3 \\ 0 \end{bmatrix} = \frac{1}{9}\begin{bmatrix} 0 + 9 + 0 \\ 24 - 6 + 0 \\ 24 + 3 + 0 \end{bmatrix} = \frac{1}{9}\begin{bmatrix} 9 \\ 18 \\ 27 \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix}

So x=1x = 1, y=2y = 2, z=3z = 3. Check in the first equa­tion: 1+4+3=81 + 4 + 3 = 8.

Method 2: Cramer's rule

Let Δ=∣A∣\Delta = |A|, and let Δ1\Delta_1, Δ2\Delta_2, Δ3\Delta_3 be the deter­mi­nants obtained by replac­ing the first, sec­ond and third columns of AA by the col­umn of con­stants BB. If Δ≠0\Delta \neq 0,

x=Δ1Δ,y=Δ2Δ,z=Δ3Δ\displaystyle x = \frac{\Delta_1}{\Delta}, \qquad y = \frac{\Delta_2}{\Delta}, \qquad z = \frac{\Delta_3}{\Delta}

For two unknowns, use Δ1\Delta_1 and Δ2\Delta_2 only.

Exam­ple 3

Solve 2x+3y=82x + 3y = 8, x−y=−1x - y = -1 by Cramer's rule.

Δ=∣231−1∣=−5,Δ1=∣83−1−1∣=−8+3=−5,Δ2=∣281−1∣=−2−8=−10\Delta = \begin{vmatrix} 2 & 3 \\ 1 & -1 \end{vmatrix} = -5, \quad \Delta_1 = \begin{vmatrix} 8 & 3 \\ -1 & -1 \end{vmatrix} = -8 + 3 = -5, \quad \Delta_2 = \begin{vmatrix} 2 & 8 \\ 1 & -1 \end{vmatrix} = -2 - 8 = -10

So x=−5−5=1\displaystyle x = \frac{-5}{-5} = 1 and y=−10−5=2\displaystyle y = \frac{-10}{-5} = 2, as before.

Exam­ple 4

Solve the sys­tem of Exam­ple 2 by Cramer's rule.

Δ=9\Delta = 9 from Exam­ple 2. Replac­ing each col­umn in turn by [830]\begin{bmatrix} 8 \\ 3 \\ 0 \end{bmatrix}:

Δ1=∣8213−1101−1∣=8(1−1)−2(−3−0)+1(3−0)=0+6+3=9\Delta_1 = \begin{vmatrix} 8 & 2 & 1 \\ 3 & -1 & 1 \\ 0 & 1 & -1 \end{vmatrix} = 8(1 - 1) - 2(-3 - 0) + 1(3 - 0) = 0 + 6 + 3 = 9

Δ2=∣18123110−1∣=1(−3−0)−8(−2−1)+1(0−3)=−3+24−3=18\Delta_2 = \begin{vmatrix} 1 & 8 & 1 \\ 2 & 3 & 1 \\ 1 & 0 & -1 \end{vmatrix} = 1(-3 - 0) - 8(-2 - 1) + 1(0 - 3) = -3 + 24 - 3 = 18

Δ3=∣1282−13110∣=1(0−3)−2(0−3)+8(2+1)=−3+6+24=27\Delta_3 = \begin{vmatrix} 1 & 2 & 8 \\ 2 & -1 & 3 \\ 1 & 1 & 0 \end{vmatrix} = 1(0 - 3) - 2(0 - 3) + 8(2 + 1) = -3 + 6 + 24 = 27

So x=99=1\displaystyle x = \frac{9}{9} = 1, y=189=2\displaystyle y = \frac{18}{9} = 2, z=279=3\displaystyle z = \frac{27}{9} = 3.

Method 3: Gauss-Jor­dan (row oper­a­tions)

Write the aug­mented matrix [A∣B][A \mid B]: the coef­fi­cient matrix with the con­stants as an extra col­umn. Then use row oper­a­tions, which do not change the solu­tions:

  • inter­change two rows;
  • mul­ti­ply a row by a non-zero num­ber;
  • add a mul­ti­ple of one row to another.

Aim to turn the left part into II; the last col­umn then shows the solu­tion.

Exam­ple 5

Solve the sys­tem of Exam­ple 2 by the Gauss-Jor­dan method.

[12182−11311−10]\left[\begin{array}{ccc|c} 1 & 2 & 1 & 8 \\ 2 & -1 & 1 & 3 \\ 1 & 1 & -1 & 0 \end{array}\right]

R2→R2−2R1R_2 \to R_2 - 2R_1 and R3→R3−R1R_3 \to R_3 - R_1:

[12180−5−1−130−1−2−8]\left[\begin{array}{ccc|c} 1 & 2 & 1 & 8 \\ 0 & -5 & -1 & -13 \\ 0 & -1 & -2 & -8 \end{array}\right]

Inter­change R2R_2 and R3R_3, then mul­ti­ply the new R2R_2 by −1-1:

[121801280−5−1−13]\left[\begin{array}{ccc|c} 1 & 2 & 1 & 8 \\ 0 & 1 & 2 & 8 \\ 0 & -5 & -1 & -13 \end{array}\right]

R1→R1−2R2R_1 \to R_1 - 2R_2 and R3→R3+5R2R_3 \to R_3 + 5R_2:

[10−3−8012800927]\left[\begin{array}{ccc|c} 1 & 0 & -3 & -8 \\ 0 & 1 & 2 & 8 \\ 0 & 0 & 9 & 27 \end{array}\right]

R3→19R3\displaystyle R_3 \to \frac{1}{9}R_3, then R1→R1+3R3R_1 \to R_1 + 3R_3 and R2→R2−2R3R_2 \to R_2 - 2R_3:

[100101020013]\left[\begin{array}{ccc|c} 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 2 \\ 0 & 0 & 1 & 3 \end{array}\right]

So x=1x = 1, y=2y = 2, z=3z = 3.

When is there exactly one solu­tion?

  • If ∣A∣≠0|A| \neq 0, the sys­tem has exactly one solu­tion, and all three meth­ods find it.
  • If ∣A∣=0|A| = 0, the inverse and Cramer's rule can­not be used. The sys­tem then has either no solu­tion or infi­nitely many solu­tions. For exam­ple, x+2y=3x + 2y = 3 and 2x+4y=72x + 4y = 7 have ∣A∣=4−4=0|A| = 4 - 4 = 0; dou­bling the first gives 2x+4y=62x + 4y = 6, which con­tra­dicts the sec­ond, so there is no solu­tion. But x+2y=3x + 2y = 3 and 2x+4y=62x + 4y = 6 are the same equa­tion, with infi­nitely many solu­tions.

Exam­ple 6

Sita buys 22 pens and 33 note­books for ₹110, and Ravi buys 33 pens and 11 note­book for ₹60. Find the price of a pen and of a note­book.

Let a pen cost ₹pp and a note­book ₹nn: 2p+3n=1102p + 3n = 110 and 3p+n=603p + n = 60.

Δ=∣2331∣=2−9=−7,Δ1=∣1103601∣=110−180=−70,Δ2=∣2110360∣=120−330=−210\Delta = \begin{vmatrix} 2 & 3 \\ 3 & 1 \end{vmatrix} = 2 - 9 = -7, \quad \Delta_1 = \begin{vmatrix} 110 & 3 \\ 60 & 1 \end{vmatrix} = 110 - 180 = -70, \quad \Delta_2 = \begin{vmatrix} 2 & 110 \\ 3 & 60 \end{vmatrix} = 120 - 330 = -210

So p=−70−7=10\displaystyle p = \frac{-70}{-7} = 10 and n=−210−7=30\displaystyle n = \frac{-210}{-7} = 30: a pen costs ₹10 and a note­book ₹30.

Prac­tice

  1. Solve 3x−2y=43x - 2y = 4, x+4y=6x + 4y = 6 by the inverse matrix.
  2. Solve 5x+2y=15x + 2y = 1, 3x+y=13x + y = 1 by Cramer's rule.
  3. Solve x+y+z=9x + y + z = 9, 2x−y+z=52x - y + z = 5, x+2y−z=4x + 2y - z = 4 by Cramer's rule.
  4. Solve 2x+y−z=32x + y - z = 3, x−y+z=6x - y + z = 6, x+2y+3z=7x + 2y + 3z = 7 by any method.
  5. Does the sys­tem x+2y=3x + 2y = 3, 2x+4y=52x + 4y = 5 have a unique solu­tion? Explain.
  6. Two kg of apples and one kg of oranges cost ₹130; one kg of apples and three kg of oranges cost ₹140. Find the price per kg of each.
  7. The ages of Ravi, Sita and Gopi add up to 6666. Ravi is 44 years older than Sita, and Sita is 77 years older than Gopi. Find their ages using matri­ces.
  8. Solve the sys­tem of ques­tion 3 by the Gauss-Jor­dan method.

Answers

Show answers
  1. ∣A∣=12+2=14|A| = 12 + 2 = 14, A−1=114[42−13]\displaystyle A^{-1} = \frac{1}{14}\begin{bmatrix} 4 & 2 \\ -1 & 3 \end{bmatrix}, and X=114[16+12−4+18]=[21]\displaystyle X = \frac{1}{14}\begin{bmatrix} 16 + 12 \\ -4 + 18 \end{bmatrix} = \begin{bmatrix} 2 \\ 1 \end{bmatrix}. So x=2x = 2, y=1y = 1.
  2. Δ=5−6=−1\Delta = 5 - 6 = -1, Δ1=1−2=−1\Delta_1 = 1 - 2 = -1, Δ2=5−3=2\Delta_2 = 5 - 3 = 2. So x=1x = 1, y=−2y = -2.
  3. Δ=1(1−2)−1(−2−1)+1(4+1)=7\Delta = 1(1 - 2) - 1(-2 - 1) + 1(4 + 1) = 7. Δ1=14\Delta_1 = 14, Δ2=21\Delta_2 = 21, Δ3=28\Delta_3 = 28. So x=2x = 2, y=3y = 3, z=4z = 4.
  4. ∣A∣=−15|A| = -15; the solu­tion is x=3x = 3, y=−1y = -1, z=2z = 2. (Check: 6−1−2=36 - 1 - 2 = 3, 3+1+2=63 + 1 + 2 = 6, 3−2+6=73 - 2 + 6 = 7.)
  5. No. ∣A∣=4−4=0|A| = 4 - 4 = 0, and dou­bling the first equa­tion gives 2x+4y=62x + 4y = 6, which con­tra­dicts 2x+4y=52x + 4y = 5. There is no solu­tion.
  6. 2a+r=1302a + r = 130 and a+3r=140a + 3r = 140, with Δ=6−1=5\Delta = 6 - 1 = 5, Δ1=390−140=250\Delta_1 = 390 - 140 = 250, Δ2=280−130=150\Delta_2 = 280 - 130 = 150. Apples ₹50 per kg, oranges ₹30 per kg.
  7. With ages rr, ss, gg: r+s+g=66r + s + g = 66, r−s=4r - s = 4, s−g=7s - g = 7. Solv­ing gives g=16g = 16, s=23s = 23, r=27r = 27.
  8. After R2→R2−2R1R_2 \to R_2 - 2R_1 and R3→R3−R1R_3 \to R_3 - R_1 the rows are (1,1,1∣9)(1, 1, 1 \mid 9), (0,−3,−1∣−13)(0, -3, -1 \mid -13), (0,1,−2∣−5)(0, 1, -2 \mid -5). Con­tin­u­ing to reduce the left part to II gives the last col­umn (2,3,4)(2, 3, 4), so x=2x = 2, y=3y = 3, z=4z = 4.