- Foundation
- About 20 min
- 5 practice questions
Solving systems of linear equations by the matrix method
Write a system of linear equations as AX = B, solve it by X = A⁻¹B when |A| ≠ 0, and decide consistency when |A| = 0 using (adj A)B.
If something looks wrong, please tell us.
By the end of this lesson you can
- Express a system of two or three linear equations as AX = B.
- Solve it as X = A⁻¹B when A is non-singular.
- Classify a system with |A| = 0 as inconsistent or as having infinitely many solutions.
Matrices were invented to handle systems of equations compactly, and this is where everything in the last two chapters comes together. Once a system is written as one matrix equation AX = B, the inverse of A solves it in a single step, and the determinant tells us in advance whether a unique solution exists.
Notation: a matrix or determinant is written row by row, with entries separated by spaces and rows by semicolons. So |2 −3; 4 5| is the determinant of the 2 × 2 matrix with rows (2, −3) and (4, 5).
Writing the system as AX = B
The system a₁x + b₁y + c₁z = d₁, a₂x + b₂y + c₂z = d₂, a₃x + b₃y + c₃z = d₃ is AX = B, where A = [a₁ b₁ c₁; a₂ b₂ c₂; a₃ b₃ c₃] is the coefficient matrix, X = [x; y; z] and B = [d₁; d₂; d₃]. A system is consistent if it has at least one solution and inconsistent if it has none.
Case 1: |A| ≠ 0
Then A⁻¹ exists. Pre-multiplying AX = B by A⁻¹: A⁻¹(AX) = A⁻¹B ⇒ (A⁻¹A)X = A⁻¹B ⇒ IX = A⁻¹B ⇒ X = A⁻¹B. Since the inverse is unique, the system has a unique solution. Note the order: A⁻¹B, not BA⁻¹ (which is not even defined for a column B).
Case 2: |A| = 0
Compute (adj A)B. If (adj A)B ≠ O, the system is inconsistent (no solution). If (adj A)B = O, the system may have infinitely many solutions or none; for the two-variable examples in this lesson, (adj A)B = O comes with infinitely many solutions, which you can confirm by seeing that one equation is a multiple of the other.
Classifying the system AX = B
-
|A| ≠ 0
- Consistent
- Unique solution X = A⁻¹B
-
|A| = 0 and (adj A)B ≠ O
- Inconsistent
- No solution
-
|A| = 0 and (adj A)B = O
- Infinitely many solutions or none
- Check the equations directly
AX = B with |A| ≠ 0 ⇒ X = A⁻¹B = (1/|A|)(adj A)B, the unique solution.
Worked examples
Worked example 1 (two variables). Solve 3x + 2y = 8 and 5x − 4y = 6. Working: A = [3 2; 5 −4], |A| = −12 − 10 = −22 ≠ 0. adj A = [−4 −2; −5 3]. X = (1/−22)[−4 −2; −5 3][8; 6] = (1/−22)[−32 − 12; −40 + 18] = (1/−22)[−44; −22] = [2; 1]. So x = 2, y = 1. Check: 6 + 2 = 8 ✓; 10 − 4 = 6 ✓.
Worked example 2 (three variables). Solve x + 2y − z = 2, 3x + 2z = 9, 4x + y + z = 9. Working: A = [1 2 −1; 3 0 2; 4 1 1], whose inverse we found in Lesson 4: A⁻¹ = (1/5)[−2 −3 4; 5 5 −5; 3 7 −6]. With B = [2; 9; 9]: X = (1/5)[−4 − 27 + 36; 10 + 45 − 45; 6 + 63 − 54] = (1/5)[5; 10; 15] = [1; 2; 3]. So x = 1, y = 2, z = 3. Check the second equation: 3 + 6 = 9 ✓.
Worked example 3 (inconsistent). x + 2y = 3 and 2x + 4y = 7. Working: |A| = 4 − 4 = 0. adj A = [4 −2; −2 1], and (adj A)B = [12 − 14; −6 + 7] = [−2; 1] ≠ O, so the system is inconsistent. Indeed, doubling the first equation gives 2x + 4y = 6, which contradicts 2x + 4y = 7: the lines are parallel.
Worked example 4 (infinitely many). x + 2y = 3 and 2x + 4y = 6. Here (adj A)B = [12 − 12; −6 + 6] = O, and the second equation is just twice the first, so every point on the line x + 2y = 3 is a solution: infinitely many solutions.
Worked example 5 (made-up prices). A stationery shop sells a pen for ₹x, a pencil for ₹y and an eraser for ₹z. One pen, one pencil and one eraser cost ₹20; two pens, three pencils and one eraser cost ₹42; one pen, two pencils and four erasers cost ₹34. Working: A = [1 1 1; 2 3 1; 1 2 4], B = [20; 42; 34]. |A| = 1(12 − 2) − 1(8 − 1) + 1(4 − 3) = 10 − 7 + 1 = 4. The cofactors give adj A = [10 −2 −2; −7 3 1; 1 −1 1]. X = (1/4)[200 − 84 − 68; −140 + 126 + 34; 20 − 42 + 34] = (1/4)[48; 20; 12] = [12; 5; 3]. So a pen costs ₹12, a pencil ₹5 and an eraser ₹3 (check: 12 + 5 + 3 = 20 ✓).
Key takeaways: write the system as AX = B. If |A| ≠ 0, the unique solution is X = A⁻¹B. If |A| = 0, compute (adj A)B: non-zero means no solution; zero means look again (in two variables, infinitely many solutions when the equations are multiples).
Check your understanding
-
1. Which matrix equation represents 2x − y = 5 and x + 3y = 6?
- [2 1; −1 3][x; y] = [5; 6]
- [2 −1; 1 3][x; y] = [6; 5]
- [x; y][2 −1; 1 3] = [5; 6]
- [2 −1; 1 3][x; y] = [5; 6]
Show answer
Answer: D. Rows of A are the coefficients of each equation in order: (2, −1) and (1, 3). X = [x; y] and B = [5; 6] in the same order as the equations.
-
2. Solve by the matrix method: 2x + 3y = 7 and 3x − y = 5.
- x = 1, y = 2
- x = 2, y = 1
- x = 2, y = −1
- x = −2, y = 1
Show answer
Answer: B. |A| = 2(−1) − 3 × 3 = −11. adj A = [−1 −3; −3 2]. X = (1/−11)[−7 − 15; −21 + 10] = (1/−11)[−22; −11] = [2; 1]. Check: 4 + 3 = 7 and 6 − 1 = 5.
-
3. What can be said about the system x + y = 2, 2x + 2y = 5?
- It has a unique solution
- It has infinitely many solutions
- It is inconsistent
- It has exactly two solutions
Show answer
Answer: C. |A| = 2 − 2 = 0. adj A = [2 −1; −2 1] and (adj A)B = [4 − 5; −4 + 5] = [−1; 1] ≠ O, so there is no solution. (Doubling the first gives 2x + 2y = 4, not 5.)
-
4. For a system AX = B with A⁻¹ = [1 −1 0; 0 1 −1; 0 0 1] and B = [3; 2; 1], what is X?
- [1; 1; 1]
- [3; 2; 1]
- [1; 2; 1]
- [2; 1; 1]
Show answer
Answer: A. X = A⁻¹B = [3 − 2 + 0; 0 + 2 − 1; 0 + 0 + 1] = [1; 1; 1].
-
5. Assertion (A): If |A| ≠ 0, the system AX = B has exactly one solution.
Reason (R): If |A| ≠ 0, A⁻¹ exists and is unique, so X = A⁻¹B is the only solution.- Both A and R are true, and R is the correct explanation of A
- Both A and R are true, but R is not the correct explanation of A
- A is true but R is false
- A is false but R is true
Show answer
Answer: A. When |A| ≠ 0, A is invertible; pre-multiplying by A⁻¹ forces X = A⁻¹B, and because the inverse is unique, so is X. R explains A.
Sign in to keep track of the lessons you finish.