Skip to content

← Grade 12 Mathematics

Matrix Based System of Linear Equations

Unit 5 · Algebra

Hide the stories, facts, photos, activities and interactives, for revising before an exam
What this builds on from class
In this unit 5 sections
  1. 5.1 System of linear equations
  2. 5.2 Cramer’s rule
  3. 5.3 Matrix method: the inverse
  4. 5.4 Matrix method: row-equivalent matrices
  5. Exercise

A rice farmer in Chitwan is told to give her field 100 kg of nitrogen (N), 30 kg of phosphate (P₂O₅) and 30 kg of potash (K₂O) a hectare, written 100:30:30: the government’s long-standing recommended dose for rice, as a 2017 trial in Chitwan used it. The agrovet sells none of these as they are. It sells three bags, the three fertilizers Nepal imports and subsidizes: urea (46% N), DAP (diammonium phosphate: 18% N and 46% P₂O₅) and MoP (muriate of potash: 60% K₂O). DAP feeds two nutrients at once, so the bags can’t be worked out one at a time. And NARC, Nepal’s agricultural research council, recommends a stronger dose for the same crop, 120:60:40.

So here is this unit’s question: how many kilograms of each bag does one ropani of rice need, for either dose? Three unknowns tied by three conditions make a system of linear equations, and a matrix solves it, for both doses at once. The answer comes at the end of 5.3.
Doses: Acharya and others, Agronomy Journal of Nepal (2022); the bags: Mishra and Bhattarai, Agriculture Development Journal (2026).

This unit solves systems exactly, with determinants and matrices, as CDC’s Algebra asks. Unit 15, in the Computational Methods option, solves them the way computers do: Gauss elimination, and the Gauss–Seidel method, which creeps up on the answer step by step.

5.1 System of linear equations

An equation like 2x + 3y − z = 5 is linear: each unknown appears only to the first power, never multiplied by another unknown. Several such equations that must all hold at once are a system of linear equations, and a solution is a set of values of the unknowns that satisfies every one.

The matrix form

Write the system
a1x+b1y+c1z=d1a2x+b2y+c2z=d2a3x+b3y+c3z=d3as(a1b1c1a2b2c2a3b3c3)(xyz)=(d1d2d3) \begin{aligned} a_1x + b_1y + c_1z &= d_1 \\ a_2x + b_2y + c_2z &= d_2 \\ a_3x + b_3y + c_3z &= d_3 \end{aligned} \qquad\text{as}\qquad \begin{pmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{pmatrix}\begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} d_1 \\ d_2 \\ d_3 \end{pmatrix}
Multiply out the left side, row times column, and the three equations come back. In short, AX=B \mathbf{AX = B} : A is the coefficient matrix, X the matrix of unknowns and B the matrix of constants. The augmented matrix [A∣B] [A \mid B] is A with B written on as a fourth column: every number of the system, and nothing else.

Three kinds of answer

Two equations in x and y are two straight lines, and a solution is a point on both. Two lines can cross at one point (one solution), be parallel (no point on both: no solution) or be the same line (every point of it: infinitely many solutions). They can never meet in exactly two points. Three equations in x, y, z are three planes in space, and the same three cases hold: the planes meet at one point, have no point common to all three, or share a whole line (or plane) of points.

A system with at least one solution is consistent; one with none is inconsistent. Every method in this unit must say which case it is in, not only find a point.

E₁R₁R₂BE₂R₃R₄R₅ACDI₁I₃I₄
Figure 5.1 A network with two cells. The currents are I₁ along ABC, I₄ along ADC, and I₃ back along the middle branch CA, as in Grade 12 Physics, Example 14.1.

The augmented matrix of x − 2y = 5, 3x + y = 1 is:

Pick an answer to see why.

5.2 Cramer’s rule

Two unknowns

Solve a₁x + b₁y = c₁ and a₂x + b₂y = c₂ by elimination, but keep the letters:

  1. Multiply the first equation by b₂ and the second by b₁, and subtract: the y terms cancel, leaving (a₁b₂ − a₂b₁)x = c₁b₂ − c₂b₁.
  2. In the same way, multiply by a₂ and a₁ and subtract to remove x: (a₁b₂ − a₂b₁)y = a₁c₂ − a₂c₁.
  3. Each bracket is a 2 × 2 determinant:

D=∣a1b1a2b2∣,Dx=∣c1b1c2b2∣,Dy=∣a1c1a2c2∣ D = \begin{vmatrix} a_1 & b_1 \\ a_2 & b_2 \end{vmatrix}, \quad D_x = \begin{vmatrix} c_1 & b_1 \\ c_2 & b_2 \end{vmatrix}, \quad D_y = \begin{vmatrix} a_1 & c_1 \\ a_2 & c_2 \end{vmatrix}

  1. So xD=Dx xD = D_x and yD=Dy yD = D_y , and if D ≠ 0,

x=DxD,y=DyD x = \frac{D_x}{D}, \qquad y = \frac{D_y}{D}

D is the determinant of the coefficients. Dx D_x is D with the column of x’s coefficients replaced by the constants, and Dy D_y is D with the column of y’s replaced. That is Cramer’s rule.

When D = 0, step 4 can’t divide. a₁b₂ = a₂b₁ says the two lines have the same slope: they are parallel or the same line. If Dx D_x or Dy D_y is not 0, steps 1–2 give 0 = a number that isn’t 0: no solution. If all three are 0 (and each equation really is a line, not both its coefficients 0), the equations are multiples of each other: infinitely many.

Try it

Two lines, three determinants

Set the red line with the sliders. Make D = 0: what do the lines do? Then make Dx D_x and Dy D_y zero as well.

−4−224−2XYO(2, 1)

x + 2y = 42x − y = 3

D
−5
Dx
−10
Dy
−5
(x, y)
(2, 1)

D ≠ 0: the lines cross at one point, x = Dx ÷ D, y = Dy ÷ D.

Three unknowns

For three equations AX = B as in 5.1, let D = |A|, and let Dx D_x , Dy D_y , Dz D_z be D with the first, second or third column replaced by the constants d₁, d₂, d₃. Why the same rule holds:

  1. xD=∣a1xb1c1a2xb2c2a3xb3c3∣ xD = \begin{vmatrix} a_1x & b_1 & c_1 \\ a_2x & b_2 & c_2 \\ a_3x & b_3 & c_3 \end{vmatrix} (a factor x of the first column goes in: Grade 11’s property 4).
  2. Add y times column 2 and z times column 3 to column 1, C₁ → C₁ + yC₂ + zC₃: the value doesn’t change (property 6), and column 1 becomes a₁x + b₁y + c₁z, …, which by the equations is d₁, d₂, d₃.
  3. So xD=Dx xD = D_x . The same with columns 2 and 3 gives yD=Dy yD = D_y and zD=Dz zD = D_z . If D ≠ 0,

x=DxD,y=DyD,z=DzD x = \frac{D_x}{D}, \qquad y = \frac{D_y}{D}, \qquad z = \frac{D_z}{D}

Each unknown comes out on its own, without finding the others first: useful when only one current, or one price, is wanted.

For a system of two equations in x and y, D = 0 and Dx=6 D_x = 6 . The system has:

Pick an answer to see why.

5.3 Matrix method: the inverse

AX = B looks like 3x = 12, which is solved by multiplying by 13 \frac{1}{3} , the number that undoes 3. The matrix that undoes A is A−1 A^{-1} .

  1. AX = B, with |A| ≠ 0, so that A−1 A^{-1} exists Grade 11: Grade 11, 6.4.
  2. Multiply both sides by A−1 A^{-1} on the left: A−1(AX)=A−1B A^{-1}(AX) = A^{-1}B . (Matrix products depend on order, so both sides must be multiplied on the same side.)
  3. A−1(AX)=(A−1A)X=IX=X A^{-1}(AX) = (A^{-1}A)X = IX = X (multiplication is associative; A−1A=I A^{-1}A = I ).
  4. So

X=A−1B X = A^{-1}B
and it is the only solution: every solution must equal A−1B A^{-1}B by steps 2–3. Put back, A(A−1B)=(AA−1)B=B A(A^{-1}B) = (AA^{-1})B = B , so it is one.

If |A| = 0, A has no inverse and the method gives no answer; the system then has no solution or infinitely many, and 5.4 decides which.

A is a non-singular 3 × 3 matrix and AX = B. Then X is:

Pick an answer to see why.

Back to the field

Let u, d and m be the kilograms of urea, DAP and MoP a hectare. Nitrogen comes from urea (46%) and DAP (18%), phosphate from DAP (46%), potash from MoP (60%):
(0.460.18000.460000.60)⏟A(udm)=(1003030) \underbrace{\begin{pmatrix} 0.46 & 0.18 & 0 \\ 0 & 0.46 & 0 \\ 0 & 0 & 0.60 \end{pmatrix}}_{A}\begin{pmatrix} u \\ d \\ m \end{pmatrix} = \begin{pmatrix} 100 \\ 30 \\ 30 \end{pmatrix}
|A| = 0.46 × 0.46 × 0.60 = 0.12696 ≠ 0, and the inverse, from the adjoint, is
A−1≈(2.174−0.851002.1740001.667) A^{-1} \approx \begin{pmatrix} 2.174 & -0.851 & 0 \\ 0 & 2.174 & 0 \\ 0 & 0 & 1.667 \end{pmatrix}
For 100:30:30, X=A−1B X = A^{-1}B : u≈2.174(100)−0.851(30)≈191.9 u \approx 2.174(100) - 0.851(30) \approx 191.9 , d≈2.174(30)≈65.2 d \approx 2.174(30) \approx 65.2 , m≈1.667(30)=50 m \approx 1.667(30) = 50 kg a hectare. For NARC’s 120:60:40 the same A−1 A^{-1} gives 209.8, 130.4 and 66.7.

A ropani is 508.7 m², about 0.0509 ha. So one ropani of rice needs about 9.8 kg of urea, 3.3 kg of DAP and 2.5 kg of MoP for the government’s dose, and about 10.7 kg, 6.6 kg and 3.4 kg for NARC’s.

What the inverse says: the −0.851 means each extra kilogram of phosphate asked for cuts the urea by 0.851 kg, because the DAP that brings the phosphate brings nitrogen too. That is why NARC’s dose doubles the DAP but adds only 18 kg of urea. Over the twelve years to 2024/25, Nepal’s subsidized supply was about 62% urea, 35% DAP and 3% MoP, against a recommended 49%, 29% and 22%: the potash is the bag most often missing.

One dose for the whole country is itself being retired: in July 2022 the agriculture ministry endorsed new rice recommendations by soil domain (four in the Terai, one in the inner Terai, one in the hills), with zinc and boron as well, replacing a blanket recommendation that had not been updated since 1976. For the matrix nothing changes but B: put in your domain’s dose and the same A−1 A^{-1} gives the bags, as the project at the end of the unit does.

5.4 Matrix method: row-equivalent matrices

Elementary row operations

You solved equations long before matrices by doing three things to them, which never change the solutions. On the augmented matrix they are the elementary row operations:

  1. Swap two rows, Ri↔Rj R_i \leftrightarrow R_j : the same equations in another order.
  2. Multiply a row by a number k ≠ 0, Ri→kRi R_i \to kR_i : 2x + 4y = 6 and x + 2y = 3 have the same solutions. (Multiplying by 0 would throw an equation away, so k = 0 is not allowed.)
  3. Add a multiple of one row to another, Ri→Ri+kRj R_i \to R_i + kR_j : whatever satisfies both old equations satisfies the new one, and subtracting kRj kR_j again brings the old one back.

Each operation can be undone by another of the same kind, so no solution is lost and none is gained. Matrices joined by such operations are row-equivalent, written ∼ \sim , and row-equivalent augmented matrices are systems with the same solutions.

The row-equivalent method uses them to turn [A∣B] [A \mid B] into [I∣X] [I \mid X] , which reads off the answer: x = …, y = …, z = …. Work one column at a time: make its pivot (the diagonal entry) 1, then make every other entry of that column 0.

When there is no single answer

If a column can’t be given a pivot, the method still ends, and the last rows tell the case. A row (0 0 0∣c) (0 \ 0 \ 0 \mid c) with c ≠ 0 says 0 = c: no solution. A row of zeros says 0 = 0, an equation that was a combination of the others: if there is no 0 = c row, there are infinitely many solutions, with an unknown left free.

Row operations take the augmented matrix of a system to (102401−110005) \left(\begin{array}{ccc|c} 1 & 0 & 2 & 4 \\ 0 & 1 & -1 & 1 \\ 0 & 0 & 0 & 5 \end{array}\right) . The system has:

Pick an answer to see why.

The inverse by row operations

The same operations find A−1 A^{-1} : write [A∣I] [A \mid I] and work it to [I∣A−1] [I \mid A^{-1}] . Why: each row operation is the same as multiplying on the left by a matrix, so the operations together multiply by one matrix E with EA = I, and that E is A−1 A^{-1} ; done to I as well, they turn it into EI=A−1 EI = A^{-1} .

Which method?

Method Best for When det A = 0
Cramer’s rule two or three unknowns; one unknown wanted alone shows “no solution” if some Dx≠0 D_x \ne 0 ; otherwise can’t decide
Inverse the same A with many right sides fails: no inverse
Row-equivalent any system, any size tells which: 0 = c row or a row of zeros

Computers use row operations, never Cramer’s rule beyond a few unknowns: for 100 unknowns it needs 101 determinants of size 100. Unit 15 counts how much work each takes.

Exercise

Choose the correct option

In Cramer’s rule for three unknowns, Dy D_y is formed from D by:

Pick an answer to see why.

Which of these is not an elementary row operation?

Pick an answer to see why.

The system x + 2y = 3, 2x + 4y = 7 has:

Pick an answer to see why.

A system AX = B of three equations has |A| = 4. Then it:

Pick an answer to see why.

For the system 2x − y = 1, x + 3y = 11, the value of D in Cramer’s rule is:

Pick an answer to see why.

Row operations take [A∣B] [A \mid B] to (103201−140000) \left(\begin{array}{ccc|c} 1 & 0 & 3 & 2 \\ 0 & 1 & -1 & 4 \\ 0 & 0 & 0 & 0 \end{array}\right) . The system:

Pick an answer to see why.

A is a 3 × 3 matrix with |A| = 0. The system AX = O (every constant 0) has:

Pick an answer to see why.

By Cramer’s rule, the solution of 3x + 2y = 7, x − y = 4 has x equal to:

Pick an answer to see why.

If A−1=(2−1−11) A^{-1} = \begin{pmatrix} 2 & -1 \\ -1 & 1 \end{pmatrix} and AX=(31) AX = \begin{pmatrix} 3 \\ 1 \end{pmatrix} , then X is:

Pick an answer to see why.

kx + 2y = 4 and 2x + ky = 4 have no solution exactly when:

Pick an answer to see why.

x + y + z = 6, x + 2y + 3z = 10, x+2y+λz=μ x + 2y + \lambda z = \mu has infinitely many solutions when:

Pick an answer to see why.

Short questions

1.

Solve by Cramer’s rule:

  • a.3x − 4y = 10, 5x + 2y = 8 (2 marks)
  • b.x + y + z = 2, 2x − y + 3z = 11, x + 3y − z = −4 (3 marks)
Answer
2.

A=(121131012) A = \begin{pmatrix} 1 & 2 & 1 \\ 1 & 3 & 1 \\ 0 & 1 & 2 \end{pmatrix} .

  • a.Find A−1 A^{-1} . (3 marks)
  • b.Use it to solve AX=(453) AX = \begin{pmatrix} 4 \\ 5 \\ 3 \end{pmatrix} and AX=(325) AX = \begin{pmatrix} 3 \\ 2 \\ 5 \end{pmatrix} . (2 marks)
Answer
3.

Solve by the row-equivalent method: x + y + z = 4, 2x − y + z = 3, x + 2y − z = 1. (5 marks)

Answer
4.

Cramer’s own question: find the parabola y=ax2+bx+c y = ax^2 + bx + c through (1, 2), (2, 3) and (3, 6), by Cramer’s rule. (5 marks)

Hint
Answer
5.

For which values of k does the system x + y + z = 1, x + 2y + 4z = k, x+4y+10z=k2 x + 4y + 10z = k^2 have a solution? Solve it for each. (5 marks)

Hint
Answer

Long questions

6.

Leontief’s model with two industries, agriculture and manufacturing (the numbers are made up; the method is Leontief’s). Each rupee of farm output uses Rs 0.20 of farm goods and Rs 0.40 of manufactured goods; each rupee of manufactured output uses Rs 0.30 of farm goods and Rs 0.10 of manufactured goods. Final demand is Rs 60 crore of farm goods and Rs 30 crore of manufactured goods.

  • a.Write the equations X = AX + F for the total outputs x₁, x₂, and the matrix I − A. (2 marks)
  • b.Find (I−A)−1 (I - A)^{-1} . (2 marks)
  • c.Find the outputs. (2 marks)
  • d.Farm demand rises by Rs 10 crore. How much more must each industry produce? (2 marks)
Hint
Answer
7.

x + y + z = 6, x + 2y + 3z = 14, x+4y+λz=μ x + 4y + \lambda z = \mu .

  • a.Reduce the augmented matrix and find the values of λ \lambda for which the system has exactly one solution. (3 marks)
  • b.When has it no solution? When infinitely many? Give them. (3 marks)
  • c.Solve it by Cramer’s rule for λ=8 \lambda = 8 , μ=31 \mu = 31 . (2 marks)
Answer

Project work

Where these facts come from

Found a mistake? Please tell us.