This site is a work in progress. New lessons are added regularly. Contact us

Variables and Expressions

Learning goals

  • Use a letter for a number that is unknown or free to change
  • Tell an expression from an equation, and say what you do to each
  • Translate a phrase into algebra, minding the reversal in less than
  • Name the terms, coefficient and constant of an expression
  • Evaluate by substituting each value in parentheses

What a variable is

A variable is a letter that stands for a number. The letter does not have a fixed value of its own; it is a placeholder, exactly the way a blank box would be. Writing

3×n3 \times n

says “three times whatever number nn is.” If nn is 44, the phrase is worth 3×4=123 \times 4 = 12; if nn is 1010, it is worth 3×10=303 \times 10 = 30. The same letter can take different values on different occasions, which is precisely why it is called variable: its value can vary.

There are two everyday reasons to reach for a letter instead of a number.

The first is that the number is unknown. You may be trying to find it, the way you will in the next few lessons when you solve for xx. Until you pin it down, a letter holds its place so you can still write down everything you do know about it.

The second is that the number is changing, or you want a single statement to cover many cases at once. The cost of nn notebooks is 3×n3 \times n for every possible nn; you do not want to rewrite the rule for each separate purchase. One expression with a variable replaces an endless list of arithmetic examples.

Any letter will do, and the choice is up to you. People lean on xx and yy out of long habit. Even so, a letter that hints at its meaning often reads better: tt for time, dd for distance, nn for a count of things. The letter is just a name; what matters is that you state clearly what it stands for.

Expressions versus equations

These two words name different things, and keeping them apart will save you constant confusion later.

An algebraic expression is a combination of numbers, variables, and operations (++, -, ×\times, ÷\div, exponents). Such a combination stands for a single value once you know the variables. It is a phrase, the algebraic version of a number. Each of these is an expression:

3n,x+5,2a7,y4,5x2.3n, \qquad x + 5, \qquad 2a - 7, \qquad \frac{y}{4}, \qquad 5x^2.

An expression has no equals sign. On its own it makes no claim; it simply names an amount, the way 3×43 \times 4 names an amount before you work it out.

An equation is two expressions joined by an equals sign, stating that they have the same value. It is a complete sentence, and like any sentence it can be true or false. Each of these is an equation:

3n=12,x+5=9,2a7=a.3n = 12, \qquad x + 5 = 9, \qquad 2a - 7 = a.

The difference is exactly the difference between a phrase and a sentence. “Three more than xx” is a phrase; it points at a quantity but asserts nothing. “Three more than xx equals nine” is a sentence; it makes a claim you could check. You evaluate an expression (work out its value), but you solve an equation (find the variable value that makes the sentence true). Solving is the work of the coming lessons; this lesson is about reading and evaluating expressions.

Expression versus equationThe left panel shows the expression x + 5 labelled as a phrase. The right panel shows the equation x + 5 = 9 labelled as a sentence, formed by joining two expressions with an equals sign.Expression (a phrase)x + 5no equals sign:names a valueEquation (a sentence)x + 5 = 9has an equals sign:can be true or false
An expression is a phrase that names a value; adding an equals sign and a second expression makes an equation, a full sentence that can be true or false.

Check your understanding

Which of these is an equation (not just an expression)?

Answer choices

Translating words into expressions

Most of the time a problem arrives in words, and the first real skill of algebra is turning those words into an expression. The reliable method is to name the unknown with a letter, then replace each piece of the sentence with its arithmetic operation. A small vocabulary covers almost everything:

WordsOperationExample phraseExpression
sum, more than, increased by, total++seven more than xxx+7x + 7
difference, less than, decreased by, fewer-five less than xxx5x - 5
product, times, of, twice, double×\timesthree times xx3x3x
quotient, divided by, per, split÷\divxx divided by 44x4\dfrac{x}{4}

Two of these phrases hide a trap worth pausing on. “Five less than xx” is x5x - 5, not 5x5 - x. The phrase tells you to start with xx and take five away, so the xx comes first even though 55 is spoken first. The same flip happens with “fewer than” and “subtracted from.” Read these by their meaning, not by the left-to-right order of the words.

When several operations combine, build the expression one phrase at a time, and use parentheses whenever a whole group must be operated on together.

Worked example 1 Translate three phrases into expressions

Name the unknown number xx in each, then convert phrase by phrase.

“Eight more than twice a number.” Twice the number is 2x2x, and eight more than that adds 88:

2x+8.2x + 8.

“The product of 55 and a number, decreased by 33.” The product of 55 and the number is 5x5x, and decreased by 33 subtracts 33:

5x3.5x - 3.

“A number divided by 22, then increased by 11.” Dividing by 22 gives x2\dfrac{x}{2}, and increasing by 11 adds 11:

x2+1.\frac{x}{2} + 1.

In each case the unknown is held by the letter xx, and every word maps to one operation.

The trickiest translations are the ones where a sum or difference must be operated on as a whole. Here parentheses do the grouping, exactly as they did in the order-of-operations chapter.

Worked example 2 Translate 'twice the sum of a number and four'

The phrase has two layers. The inner phrase, “the sum of a number and four,” is x+4x + 4. The outer word “twice” then doubles that entire sum, not just the xx.

To double the whole sum, wrap it in parentheses before multiplying:

2(x+4).2(x + 4).

Without the parentheses, 2x+42x + 4 would double only the xx and leave the 44 alone, a different expression. Compare the two by trying x=3x = 3: the correct 2(3+4)=142(3 + 4) = 14, but 2x+42x + 4 would give 23+4=102 \cdot 3 + 4 = 10. The parentheses are what keep “twice the sum” honest.

Check your understanding

Which expression means "four less than a number nn"?

Answer choices

The parts of an expression

To work with an expression you need names for its pieces. Consider

5x+3y7.5x + 3y - 7.

The expression is built from parts that are added or subtracted together; each such part is a term. This expression has three terms: 5x5x, 3y3y, and 7-7. Terms are the chunks separated by the ++ and - signs. By convention a term carries the sign written in front of it, so the subtracted piece is the term 7-7, not a bare 77.

Inside a term like 5x5x, the number 55 is the coefficient: the number multiplied by the variable. The coefficient of 3y3y is 33. A variable written with no visible number, such as plain xx, has a coefficient of 11, because xx means 1x1x, one copy of xx. Likewise x-x means 1x-1x, so its coefficient is 1-1.

A term that is just a number, with no variable at all, is a constant. In 5x+3y75x + 3y - 7 the constant is 7-7. It is called constant because it never changes: whatever the variables do, that term contributes the same fixed amount.

The parts of an expression 5x + 3y - 7The expression 5x + 3y minus 7 with each term boxed. The 5 and 3 are labelled coefficients, x and y are variables, and the minus 7 is labelled the constant term.5x+3y7termtermtermcoefficientconstantvariables: x and y
The parts of 5x + 3y - 7: three terms separated by the + and - signs, two of them with a coefficient on a variable, and one constant term.

Check your understanding

In the expression 9k+29k + 2, what is the coefficient of the variable term?

Answer choices

Evaluating an expression by substitution

To evaluate an expression you replace each variable with a given number, then do the arithmetic. Replacing a letter with a number is called substitution, and it is the single most useful thing you can do with an expression. Substitution turns an algebraic phrase back into an ordinary calculation.

There is one habit that prevents nearly every mistake. When you substitute, put the number inside parentheses where the variable used to be. The parentheses keep the original operations intact, especially multiplication and signs, so nothing gets accidentally merged or dropped.

Why parentheses matter so much is easiest to see with a coefficient. In 5x5x the variable is being multiplied by 55. If x=7x = 7 and you simply write the 77 next to the 55, you get the meaningless "5757". Written with parentheses, the same substitution gives 5(7)=355(7) = 35, which is what 5x5x actually means.

Why the same expression gives different values for different inputs#

An expression containing a variable is not a single number; it is a rule that produces a number once the variable is chosen. The rule is fixed, but its output depends on the input.

Take 2x+12x + 1. Substituting x=3x = 3 replaces the variable by 33 throughout, giving 2(3)+1=6+1=72(3) + 1 = 6 + 1 = 7. Substituting x=5x = 5 instead gives 2(5)+1=10+1=112(5) + 1 = 10 + 1 = 11. The operations, multiply by two and add one, never changed; only the number fed in changed, so the result changed with it.

This is exactly the behaviour the word variable promises. Because the letter can be any number, the expression stands for a family of values at once, one for each choice of the variable. Substitution is how you pick out the single member of that family you currently want. The value you get depends on the input, so changing the input can change the output, as it did here from 77 to 1111. Getting a different answer when you change the input is a feature, not an error.

You can carry out a substitution by hand below instead of reading about one. The rectangle takes a width ww and a height hh, both yours to set, and reports two expressions in those two letters at once. Those two are the area, which is the value of w×hw \times h, and the perimeter, which is the value of 2(w+h)2(w + h). Choosing the two numbers is the substitution; the readout is the evaluation.

Hold the width at 44 and step the height up from 11 to 55. The area runs 44, 88, 1212, 1616, 2020, which is the single expression 4h4h evaluated at h=1,2,3,4,5h = 1, 2, 3, 4, 5: one rule, five inputs, five values. Then set the width to 55 and the height to 33, work out w×hw \times h and 2(w+h)2(w + h) on paper, and compare. The figure will not do the substitution for you, but it will tell you whether yours was right.

One rule, many inputs, many values

A rectangle 4 units wide and 2 units tall. With w = 4 and h = 2, the expression w times h is 8. The expression 2(w + h) is 12. A rectangle drawn on a grid of unit squares, inside a dashed boundary showing how large it can grow. Use the controls below the figure to change either dimension and watch both expressions take new values. 4 2
Width Height

A rectangle 4 units wide and 2 units tall. With w = 4 and h = 2, the expression w times h is 8. The expression 2(w + h) is 12.

A rectangle whose width and height you set. The readout evaluates two expressions in those two letters: the area, w times h, and the perimeter, 2(w + h).

Worked example 3 Evaluate 3x+43x + 4 when x=5x = 5

Substitute 55 for xx, writing it in parentheses so the multiplication stays clear:

3x+4=3(5)+4.3x + 4 = 3(5) + 4.

Now follow the order of operations: multiply before you add.

3(5)+4=15+4=19.3(5) + 4 = 15 + 4 = 19.

So when x=5x = 5, the expression 3x+43x + 4 is worth 1919.

Worked example 4 Evaluate 2a2b2a^2 - b when a=3a = 3 and b=5b = 5

Replace each variable by its value, every one in parentheses:

2a2b=2(3)2(5).2a^2 - b = 2(3)^2 - (5).

By the order of operations the exponent goes first, then the multiplication, then the subtraction. Square the 33:

2(3)2=29=18.2(3)^2 = 2 \cdot 9 = 18.

Then subtract the value of bb:

185=13.18 - 5 = 13.

So the expression equals 1313. Notice the exponent applied only to the 33, the value of aa, because a2a^2 means aa is squared, not the whole term.

Substitution works just as smoothly when the value is negative, a fraction, or a decimal. The parentheses matter most in those cases, because they keep the whole value together, sign and all.

Worked example 5 Evaluate x4x - 4 when x=2x = -2

Substitute 2-2 for xx, keeping it in parentheses so the sign travels with it:

x4=(2)4.x - 4 = (-2) - 4.

Subtracting 44 from 2-2 moves four further down the number line, into the negatives:

(2)4=6.(-2) - 4 = -6.

So when x=2x = -2, the expression x4x - 4 is worth 6-6. Writing the input as (2)(-2) rather than a bare 2-2 is what keeps the leading minus sign from being misread.

Check your understanding

Evaluate 4n34n - 3 when n=2n = 2.

Answer choices

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (Optional)

Solve one algebra problem and you had solved just that one problem. That was the trouble with algebra for a very long time. A book could show you how to share thirty coins among five people. It could not give the rule for any number of coins and any number of people. Each fresh set of numbers meant starting the whole thing again.

Francois Viete was a French lawyer who did mathematics at night. In 15911591 he wrote a short book with one very large idea. Letters, he said, should also stand for the numbers you already know. He used consonants for the known amounts and vowels for the unknown ones.

That looks like a small change of notation, and it was not. One line of letters could now stand for every problem of one shape. Which numbers to use became a choice you made later, by substitution.

You used that same power in this lesson. The cost of nn notebooks is 3n3n, and that one expression covers every trip to the shop you will ever make.