Skip to content
Tutorials Center
My learning

Topics

Lesson 18 of 86 · Averages, Ages and Everyday Arithmetic

Simple and Simultaneous Equations

Turn word problems about numbers, coins, tickets and prices into linear equations, solve two and three variables by elimination, and verify with code.

Many aptitude questions are secretly equations. "I bought 30 coins worth 111 in all" or "adult tickets cost 150 and child tickets cost 90" are sentences that translate directly into algebra. If you can write the equation, the rest is mechanical, and you will solve it faster than by guessing and testing.

A linear equation has variables that appear only to the first power: 3x + 7 = 2x + 19 is linear, but x² + 1 = 10 is not. This lesson covers three things: solving a single linear equation, solving a pair of equations by elimination or substitution, and extending elimination to three equations. Along the way you will see the classic word-problem types: numbers, coins, tickets, prices and fractions.

Translating words into equations

The hard part is not solving, it is translating. A short dictionary helps.

Words Algebra
a number x
3 more than a number x + 3
twice a number, decreased by 5 2x − 5
is, equals, gives, results in =
the sum of two numbers is 20 x + y = 20
A is 5 more than B A = B + 5
the total cost of 5 pens at p each 5p

Always begin by writing down what each letter stands for, for example "Let x be the number of 2-dollar coins". When the problem has two unknowns, you need two independent equations. With three unknowns, you need three.

One variable

Example 1. Three times a number, increased by 7, equals twice the number plus 19. Find the number.

3x + 7 = 2x + 19. Move the x terms to one side and the numbers to the other: 3x − 2x = 19 − 7, so x = 12. Check: 3 × 12 + 7 = 43, and 2 × 12 + 19 = 43.

Example 2. The sum of three consecutive integers is 63. If the smallest is x, then x + (x + 1) + (x + 2) = 63, so 3x + 3 = 63 and x = 20. The numbers are 20, 21 and 22. A faster way: the middle number equals the average, 63 ÷ 3 = 21.

Two variables

For two unknowns there are two standard methods.

  • Substitution: solve one equation for one variable and plug the expression into the other.
  • Elimination: multiply the equations by suitable numbers so that one variable has the same coefficient in both, then add or subtract to remove it.

Elimination is usually faster in aptitude tests, particularly when the coefficients are small.

flowchart TB
    A["Two equations in x and y"] --> B["Multiply so that one variable<br/>has equal coefficients"]
    B --> C["Add or subtract the equations"]
    C --> D["Solve the single-variable equation"]
    D --> E["Substitute back to find the other variable"]
    E --> F["Check in both original equations"]

Elimination turns two equations into one by cancelling a variable.

Pens and notebooks

Five pens and three notebooks cost 95. Two pens and four notebooks cost 80. Find the price of one pen.

5p + 3n = 95 and 2p + 4n = 80. To remove n, multiply the first equation by 4 and the second by 3: 20p + 12n = 380 and 6p + 12n = 240. Subtract: 14p = 140, so p = 10. Substitute in the first equation: 50 + 3n = 95, so n = 15. Check the second equation: 20 + 60 = 80.

Coins

A bag holds 30 coins, each worth either 2 or 5, and the total value is 111. How many coins of each kind?

Let x be the number of 2-coins and y the number of 5-coins. Then x + y = 30 and 2x + 5y = 111. Multiply the first by 2: 2x + 2y = 60. Subtract from the second: 3y = 51, so y = 17 and x = 13. Check: 13 × 2 + 17 × 5 = 26 + 85 = 111.

A useful shortcut for "coins" and "tickets" problems is the assume-all-one-type method. If all 30 coins were worth 2, the total would be 60, which is 51 short of 111. Replacing one 2-coin by a 5-coin adds 3 to the total, so 51 ÷ 3 = 17 coins must be 5-coins.

Tickets

A show sells 200 tickets. Adult tickets cost 150 and child tickets cost 90. The total takings are 25,800. How many adults came?

Let a be the number of adults. Then 150a + 90(200 − a) = 25,800, so 150a + 18,000 − 90a = 25,800 and 60a = 7,800, giving a = 130 adults and 70 children. Check: 130 × 150 = 19,500 and 70 × 90 = 6,300, which add to 25,800.

A fraction problem

The sum of the numerator and denominator of a fraction is 20. If 3 is added to both, the fraction becomes 5/8. Find the fraction.

Let the fraction be x/y. Then x + y = 20, and (x + 3)/(y + 3) = 5/8, so 8x + 24 = 5y + 15, which simplifies to 8x − 5y = −9. Substitute y = 20 − x: 8x − 100 + 5x = −9, so 13x = 91 and x = 7. The fraction is 7/13. Check: (7 + 3)/(13 + 3) = 10/16 = 5/8.

Three variables

With three variables you need three equations. The plan is to use elimination twice: first remove one variable from two different pairs of equations, which leaves two equations in two variables, then solve those as before.

Example. Solve

  • x + y + z = 24 (equation 1)
  • 2x + y − z = 7 (equation 2)
  • x − y + 2z = 19 (equation 3)

Add equations 1 and 2 to remove z: 3x + 2y = 31. Then double equation 1 and subtract equation 3: 2x + 2y + 2z − (x − y + 2z) = 48 − 19, which gives x + 3y = 29. Now solve the pair 3x + 2y = 31 and x + 3y = 29. From the second, x = 29 − 3y, so 87 − 9y + 2y = 31, 7y = 56, y = 8, x = 5. Then z = 24 − 5 − 8 = 11.

Check in equation 2: 10 + 8 − 11 = 7. In equation 3: 5 − 8 + 22 = 19.

Solve two equations with code

This script solves two linear equations with the elimination formula (also known as Cramer's rule) and checks the answers against the original equations. It also catches the special cases where there is no unique answer.

JS Solve a pair of equations

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The two special cases are worth remembering. If the left sides are multiples of each other but the right sides do not match (2x + 3y = 6 and 4x + 6y = 15), there is no solution. If everything is a multiple (2x + 3y = 6 and 4x + 6y = 12), there are infinitely many solutions.

Solve three equations with code

For three equations, the same elimination idea can be written as a loop. This version uses Gaussian elimination, which is what you do by hand: pick a pivot row, scale it, and subtract it from the other rows until each row has only one unknown.

JS Three equations by elimination

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Algebraic identities and polynomials

Many "simplify" and "find the value" questions are one identity in disguise. Learn these by heart.

  • (a + b)² = a² + 2ab + b² and (a − b)² = a² − 2ab + b²
  • a² − b² = (a − b)(a + b)
  • (a + b)² − (a − b)² = 4ab
  • a³ + b³ = (a + b)(a² − ab + b²) and a³ − b³ = (a − b)(a² + ab + b²)
  • (a + b)³ = a³ + b³ + 3ab(a + b), so a³ + b³ = (a + b)³ − 3ab(a + b)
  • a³ + b³ + c³ − 3abc = (a + b + c)(a² + b² + c² − ab − bc − ca). If a + b + c = 0, then a³ + b³ + c³ = 3abc.

Example 1 (mental arithmetic). 103² − 97² = (103 − 97)(103 + 97) = 6 × 200 = 1,200. And 998² = (1000 − 2)² = 1,000,000 − 4,000 + 4 = 996,004.

Example 2. If a + b = 7 and ab = 10, then a² + b² = 49 − 20 = 29 and a³ + b³ = 7³ − 3 × 10 × 7 = 343 − 210 = 133. (The numbers are 2 and 5: 8 + 125 = 133.)

Example 3 (the x + 1/x trick). If x + 1/x = 5, square it: x² + 2 + 1/x² = 25, so x² + 1/x² = 23. Cubing works the same way: x³ + 1/x³ = 5³ − 3 × 5 = 110.

Example 4. If a + b + c = 0 and a = 1, b = 2, c = −3, then a³ + b³ + c³ = 1 + 8 − 27 = −18 and 3abc = 3 × 1 × 2 × (−3) = −18. They agree.

Polynomials: remainder and factor theorems

A polynomial f(x) is an expression such as x³ − 2x² + x − 5.

  • Remainder theorem: dividing f(x) by (x − a) leaves the remainder f(a). No long division is needed.
  • Factor theorem: (x − a) is a factor of f(x) exactly when f(a) = 0.

Example 5. The remainder when x³ − 2x² + x − 5 is divided by (x − 3) is f(3) = 27 − 18 + 3 − 5 = 7.

Example 6 (factoring a cubic). Factor x³ − 6x² + 11x − 6. Try small divisors of the constant term: f(1) = 1 − 6 + 11 − 6 = 0, so (x − 1) is a factor. Also f(2) = 0 and f(3) = 0. A cubic with roots 1, 2, 3 factors as (x − 1)(x − 2)(x − 3).

Example 7. For which k is (x − 2) a factor of x³ − kx + 6? Set f(2) = 8 − 2k + 6 = 0, so k = 7.

JS Verify the identities with numbers

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Strategy tips

  • Check the options first. In a multiple-choice test, you can often substitute the answer choices into the equation, which is sometimes faster than solving.
  • Choose the variable to solve for. If the question asks for the number of adults, define a as adults, so the answer is the value you solve for.
  • Watch the units. Do not mix cents with dollars, or hours with minutes, in one equation.
  • Integer answers. A coin count of 13.5 means an arithmetic slip, because coins and tickets come in whole numbers.

Check your understanding

Quick check · 5 questions

of 5 answered You scored / 5 · perfect!

  1. 1. Four times a number, decreased by 9, equals the number increased by 18. What is the number?

    4x - 9 = x + 18, so 3x = 27 and x = 9.
  2. 2. The sum of two numbers is 40 and their difference is 12. What is the larger number?

    x + y = 40 and x - y = 12. Adding gives 2x = 52, so x = 26 (and y = 14).
  3. 3. A purse has 25 coins, some of value 1 and some of value 5, worth 77 in all. How many 5-coins are there?

    x + y = 25 and x + 5y = 77. Subtract: 4y = 52, so y = 13. Check: 12 x 1 + 13 x 5 = 77.
  4. 4. Three pens and two pencils cost 19. Two pens and three pencils cost 16. What does one pen cost?

    3p + 2q = 19 and 2p + 3q = 16. Multiply the first by 3 and the second by 2: 9p + 6q = 57 and 4p + 6q = 32. Subtract: 5p = 25, so p = 5.
  5. 5. For which value of k does 2x + 3y = 6 together with 4x + ky = 12 have infinitely many solutions?

    The second equation must be twice the first: 4x + 6y = 12. So k = 6.

Summary

  • Translate carefully: say what each letter means, then turn each sentence into an equation.
  • A linear equation in one variable is solved by collecting like terms.
  • For two variables, use elimination (make one coefficient equal, then add or subtract) or substitution.
  • For three variables, eliminate the same variable from two pairs of equations, then solve the remaining pair.
  • Always check the answer in the original words, and expect whole numbers for counts of coins and tickets.
  • If the left sides are proportional, the system has no solution or infinitely many.

Next: Profit and Loss, the first lesson of the next chapter, where percentages and equations work together to analyze buying and selling.