Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 37 ยท Linear Equations

Literal Equations and Formulas

Learn to solve a formula for any variable: rearrange area, perimeter, speed and temperature formulas with inverse operations, and check with code.

A literal equation is an equation with several letters, such as a formula. The formula for the perimeter of a rectangle is P = 2l + 2w. Normally it gives P from l and w. But what if you know the perimeter and the width, and you need the length? You must rearrange the formula to get l alone. This is called solving for a variable.

The good news: you use exactly the same steps as for numerical equations. Treat the other letters as if they were numbers.

Solving for a variable

Example 1. Solve P = 2l + 2w for l.

  • Subtract 2w from both sides: P - 2w = 2l
  • Divide both sides by 2: l = (P - 2w) / 2

Check with numbers: if P = 22 and w = 3, then l = (22 - 6)/2 = 8. Indeed 2(8) + 2(3) = 22.

Example 2. Solve d = rt (distance = rate ร— time) for t. Divide by r: t = d / r.

Example 3. Solve A = (1/2)bh (area of a triangle) for h.

  • Multiply both sides by 2: 2A = bh
  • Divide by b: h = 2A / b

Example 4. Solve F = (9/5)C + 32 for C (Fahrenheit and Celsius).

  • Subtract 32: F - 32 = (9/5)C
  • Multiply by the reciprocal 5/9: C = (5/9)(F - 32)

Use this to convert: 212 ยฐF gives (5/9)(180) = 100 ยฐC, the boiling point of water at sea level.

When you divide by a letter, you assume it is not zero. For t = d / r we need r โ‰  0, which makes sense: nothing travels a distance at speed zero.

Variable on both sides

Example 5. Solve ax + b = cx + d for x.

  • Subtract cx: ax - cx + b = d
  • Subtract b: ax - cx = d - b
  • Factor out x (reverse of distributing): x(a - c) = d - b
  • Divide by (a - c): x = (d - b) / (a - c)

This is the general solution of the equation type from the previous lesson: one formula that solves them all (when a โ‰  c).

Python Rearranged formulas in code

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

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

If converting forth and back returns the start value, the rearranged formula is correct.

Let SymPy rearrange for you

Python Solve a formula for any variable

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

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The output may look different from yours (for example, P/2 - w instead of (P - 2w)/2), but the two are equal. Always check equivalence by simplifying or by testing numbers.

Common formulas to practice

Formula Meaning
A = lw Area of a rectangle
C = 2ฯ€r Circumference of a circle
V = lwh Volume of a box
d = rt Distance, rate, time
I = Prt Simple interest
y = mx + b Line (coming in chapter 3)

Common mistakes

  1. Undoing in the wrong order. In F = (9/5)C + 32, subtract 32 first.
  2. Dividing only one term. In P - 2w = 2l, divide the whole left side by 2: (P - 2w)/2 or P/2 - w. Writing P - 2w/2 divides only the second term and is wrong.
  3. Treating letters differently from numbers. They obey the same rules.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Solve d = rt for r.

    Divide both sides by t: r = d/t.
  2. 2. Solve A = lw for w.

    Divide both sides by l.
  3. 3. Solve y = 3x + 5 for x.

    Subtract 5 to get y - 5 = 3x, then divide by 3.
  4. 4. Solve P = 2l + 2w for w.

    Subtract 2l, then divide everything by 2.

Summary

  • A literal equation has several letters; solve for one by treating the others like numbers.
  • Use inverse operations in reverse order, doing the same to both sides.
  • When the target variable appears twice, gather and factor it.
  • Verify by substituting numbers, or let SymPy check.

Next: Linear Inequalities