Solving Simultaneous Equations with a Matrix Inverse

Two equations, one matrix, one step.

Two equations as one

The pair 3x + 5y = 11 and x + 2y = 4 can be written as a single matrix equation. The coefficients of x and y make the matrix A = (3 5; 1 2), with one row for each equation. The unknowns make the column X = (x; y), and the numbers on the right make the column b = (11; 4). The pair is then A X = b.

Multiplying out shows that nothing has changed. Row 1 of A times X is 3 × x + 5 × y, and that must equal the top entry of b, so 3x + 5y = 11. Row 2 times X is 1 × x + 2 × y, which must equal 4, so x + 2y = 4. Those are the two equations that were written down.

Each equation fills one row, in the order x then y, and a sign stays with its coefficient: 2x − 3y = 1 makes the row 2, −3. If an equation has no y term, its coefficient of y is 0, and the 0 is written in.

A3512xyb114×=

Row 2 of A times the column of unknowns is 1 × x + 2 × y, and it equals the bottom entry of b: x + 2y = 4.

Multiplying on the left

To leave X on its own, multiply both sides of A X = b on the left by the inverse of A. The left side becomes A⁻¹ A X. Since A⁻¹ A = I and I times X is X, the left side is just X, and the equation reads X = A⁻¹ b.

The inverse has to go on the left of both sides, because A stands on the left of X and matrix products depend on their order. Written on the right, b A⁻¹ is a 2 × 1 times a 2 × 2, which cannot be found at all. There is no dividing by a matrix: undoing A means multiplying by its inverse.

Working out the product

The determinant of A is 3 × 2 − 5 × 1 = 1, so swapping the 3 and the 2 and changing the signs of the 5 and the 1 gives the inverse straight away: it is the matrix (2 −5; −1 3).

Now multiply it by b, row by column. The top entry is 2 × 11 + (−5) × 4 = 22 − 20 = 2, and the bottom entry is (−1) × 11 + 3 × 4 = −11 + 12 = 1. So X is the column (2; 1): the top entry is x and the bottom entry is y, so x = 2 and y = 1.

A⁻¹2−5−13b11421=

Row 2 of the inverse with the column b gives (−1) × 11 + 3 × 4 = 1, the bottom entry, which is y.

Checking the answer

Substitute x = 2 and y = 1 into both equations. The first gives 3 × 2 + 5 × 1 = 6 + 5 = 11, and the second gives 2 + 2 × 1 = 4. Both hold.

Elimination finds the same pair. Multiplying the second equation by 3 gives 3x + 6y = 12, and taking away the first equation, 3x + 5y = 11, leaves y = 1. Then x + 2 × 1 = 4 gives x = 2.

Each equation is a straight line, and the solution is the point on both lines. The two lines cross at exactly one point, (2, 1), which is why there is exactly one solution.

xy(2, 1)

The gold line is x + 2y = 4 and the other line is 3x + 5y = 11. They cross at (2, 1), the one point that satisfies both equations.

One inverse, many right-hand sides

The inverse depends only on the coefficients, so it can be used again when the numbers on the right change. For 3x + 5y = 7 and x + 2y = 3, multiply the same inverse by the column (7; 3): the top entry is 2 × 7 + (−5) × 3 = 14 − 15 = −1 and the bottom entry is (−1) × 7 + 3 × 3 = −7 + 9 = 2. So x = −1 and y = 2.

Check: 3 × (−1) + 5 × 2 = −3 + 10 = 7, and −1 + 2 × 2 = 3.

When the determinant is 0

The pair x + 2y = 3 and 2x + 4y = 10 has the matrix (1 2; 2 4), whose determinant is 1 × 4 − 2 × 2 = 0. There is no inverse, so this method cannot start.

The equations show why. Row 2 of the matrix is twice row 1, so the left side of the second equation is twice the left side of the first. Halving the second equation gives x + 2y = 5, which cannot hold at the same time as x + 2y = 3. The two lines are parallel and never cross, so there is no solution. Had the second total been 6 instead of 10, the two equations would have been the same line, and every point on it would be a solution. Either way there is no single answer for an inverse to find.

xy

The gold line is 2x + 4y = 10 and the other line is x + 2y = 3. They have the same gradient and never cross, so no point satisfies both equations.

The usual mistakes

Reading the wrong entry. In X = (2; 1) the top entry is x and the bottom entry is y, because X was built as the column (x; y).

Giving a number from b as the answer. The 11 in b is the total of the first equation, not the value of x.

Writing the coefficients down the columns. (3 1; 5 2) times (x; y) has top entry 3x + y, which is neither equation; each equation fills one row.

Dropping a minus sign. For 2x − 3y = 1 the row is 2, −3, not 2, 3.

Multiplying on the right, as b A⁻¹, which cannot be found. The inverse goes on the left, where A was.

Prices and alloys

In the first application below, two shopping lists give a pair of equations whose matrix has determinant −1, and the inverse gives the price of a tin of paint and of a brush. In the second, the same inverse is used twice: once to find how much of each alloy makes a blend, and once to show that a second blend would need a negative mass of one alloy.

Worked example: The Price of a Tin of Paint and of a Brush from Two Shopping Lists

Question At a hardware shop, 2 tins of paint and 3 brushes cost $40, and 1 tin of paint and 1 brush cost $17. A tin costs $x and a brush costs $y. (a) Write the two equations as a matrix equation Axy = 4017, and find det A and A−1. (b) Use A−1 to find the price of a tin and the price of a brush.

  1. 1.The two lists give 2x + 3y = 40 and x + y = 17. The coefficients of x and y are the rows of A = 2311, so Axy = 4017.

    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 172311×xy=4017
    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 172311×xy=4017
    The lists give 2x + 3y = 40 and x + y = 17: 2311xy = 4017. Each equation is a line.
  2. 2.The determinant is det A = 2 × 1 − 3 × 1 = 2 − 3 = −1. It is not 0, so A has an inverse and the two lines cross at one point.

    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 17det A = 2 × 1 − 3 × 1 = −1not 0: the lines cross once
    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 17det A = 2 × 1 − 3 × 1 = −1not 0: the lines cross once
    det A = 2 × 1 − 3 × 1 = −1. It is not 0, so A has an inverse and the lines cross at one point.
  3. 3.(a) Swap the diagonal entries, change the signs of the other two and divide by −1: A−1 = 1−11−3−12 = −131−2.

    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 17A−1= 1/(−1) ×1−3−12=−131−2
    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 17A−1= 1/(−1) ×1−3−12=−131−2
    (a) A−1 = 1−11−3−12 = −131−2.
  4. 4.Multiply both sides on the left by A−1: xy = A−14017 = −1 × 40 + 3 × 171 × 40 − 2 × 17 = 116.

    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 17−131−2×4017=116−40 + 51 = 11, 40 − 34 = 6
    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 17−131−2×4017=116−40 + 51 = 11, 40 − 34 = 6
    A−14017 = 116.
  5. 5.(b) A tin of paint costs $11 and a brush costs $6, where the two lines cross at (11, 6). Check: 2 × 11 + 3 × 6 = 22 + 18 = 40 and 11 + 6 = 17.

    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 17(11, 6)a tin costs $11 and a brush $6check: 22 + 18 = 40 and 11 + 6 = 17
    05101505101520price of a tin ($), xprice of a brush ($), y2x + 3y = 40x + y = 17(11, 6)a tin costs $11 and a brush $6check: 22 + 18 = 40 and 11 + 6 = 17
    (b) A tin costs $11 and a brush $6: the lines cross at (11, 6).

Answer: (a) A = 2311, det A = −1 and A−1 = −131−2; (b) a tin of paint costs $11 and a brush costs $6

Common mistakes

  • Multiplying on the right, 4017A−1. A 2 × 1 column cannot be multiplied by a 2 × 2 matrix on its right; A−1 must stand on the left, where A stood.
  • Forgetting that the determinant is negative and using 1−3−12 as the inverse. The prices then come out as −11 and −6, and a negative price shows that a sign was lost.

More determinants and inverses problems, worked step by step →

Worked example: Two Alloys Melted Together to Hold a Set Mass of Copper, and a Blend That Cannot Be Made

Question A foundry has two alloys: alloy A is 60% copper and alloy B is 30% copper. It melts x kg of A with y kg of B to make 10 kg of a new alloy. (a) The new alloy must contain 5.1 kg of copper. Write the two conditions as a matrix equation, multiplying the copper equation by 10 to clear the decimals, and solve it with the inverse matrix. (b) A customer asks for 10 kg of alloy that is 70% copper. Use the same inverse to show that this cannot be made.

  1. 1.The masses add to 10 kg: x + y = 10. The copper is 0.6x + 0.3y = 5.1, and multiplying by 10 gives 6x + 3y = 51. So 1163xy = 1051.

    the 10 kg meltx kg of Ay kg of Bx + y = 10, 6x + 3y = 511163×xy=1051
    the 10 kg meltx kg of Ay kg of Bx + y = 10, 6x + 3y = 511163×xy=1051
    The masses give x + y = 10 and the copper 0.6x + 0.3y = 5.1, or 6x + 3y = 51: 1163xy = 1051.
  2. 2.The determinant is 1 × 3 − 1 × 6 = −3, so the inverse is 1−33−1−61.

    the 10 kg meltx kg of Ay kg of Bdet = 1 × 3 − 1 × 6 = −3inverse = 1/(−3) ×3−1−61
    the 10 kg meltx kg of Ay kg of Bdet = 1 × 3 − 1 × 6 = −3inverse = 1/(−3) ×3−1−61
    The determinant is 1 × 3 − 1 × 6 = −3, so the inverse is 1−33−1−61.
  3. 3.Multiply the column of totals by the inverse: xy = 1−33 × 10 − 1 × 51−6 × 10 + 1 × 51 = 1−3−21−9 = 73.

    the 10 kg meltx kg of Ay kg of B1/(−3) ×3−1−61×1051=7330 − 51 = −21, −60 + 51 = −9
    the 10 kg meltx kg of Ay kg of B1/(−3) ×3−1−61×1051=7330 − 51 = −21, −60 + 51 = −9
    1−3−21−9 = 73.
  4. 4.(a) The foundry melts 7 kg of alloy A with 3 kg of alloy B. Check: 0.6 × 7 + 0.3 × 3 = 4.2 + 0.9 = 5.1 kg of copper in 7 + 3 = 10 kg.

    the 10 kg melt7 kg of A3 kg of Bany blend of A and B0%30%60%100%51%7 kg of A and 3 kg of Bcopper: 4.2 + 0.9 = 5.1 kg
    the 10 kg melt7 kg of A3 kg of Bany blend of A and B0%30%60%100%51%7 kg of A and 3 kg of Bcopper: 4.2 + 0.9 = 5.1 kg
    (a) 7 kg of alloy A and 3 kg of alloy B hold 4.2 + 0.9 = 5.1 kg of copper, which is 51% of the melt.
  5. 5.For 70% the copper is 0.7 × 10 = 7 kg, so 6x + 3y = 70 and the column of totals is 1070. Then 1−330 − 70−60 + 70 = 1−3−4010 = 1313−313.

    the 10 kg melt7 kg of A3 kg of Bany blend of A and B0%30%60%100%51%70%1/(−3) ×3−1−61×1070=13 1/3−3 1/3
    the 10 kg melt7 kg of A3 kg of Bany blend of A and B0%30%60%100%51%70%1/(−3) ×3−1−61×1070=13 1/3−3 1/3
    For 70% the totals are 1070, and the inverse gives 1313−313.
  6. 6.(b) A mass of −313 kg of alloy B cannot be melted, so the order cannot be made. Any blend of a 60% alloy and a 30% alloy is between 30% and 60% copper, and 70% is above both.

    the 10 kg melt7 kg of A3 kg of Bany blend of A and B0%30%60%100%51%70%−3 1/3 kg of B cannot be melteda blend lies between 30% and 60%
    the 10 kg melt7 kg of A3 kg of Bany blend of A and B0%30%60%100%51%70%−3 1/3 kg of B cannot be melteda blend lies between 30% and 60%
    (b) A negative mass of alloy B cannot be melted: every blend of the two alloys is between 30% and 60% copper, and 70% is outside that range.

Answer: (a) 1163xy = 1051, so the foundry melts 7 kg of alloy A with 3 kg of alloy B; (b) the inverse gives −313 kg of alloy B, a negative mass, so 70% copper cannot be made

Common mistakes

  • Writing the copper as 60x + 30y = 5.1. The percentages must be written as the decimals 0.6 and 0.3 before the equation is multiplied by 10; otherwise the copper is out by a factor of 100.
  • Giving 1313 kg and −313 kg as the answer to (b). The inverse always returns two numbers, but a negative mass describes no real blend, so the answer has to be checked against the situation.

More determinants and inverses problems, worked step by step →

Practice Solving Simultaneous Equations with a Matrix Inverse in the app