Class 12 Maths, Worked in Full Past papersGet updates
Chapter 4 · Determinants

Exercise 4.5 · Q16: Onion, wheat and rice prices by the matrix method

Exercise 4.5Solving systems AX = B · Section 4.6.1
The question

16. The cost of 4 kg onion, 3 kg wheat and 2 kg rice is ₹ 60. The cost of 2 kg onion, 4 kg wheat and 6 kg rice is ₹ 90. The cost of 6 kg onion 2 kg wheat and 3 kg rice is ₹ 70. Find cost of each item per kg by matrix method.

Exam answer

Let the cost per kg of onion, wheat and rice be xx⁠, yy and zz (in rupees). Then

4x+3y+2z=602x+4y+6z=906x+2y+3z=70\begin{aligned} 4x + 3y + 2z &= 60 \\ 2x + 4y + 6z &= 90 \\ 6x + 2y + 3z &= 70 \end{aligned}

This is AX=BAX = B⁠, where

A=[432246623],X=[xyz], B=[609070]\begin{aligned} A &= \begin{bmatrix} 4 & 3 & 2 \\ 2 & 4 & 6 \\ 6 & 2 & 3 \end{bmatrix}, \\ X &= \begin{bmatrix} x \\ y \\ z \end{bmatrix},\ B = \begin{bmatrix} 60 \\ 90 \\ 70 \end{bmatrix} \end{aligned}

Expanding along R1R_1⁠:

∣A∣=4∣4623∣−3∣2663∣+2∣2462∣=4(0)−3(−30)+2(−20)=50\begin{aligned} |A| &= 4\begin{vmatrix} 4 & 6 \\ 2 & 3 \end{vmatrix} - 3\begin{vmatrix} 2 & 6 \\ 6 & 3 \end{vmatrix} \\ &\quad + 2\begin{vmatrix} 2 & 4 \\ 6 & 2 \end{vmatrix} \\ &= 4(0) - 3(-30) + 2(-20) \\ &= 50 \end{aligned}

∣A∣=50≠0|A| = 50 \ne 0⁠. So A−1A^{-1} exists and the system has a unique solution, X=A−1BX = A^{-1}B⁠.

Cofactors:

A11=∣4623∣=0A12=−∣2663∣=30A13=∣2462∣=−20\begin{aligned} A_{11} &= \begin{vmatrix} 4 & 6 \\ 2 & 3 \end{vmatrix} = 0 \\ A_{12} &= -\begin{vmatrix} 2 & 6 \\ 6 & 3 \end{vmatrix} = 30 \\ A_{13} &= \begin{vmatrix} 2 & 4 \\ 6 & 2 \end{vmatrix} = -20 \end{aligned} A21=−∣3223∣=−5A22=∣4263∣=0A23=−∣4362∣=10\begin{aligned} A_{21} &= -\begin{vmatrix} 3 & 2 \\ 2 & 3 \end{vmatrix} = -5 \\ A_{22} &= \begin{vmatrix} 4 & 2 \\ 6 & 3 \end{vmatrix} = 0 \\ A_{23} &= -\begin{vmatrix} 4 & 3 \\ 6 & 2 \end{vmatrix} = 10 \end{aligned} A31=∣3246∣=10A32=−∣4226∣=−20A33=∣4324∣=10\begin{aligned} A_{31} &= \begin{vmatrix} 3 & 2 \\ 4 & 6 \end{vmatrix} = 10 \\ A_{32} &= -\begin{vmatrix} 4 & 2 \\ 2 & 6 \end{vmatrix} = -20 \\ A_{33} &= \begin{vmatrix} 4 & 3 \\ 2 & 4 \end{vmatrix} = 10 \end{aligned} adj⁡A=[0−510300−20−201010]A−1=1∣A∣adj⁡A=150[0−510300−20−201010]\begin{aligned} \operatorname{adj}A &= \begin{bmatrix} 0 & -5 & 10 \\ 30 & 0 & -20 \\ -20 & 10 & 10 \end{bmatrix} \\ A^{-1} &= \frac{1}{|A|}\operatorname{adj}A \\ &= \frac{1}{50}\begin{bmatrix} 0 & -5 & 10 \\ 30 & 0 & -20 \\ -20 & 10 & 10 \end{bmatrix} \end{aligned} X=A−1B=150[0−510300−20−201010][609070]=150[0−450+7001800+0−1400−1200+900+700]=150[250400400]=[588]\begin{aligned} X &= A^{-1}B \\ &= \frac{1}{50}\begin{bmatrix} 0 & -5 & 10 \\ 30 & 0 & -20 \\ -20 & 10 & 10 \end{bmatrix}\begin{bmatrix} 60 \\ 90 \\ 70 \end{bmatrix} \\ &= \frac{1}{50}\begin{bmatrix} 0 - 450 + 700 \\ 1800 + 0 - 1400 \\ -1200 + 900 + 700 \end{bmatrix} \\ &= \frac{1}{50}\begin{bmatrix} 250 \\ 400 \\ 400 \end{bmatrix} = \begin{bmatrix} 5 \\ 8 \\ 8 \end{bmatrix} \end{aligned}

∴ x=5, y=8, z=8\therefore\ x = 5,\ y = 8,\ z = 8⁠. The cost per kg is ₹ 5 for onion, ₹ 8 for wheat and ₹ 8 for rice.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

Each bill says: (kilograms of onion) × (price of onion) + (kilograms of wheat) × (price of wheat) + (kilograms of rice) × (price of rice) = total. That is exactly "a row times a column", so the three bills together are one matrix equation AX=BAX = B: AA holds the quantities, XX the unknown prices, BB the totals. Since ∣A∣≠0|A| \ne 0⁠, the prices are X=A−1BX = A^{-1}B⁠, and they are the only prices consistent with all three bills.

Given, to find, and the plan
Given
Three purchases, with the quantities (in kg) of onion, wheat and rice, and the total cost (in ₹) of each.
To find
The cost per kg of onion, of wheat and of rice.
Plan
(1) Name the unknowns and turn each bill into an equation. (2) Write AX=BAX = B and explain why the product is in that order. (3) ∣A∣|A|⁠. (4) All nine cofactors. (5) adj⁡A\operatorname{adj} A⁠, A−1A^{-1}⁠, and the check A(adj⁡A)=∣A∣ IA(\operatorname{adj} A) = |A|\,I⁠. (6) X=A−1BX = A^{-1}B⁠. (7) Check against every bill and interpret.

Basics you need

1Cost = quantity × price, added up

Buying 4 kg at ₹ xx per kg costs ₹ 4x4x⁠. A bill for several items is the sum of such products. Units: kg × (₹ per kg) = ₹. Basics: algebra the chapter leans on

2A row times a column

A 1×31\times3 row (a,b,c)(a, b, c) times a 3×13\times1 column (x,y,z)(x, y, z) is ax+by+czax + by + cz⁠: pair up, multiply, add. So a whole bill is one row times the column of prices. Basics: matrix facts the chapter uses

3Minors, cofactors, the adjoint

Aij=(−1)i+jMijA_{ij} = (-1)^{i+j}M_{ij}⁠, and adj⁡A\operatorname{adj} A is the transpose of [Aij][A_{ij}]⁠. Basics: the + − + sign pattern

4The inverse divides by ∣A∣|A|

If ∣A∣≠0|A| \ne 0⁠, A−1=1∣A∣adj⁡AA^{-1} = \frac{1}{|A|}\operatorname{adj} A⁠, and AX=BAX = B has the single solution X=A−1BX = A^{-1}B⁠. Basics: why the inverse divides by |A|

Solution

  1. Name the unknowns and turn each bill into an equation

    Let the cost per kg be ₹ xx for onion, ₹ yy for wheat and ₹ zz for rice. Put the data in a table, one row per bill (quantities in kg, totals in ₹):

    BillOnionWheatRiceTotal
    143260
    224690
    362370

    Each bill: quantity times price for each item, added, equals the total:

    4x+3y+2z=602x+4y+6z=906x+2y+3z=70\begin{aligned} 4x + 3y + 2z &= 60\\ 2x + 4y + 6z &= 90\\ 6x + 2y + 3z &= 70 \end{aligned}
    The unknowns must be the things asked for, the prices per kg, and each must keep the same meaning in every equation: xx is always the onion price. The third bill in the book reads "6 kg onion 2 kg wheat" without a comma; the numbers are 6 kg onion and 2 kg wheat.
    Forming linear equations from words, as in Example 18 (Section 4.6.1). Basics: algebra the chapter leans on
  2. Write the system as AX=BAX = B

    The table's quantity columns become AA (rows: bills; columns: onion, wheat, rice), the prices become XX⁠, the totals become BB⁠:

    A=[432246623],A = \begin{bmatrix} 4 & 3 & 2 \\ 2 & 4 & 6 \\ 6 & 2 & 3 \end{bmatrix}, X=[xyz],B=[609070].X = \begin{bmatrix} x \\ y \\ z \end{bmatrix},\quad B = \begin{bmatrix} 60 \\ 90 \\ 70 \end{bmatrix}.

    AA is 3×33\times3 and XX is 3×13\times1⁠, so AXAX is defined and 3×13\times1⁠, like BB⁠:

    AX=[4x+3y+2z2x+4y+6z6x+2y+3z].AX = \begin{bmatrix} 4x + 3y + 2z \\ 2x + 4y + 6z \\ 6x + 2y + 3z \end{bmatrix}.
    Why AXAX and not XAXA⁠? Row ii of AA lists what was bought on bill ii⁠, and the column XX lists the price of each item in the same order (onion, wheat, rice). Row times column pairs each quantity with its own price and adds, which is precisely the bill. XAXA (a 3×13\times1 times a 3×33\times3⁠) is not even defined.
    Section 4.6.1 (matrix form); Section 3.4.5 (row times column). Lesson: solving systems AX = B
  3. Compute ∣A∣|A| by expanding along row 1

    ∣A∣=4∣4623∣−3∣2663∣+2∣2462∣=4(0)−3(−30)+2(−20)=0+90−40=50.\begin{aligned} |A| &= 4\begin{vmatrix} 4 & 6 \\ 2 & 3 \end{vmatrix} - 3\begin{vmatrix} 2 & 6 \\ 6 & 3 \end{vmatrix}\\ &\qquad + 2\begin{vmatrix} 2 & 4 \\ 6 & 2 \end{vmatrix}\\ &= 4(0) - 3(-30) + 2(-20)\\ &= 0 + 90 - 40 = 50. \end{aligned}

    (The minors 00⁠, −30-30⁠, −20-20 are worked out in Step 4.) ∣A∣=50≠0|A| = 50 \ne 0⁠, so AA is nonsingular: there is exactly one set of prices that fits all three bills.

    The first minor is 0 because (4,6)(4, 6) is twice (2,3)(2, 3)⁠, so that term drops out. In real terms, ∣A∣≠0|A| \ne 0 guarantees that the three bills pin down one set of prices (Case I of Section 4.6.1). (Later courses show that ∣A∣=0|A| = 0 happens exactly when one bill's quantities are a combination of the other two; this reprint does not prove that, and we do not need it here.)
    Section 4.2.3 (expansion along R1); Section 4.6.1, Case I. Lesson: expanding a 3 × 3 determinant
  4. Find all nine minors and cofactors

    Row 1 (entries 4,3,24, 3, 2⁠):

    M11=∣4623∣=(4)(3)−(6)(2)=0,A11=(−1)1+1(0)=0,M12=∣2663∣=(2)(3)−(6)(6)=−30,A12=(−1)1+2(−30)=30,M13=∣2462∣=(2)(2)−(4)(6)=−20,A13=(−1)1+3(−20)=−20.\begin{aligned} M_{11} &= \begin{vmatrix} 4 & 6 \\ 2 & 3 \end{vmatrix}\\ &= (4)(3) - (6)(2) = 0,\\ A_{11} &= (-1)^{1+1}(0) = 0,\\ M_{12} &= \begin{vmatrix} 2 & 6 \\ 6 & 3 \end{vmatrix}\\ &= (2)(3) - (6)(6) = -30,\\ A_{12} &= (-1)^{1+2}(-30) = 30,\\ M_{13} &= \begin{vmatrix} 2 & 4 \\ 6 & 2 \end{vmatrix}\\ &= (2)(2) - (4)(6) = -20,\\ A_{13} &= (-1)^{1+3}(-20) = -20. \end{aligned}

    Row 2 (entries 2,4,62, 4, 6⁠):

    M21=∣3223∣=(3)(3)−(2)(2)=5,A21=(−1)2+1(5)=−5,M22=∣4263∣=(4)(3)−(2)(6)=0,A22=(−1)2+2(0)=0,M23=∣4362∣=(4)(2)−(3)(6)=−10,A23=(−1)2+3(−10)=10.\begin{aligned} M_{21} &= \begin{vmatrix} 3 & 2 \\ 2 & 3 \end{vmatrix}\\ &= (3)(3) - (2)(2) = 5,\\ A_{21} &= (-1)^{2+1}(5) = -5,\\ M_{22} &= \begin{vmatrix} 4 & 2 \\ 6 & 3 \end{vmatrix}\\ &= (4)(3) - (2)(6) = 0,\\ A_{22} &= (-1)^{2+2}(0) = 0,\\ M_{23} &= \begin{vmatrix} 4 & 3 \\ 6 & 2 \end{vmatrix}\\ &= (4)(2) - (3)(6) = -10,\\ A_{23} &= (-1)^{2+3}(-10) = 10. \end{aligned}

    Row 3 (entries 6,2,36, 2, 3⁠):

    M31=∣3246∣=(3)(6)−(2)(4)=10,A31=(−1)3+1(10)=10,M32=∣4226∣=(4)(6)−(2)(2)=20,A32=(−1)3+2(20)=−20,M33=∣4324∣=(4)(4)−(3)(2)=10,A33=(−1)3+3(10)=10.\begin{aligned} M_{31} &= \begin{vmatrix} 3 & 2 \\ 4 & 6 \end{vmatrix}\\ &= (3)(6) - (2)(4) = 10,\\ A_{31} &= (-1)^{3+1}(10) = 10,\\ M_{32} &= \begin{vmatrix} 4 & 2 \\ 2 & 6 \end{vmatrix}\\ &= (4)(6) - (2)(2) = 20,\\ A_{32} &= (-1)^{3+2}(20) = -20,\\ M_{33} &= \begin{vmatrix} 4 & 3 \\ 2 & 4 \end{vmatrix}\\ &= (4)(4) - (3)(2) = 10,\\ A_{33} &= (-1)^{3+3}(10) = 10. \end{aligned}
    Each minor is the 2×22\times2 determinant left after deleting the row and column of that entry; the sign (−1)i+j(-1)^{i+j} is then applied. Two cofactors are 0 (A11A_{11} and A22A_{22}⁠), which is allowed and makes later sums shorter.
    Definitions 1 and 2, Section 4.4. Lesson: minors and cofactors
  5. Build adj⁡A\operatorname{adj} A and A−1A^{-1}⁠, and check

    Matrix of cofactors:

    [030−20−501010−2010]\begin{bmatrix} 0 & 30 & -20 \\ -5 & 0 & 10 \\ 10 & -20 & 10 \end{bmatrix}

    Transpose, then divide by ∣A∣=50|A| = 50⁠:

    adj⁡A=[0−510300−20−201010],\operatorname{adj} A = \begin{bmatrix} 0 & -5 & 10 \\ 30 & 0 & -20 \\ -20 & 10 & 10 \end{bmatrix}, A−1=150[0−510300−20−201010].A^{-1} = \frac{1}{50}\begin{bmatrix} 0 & -5 & 10 \\ 30 & 0 & -20 \\ -20 & 10 & 10 \end{bmatrix}.

    Check A(adj⁡A)A(\operatorname{adj} A)⁠, row of AA times column of adj⁡A\operatorname{adj} A⁠:

    (1,1): 4(0)+3(30)+2(−20)=0+90−40=50,(1,2): 4(−5)+3(0)+2(10)=−20+0+20=0,(1,3): 4(10)+3(−20)+2(10)=40−60+20=0,(2,1): 2(0)+4(30)+6(−20)=0+120−120=0,(2,2): 2(−5)+4(0)+6(10)=−10+0+60=50,(2,3): 2(10)+4(−20)+6(10)=20−80+60=0,(3,1): 6(0)+2(30)+3(−20)=0+60−60=0,(3,2): 6(−5)+2(0)+3(10)=−30+0+30=0,(3,3): 6(10)+2(−20)+3(10)=60−40+30=50.\begin{aligned} (1,1)&:\ 4(0) + 3(30) + 2(-20)\\ &= 0 + 90 - 40 = 50,\\ (1,2)&:\ 4(-5) + 3(0) + 2(10)\\ &= -20 + 0 + 20 = 0,\\ (1,3)&:\ 4(10) + 3(-20) + 2(10)\\ &= 40 - 60 + 20 = 0,\\ (2,1)&:\ 2(0) + 4(30) + 6(-20)\\ &= 0 + 120 - 120 = 0,\\ (2,2)&:\ 2(-5) + 4(0) + 6(10)\\ &= -10 + 0 + 60 = 50,\\ (2,3)&:\ 2(10) + 4(-20) + 6(10)\\ &= 20 - 80 + 60 = 0,\\ (3,1)&:\ 6(0) + 2(30) + 3(-20)\\ &= 0 + 60 - 60 = 0,\\ (3,2)&:\ 6(-5) + 2(0) + 3(10)\\ &= -30 + 0 + 30 = 0,\\ (3,3)&:\ 6(10) + 2(-20) + 3(10)\\ &= 60 - 40 + 30 = 50. \end{aligned} A(adj⁡A)=[500005000050]=50 I,A(\operatorname{adj} A) = \begin{bmatrix} 50 & 0 & 0 \\ 0 & 50 & 0 \\ 0 & 0 & 50 \end{bmatrix} = 50\,I,

    so AA−1=150(50 I)=IAA^{-1} = \frac{1}{50}(50\,I) = I⁠.

    The adjoint is the transpose of the cofactor matrix (Definition 3). The product check is Theorem 1: ∣A∣|A| on the diagonal, 0 elsewhere. It confirms all nine cofactors before we use them on the money.
    Definition 3, Section 4.5.1; Theorems 1 and 4, Section 4.5. Lesson: the adjoint
  6. Compute X=A−1BX = A^{-1}B

    A−1A^{-1} is 3×33\times3⁠, BB is 3×13\times1⁠, so the product is 3×13\times1⁠. First (adj⁡A)B(\operatorname{adj} A)B⁠:

    row 1: 0(60)+(−5)(90)+10(70)=0−450+700=250,row 2: 30(60)+0(90)+(−20)(70)=1800+0−1400=400,row 3: (−20)(60)+10(90)+10(70)=−1200+900+700=400.\begin{aligned} \text{row 1}&:\ 0(60) + (-5)(90) + 10(70)\\ &= 0 - 450 + 700 = 250,\\ \text{row 2}&:\ 30(60) + 0(90) + (-20)(70)\\ &= 1800 + 0 - 1400 = 400,\\ \text{row 3}&:\ (-20)(60) + 10(90) + 10(70)\\ &= -1200 + 900 + 700 = 400. \end{aligned} X=[xyz]=150[250400400]=[588].X = \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \frac{1}{50}\begin{bmatrix} 250 \\ 400 \\ 400 \end{bmatrix} = \begin{bmatrix} 5 \\ 8 \\ 8 \end{bmatrix}.

    So x=5x = 5⁠, y=8y = 8⁠, z=8z = 8.

    Multiplying AX=BAX = B on the left by A−1A^{-1} gives X=A−1BX = A^{-1}B⁠, so these are the only prices that fit. Units: A−1A^{-1} has units of "1 per kg" and BB is in ₹, so XX is in ₹ per kg, as a price should be.
    Section 4.6.1, Case I. Lesson: inverse of a matrix
  7. Check against every bill, and say what it means

    Bill 1: 4(5)+3(8)+2(8)=20+24+16=60,Bill 2: 2(5)+4(8)+6(8)=10+32+48=90,Bill 3: 6(5)+2(8)+3(8)=30+16+24=70.\begin{aligned} \text{Bill 1}&:\ 4(5) + 3(8) + 2(8)\\ &= 20 + 24 + 16 = 60,\\ \text{Bill 2}&:\ 2(5) + 4(8) + 6(8)\\ &= 10 + 32 + 48 = 90,\\ \text{Bill 3}&:\ 6(5) + 2(8) + 3(8)\\ &= 30 + 16 + 24 = 70. \end{aligned}

    All three totals (₹ 60, ₹ 90, ₹ 70) are reproduced. So onion costs ₹ 5 per kg, wheat ₹ 8 per kg and rice ₹ 8 per kg.

    The check is done on the bills themselves, in rupees, which tests the whole chain from the words to the answer. All three prices are positive, as prices must be; a negative value would have signalled an error in setting up the equations (or data that no real prices could fit).
Result

With x,y,zx, y, z the prices per kg, ∣A∣=50≠0|A| = 50 \ne 0 and

A−1=150[0−510300−20−201010].A^{-1} = \frac{1}{50}\begin{bmatrix} 0 & -5 & 10 \\ 30 & 0 & -20 \\ -20 & 10 & 10 \end{bmatrix}.

The cost per kg is onion ₹ 5, wheat ₹ 8, rice ₹ 8.

(Textbook answer: cost of onions per kg = ₹ 5, cost of wheat per kg = ₹ 8, cost of rice per kg = ₹ 8.)

Check it with numbers

∣A∣|A| along column 1. Entries 4,2,64, 2, 6 with cofactors 0,−5,100, -5, 10⁠: 4(0)+2(−5)+6(10)=−10+60=504(0) + 2(-5) + 6(10) = -10 + 60 = 50⁠. The same as along row 1.

By elimination. Halve bill 2: x+2y+3z=45x + 2y + 3z = 45⁠. Bill 1 minus 4 times this: −5y−10z=−120-5y - 10z = -120⁠, so y+2z=24y + 2z = 24⁠. Bill 3 minus 6 times it: −10y−15z=−200-10y - 15z = -200⁠, so 2y+3z=402y + 3z = 40⁠. Putting y=24−2zy = 24 - 2z into the last: 48−z=4048 - z = 40⁠, so z=8z = 8⁠, y=8y = 8⁠, and x=45−16−24=5x = 45 - 16 - 24 = 5⁠. The same prices.

Common mistakes
  1. Mixing up the order of the items. If rice is listed second in one row and third in another, AA is wrong. Keep onion, wheat, rice in the same column positions in every row.
  2. Putting the bills in the columns of AA⁠. That matrix is A′A'⁠, and A′X=BA'X = B is a different system (its solution is not 5, 8, 8).
  3. Losing a sign in a cofactor. A12=−(−30)=30A_{12} = -(-30) = 30 and A32=−(20)=−20A_{32} = -(20) = -20⁠; the check A(adj⁡A)=50 IA(\operatorname{adj} A) = 50\,I catches such slips.
  4. Stopping at XX without units. The answer is a price: ₹ per kg.
What to take away
  1. For a word problem, a table with one row per condition and one column per unknown is the coefficient matrix.
  2. Quantity × price summed over items is a row times a column; that fixes the order AXAX⁠.
  3. ∣A∣≠0|A| \ne 0 means the unknowns are determined uniquely, by X=A−1BX = A^{-1}B⁠.

Every fact used, and where it comes from

FactUsed inSource
Forming equations from a word problemStep 1Example 18, Section 4.6.1
A system written as AX=BAX = BStep 2Section 4.6.1 (Lesson: solving systems)
Matrix product, row times columnSteps 2, 5, 6Section 3.4.5 (Chapter 3)
Expansion along a row or columnStep 3Section 4.2.3 (Lesson: expanding a 3 × 3 determinant)
Minor and cofactorStep 4Definitions 1 and 2, Section 4.4 (Lesson: minors and cofactors)
adj⁡A\operatorname{adj} A = transpose of [Aij][A_{ij}]Step 5Definition 3, Section 4.5.1 (Lesson: the adjoint)
A(adj⁡A)=∣A∣ IA(\operatorname{adj} A) = |A|\,I⁠; A−1=1∣A∣adj⁡AA^{-1} = \frac{1}{|A|}\operatorname{adj} AStep 5Theorems 1 and 4, Section 4.5 (Lesson: inverse of a matrix)
X=A−1BX = A^{-1}B is the unique solutionSteps 3, 6Section 4.6.1, Case I
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →