Solving systems with the inverse and Cramer's rule ·… | StemPy Lab
Course 8.3·Lesson 2 of 3
Solving systems with the inverse and Cramer's rule
A system of linear equations can be written AX=B. If ∣A∣=0
Lesson 2 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
What you will be able to do
write a system of linear equations as AX=B;
solve a system with a non-zero determinant by the inverse;
decide whether a system has one solution, none or infinitely many;
use Cramer's rule, as taught in A-Level and IB.
A system as one matrix equation
A shop sells pens and notebooks. Two pens and one notebook cost 11 rupees. Five pens and three notebooks cost 28 rupees. With p for the price of a pen and n for a notebook:
2p+n=11,5p+3n=28.
Matrix multiplication packs both equations into one:
[2513][pn]=[1128],AX=B.
A is the coefficient matrix, X holds the unknowns and B the constants.
Solving with the inverse
If ∣A∣=0, multiply both sides on the left by A−1:
A−1AX=A−1B⟹X=A−1B.
Here ∣A∣=6−5=1 and $A^{-1} =
[3−5−12]
$. So
X=[3−5−12][1128]=[33−28−55+56]=[51].
A pen costs 5 rupees and a notebook costs 1 rupee. Always multiply by A−1 on the left of B, because the order of matrix products matters.
The same method works for three unknowns. A museum sells child tickets (x euros), student tickets (y euros) and adult tickets (z euros). Three groups pay 110, 80 and 60 euros:
Three small graphs of two straight lines each. On the left the lines cross at one point, labelled one solution. In the middle the two lines are parallel and distinct, labelled no solution. On the right the two lines lie on top of each other, drawn as a thick line, labelled infinitely many solutions. The title of each graph says whether the determinant of the coefficients is zero: not zero, zero, zero.
For two unknowns, each equation is a straight line. Two lines can cross at one point, be parallel, or be the same line. These are the three cases.
∣A∣=0: one solution. The lines cross, and X=A−1B is the crossing point. The system is consistent, and the solution is unique.
∣A∣=0 and the equations contradict each other: no solution. The system is inconsistent. Example: x+y=2 and 2x+2y=5.
∣A∣=0 and the equations agree: infinitely many solutions. Example: x+y=2 and 2x+2y=4. Every point of the line is a solution.
When ∣A∣=0, compute (adjA)B. If it is not the zero column, there is no solution. If it is the zero column, there may be no solution or infinitely many, and you must look at the equations directly.
For three unknowns, each equation is a plane. Take x+y+z=6 and x+2y+3z=14 with a third equation 2x+3y+4z=c. The coefficients of the third equation are the sum of the first two, so ∣A∣=0. If c=20 (the sum 6+14), the third plane contains the line where the first two meet: infinitely many solutions (t−2,8−2t,t) for any number t. If c=21, the three planes have no common point and there is no solution. A-Level Further Maths and IB call the two situations a sheaf (or a common line) and a prism (no common point).
Homogeneous systems
A system with all constants 0 is homogeneous: AX=O. It always has the solution X=O. It has a non-zero solution exactly when ∣A∣=0. For example, x+2y=0 and 3x+ky=0 has non-zero solutions only when k−6=0, that is, k=6.
Cramer's rule
A-Level Further Maths and IB write the solution with determinants. If ∣A∣=0, then
xi=ΔΔi,
where Δ=∣A∣, and Δi is ∣A∣ with column i replaced by the constants B. The rule follows from X=∣A∣1(adjA)B. For the pens and notebooks,
Cramer's rule is neat for two unknowns. For more it needs many determinants, so the inverse or row operations are quicker. It does not work at all when Δ=0.
A worked example
For which values of k does x+2y=3, 2x+ky=6 have a unique solution? For k=4, what happens?
The determinant.∣A∣=k−4.
A unique solution needs ∣A∣=0, so k=4.
For k=4. The second equation is 2x+4y=6, which is twice the first. The lines are the same line, so there are infinitely many solutions.
Practise with new numbers
Try it in Python
The program solves AX=B when ∣A∣=0. Otherwise it compares the rank of A with the rank of the augmented matrix, to tell no solution from infinitely many. It runs the museum system and the plane system of the lesson.
Common mistakes
Multiplying on the wrong side. The solution is A−1B, not BA−1.
Using the inverse when ∣A∣=0. There is no inverse. Decide between no solution and infinitely many.
Saying that ∣A∣=0 always means no solution. It may mean infinitely many.
Mixing the order of the unknowns. Keep x,y,z in the same order in every equation.
Dividing by Δ=0 in Cramer's rule. The rule only works when Δ=0.
Remember these
AX=B has the unique solution X=A−1B when ∣A∣=0.
When ∣A∣=0, the system has no solution or infinitely many.
AX=O has a non-zero solution exactly when ∣A∣=0.
Cramer's rule: xi=Δi/Δ.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Write 2x+y=5 and 3x+2y=8 as AX=B and solve it with the inverse.
[2−3−12]
$.
[2−3−12]
[58]
=
[21]
,sox = 2andy = 1$.
Does x+y=2, 2x+2y=5 have a solution?
For which k does x+2y=3, 2x+ky=6 have infinitely many solutions?
For which k does x+2y=0, 3x+ky=0 have a non-zero solution?
Use Cramer's rule to solve x+y=5, x−y=1.
111−1
= -2$.
511−1
}{-2} = \dfrac{-6}{-2} = 3andy = \dfrac{
1151
}{-2} = \dfrac{-4}{-2} = 2$.
References
NCERT, Mathematics Textbook for Class XII, Part I, Chapter 4 (Determinants), the section on applications to systems of linear equations.
OpenStax, Precalculus 2e, Section 9.7 (Solving Systems with Inverses) and Section 9.8 (Solving Systems with Cramer's Rule).
Enroll free in Inverse of a Matrix and Systems of Linear Equations
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.