Sub topic 1
Formulas, variables, and choosing what to solve for
A formula is an equation that stores a relationship so you can reuse it. Every technique in this tutorial depends on one first step: deciding which symbol you want, and looking at where it sits in the formula. This chapter covers that step. The later chapters cover the rearranging moves themselves.
Prerequisites
This chapter assumes you can do the following:
- Do arithmetic with fractions, negative numbers, and exponents.
- Apply the order of operations (parentheses, exponents, multiplication and division, addition and subtraction).
- Read algebraic notation such as
3x + 2, where3xmeans 3 times x. - Solve a simple one-variable linear equation such as
3x + 2 = 11.
The Python examples are short. If you want to run the last one, install SymPy with pip install sympy.
What a formula is
A formula is an equation that relates several quantities, usually written with a single symbol alone on the left side:
d = rtrelates distance, rate, and time.F = (9/5)C + 32relates temperature in Fahrenheit and Celsius.P = 2(l + w)relates the perimeter of a rectangle to its length and width.A = πr²relates the area of a circle to its radius.
Each formula is a statement that is true for every set of values that fits the situation. It is not a question with one answer. d = rt holds for a car at 60 km/h for 2 hours and for a snail at 0.01 km/h for 5 hours.
The letter on the left is just the form the formula was first written in. The relationship itself does not point in any direction. If d = rt is true, then r = d/t is true as well, and so is t = d/r when r is not zero. These are the same fact written three ways.
Variables, constants, and parameters
The symbols in a formula play different roles. Telling them apart makes rearranging safer.
| Kind of symbol | Meaning | Example |
|---|---|---|
| Variable | A quantity that can take different values from one use to the next | `r`, `t`, `C`, `F` |
| Numeric constant | A fixed number written in the formula | The 9/5 and 32 in the Fahrenheit formula |
| Named constant | A fixed number given a letter or symbol | `π`, or the speed of light `c` |
| Parameter | A symbol held fixed during one problem but able to change between problems | The resistance `R1` of a resistor you already own |
The line between a variable and a parameter depends on the problem. In A = P(1 + rt), which gives the total amount after simple interest, P is the starting amount, r the yearly rate, and t the number of years. A loan officer who fixes r and t across customers treats them as parameters and P as the variable. A customer comparing banks treats r as the variable.
For rearranging, only one distinction matters. Some symbols are your target and the rest are treated as known. The known ones can be numbers or letters, and you handle them the same way.
The target variable
The target variable (also called the subject, or the variable you solve for) is the symbol you want alone on one side of the equation. Rearranging a formula means rewriting it so the target stands alone, with every other symbol on the other side.
Start by stating the goal in one sentence: "Solve F = (9/5)C + 32 for C." The "for C" part is the instruction. Without it the task has no definite outcome, because the formula can be solved for F or C.
A target is a good choice when the situation gives you the other quantities and asks for it. Suppose a thermometer reads 68 °F and you want Celsius. You know F and want C, so C is the target.
You can rearrange in two ways:
- Substitute first. Put in the known numbers, then solve the resulting equation for one unknown. This is fine for one calculation.
- Rearrange first. Solve for the target as a formula, then substitute. This is better when you will calculate many times, when you want to see how the target depends on the others, or when you are writing code.
Rearranging first has a further advantage. The result is a general statement you can check against special cases, which later chapters do.
One formula, several targets
The three forms of d = rt show this in code. Each function solves for a different target.
def distance(rate, time):
return rate * time
def rate(distance, time):
return distance / time
def duration(distance, rate):
return distance / rate
print(distance(60, 2.5)) # 150.0
print(rate(150, 2.5)) # 60.0
print(duration(150, 60)) # 2.5The three calls use the same triple of numbers (60, 2.5, 150), so each result confirms the other two. This is a first, informal version of checking.
Reading a formula before you touch it
Before you write any step, look at how the target appears. Two features decide how hard the problem is.
- How many times the target appears. If it appears once, you can peel away the operations around it one by one. If it appears more than once, you must first combine those appearances into one.
- How the target is attached. It might be added to something, multiplied, inside a fraction, under a power, or under a root. Each attachment needs its own inverse operation.
Count appearances in the formula as written. The same relationship can be written two ways with different counts:
A = P(1 + rt)hasPonce. Solving forPis a single division.A = P + Prtis the same formula expanded, withPtwice. Solving forPneeds factoring first.
The table below shows how the target and the form of the formula interact.
| Formula | Target | Appearances | What stands in the way |
|---|---|---|---|
| `d = rt` | `r` | 1 | A multiplication by `t` |
| `F = (9/5)C + 32` | `C` | 1 | A multiplication, then an addition |
| `A = P + Prt` | `P` | 2 | Two terms contain `P`; they must be combined |
| `ax + b = cx + d` | `x` | 2 (on both sides) | `x` sits on both sides and must be gathered |
| `1/R = 1/R1 + 1/R2` | `R2` | 1 | `R2` is in a denominator |
| `A = πr²` | `r` | 1 | A power, which brings a sign choice |
| `s = ut + (1/2)at²` | `a` | 1 | A product with `t²`, easy to divide out |
| `s = ut + (1/2)at²` | `t` | 2 | `t` appears alone and squared, so it needs a different technique |
The last two rows use the same formula, and their difficulty differs. The choice of target decides the work, not the formula alone.
A way to count appearances in code
A computer algebra system can count appearances for you. This script uses SymPy to count how many times P appears in each form of the interest formula.
from sympy import symbols, expand, preorder_traversal
P, r, t = symbols('P r t')
def occurrences(expr, var):
return sum(1 for node in preorder_traversal(expr) if node == var)
factored = P * (1 + r * t)
expanded = expand(factored)
print(factored) # P*(r*t + 1)
print(expanded) # P*r*t + P
print(occurrences(factored, P)) # 1
print(occurrences(expanded, P)) # 2
print(occurrences(factored, t)) # 1preorder_traversal visits every node in the expression tree, and the function counts the nodes equal to the chosen symbol. The count is a quick way to classify the problem, and you can do the same by eye.
Choosing a strategy
The count and the attachment together point to a plan. The diagram shows the decision at this stage. The boxes after the first branch name the chapters' topics that follow.
You do not need the whole route yet. For now, practice the first two boxes: name the target and count its appearances.
Common errors at this stage
These mistakes happen before any algebra, and they spoil the rest.
- Solving for the wrong symbol. In
A = P(1 + rt)it is easy to rearrange forrwhen the problem asks about the starting amountP. Write "solve forP" at the top of your work and check it at the end. - Mistaking a number for a variable, or the reverse. In
F = (9/5)C + 32, the 32 is a constant. In a physics formula, a capitalRand a lowercaserare different symbols. Case matters in formulas, and so do subscripts:R1andR2are two separate quantities. - Reading implied multiplication wrongly.
PrtmeansP × r × t, not a single symbol namedPrt. When a formula uses multi-letter names such asspeed, the writer will usually separate the products with a visible*or a space. - Miscounting appearances. Check both sides of the equation. In
ax + b = cx + d, the targetxis on both sides, so it appears twice, even though each side shows it once. - Treating a parameter as unknown. If
R1is given, it counts as known, even if it is a letter and not a number. - Forgetting what the symbols mean. Rearranging does not change meaning. After solving for
C, the new formula still describes a temperature, and its units are degrees Celsius. Keep the meaning in mind to catch nonsense later.
Why this skill is worth the care
Formulas are written once in the form that is most natural for the topic, so you will often need a form the textbook did not give you.
- In physics,
V = IR(Ohm's law) is usually written with voltage alone. A circuit designer who knows the voltage and wants a resistance needsR = V/I. - In geometry, the volume of a cylinder is
V = πr²h. A tank maker who must hold a given volume at a fixed radius needsh. - In finance, the simple-interest formula
A = P(1 + rt)gives the final amount. A saver who wants a particular amount needs the starting depositP.
In each case the person holds some values and needs another. The skill is to turn "I have these and want that" into a formula whose left side is the "that".
Summary of the working model
- A formula is a general equation relating quantities, and no symbol on a given side has a special status.
- Symbols are variables, constants, or parameters. For rearranging, what matters is which one is your target.
- State the target before you start: "solve for
x". - Count how many times the target appears and note how it is attached.
- One appearance means you can undo the surrounding operations. More than one means you must gather them first.
- Fractions, powers, and roots add steps and sometimes restrictions, which later chapters treat.
Exercises
Exercise
In the formula P = 2(l + w), you are asked to find the width w for a rectangle whose perimeter and length are known. Name the target, the known symbols, and the number of times the target appears.
Show answer
The target is w. The known symbols are P and l (the constant 2 is fixed). The target w appears once, inside the parentheses, so it needs only the inverse operations of the surrounding steps, which are taken up in later chapters.
Exercise
Count the appearances of x in each equation: (a) 3x + 7 = 22, (b) 5x - 2 = x + 10, (c) y = x(x + 4).
Show answer
(a) One appearance. (b) Two appearances, one on each side. (c) Two appearances, one as the factor x and one inside the parentheses, so expanding gives x² + 4x with x in two different terms.
Exercise
The formula A = P + Prt and the formula A = P(1 + rt) describe the same relationship. If you want to solve for P, which form is easier to start from, and why?
Show answer
A = P(1 + rt) is easier. P appears once, so dividing both sides by (1 + rt) isolates it. In A = P + Prt, P appears twice, so you would first need to factor it out, which produces the first form.
Exercise
Using the distance, rate, and duration functions from this chapter, a trip covers 210 km at 70 km/h. Which function gives the time, and what does it return?
Show answer
duration(210, 70) gives 3.0 hours, because 210 / 70 = 3.0.