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 names a single value, once you know its variables. It can be a number or a variable on its own, or several of those combined with operations (++, −-, ×\times, ÷\div, exponents). It is a phrase, the algebraic version of a number. Each of these is an expression:

7,x,3n,x+5,2a−7,y4,5x2.7, \qquad x, \qquad 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. Whether that statement is true can depend on which number the variable turns out to be. 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,2a−7=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 labeled as a phrase. The right panel shows the equation x + 5 = 9 labeled 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

Check your understanding

The expression 2n+52n + 5 and the equation 2n+5=112n + 5 = 11 share the same left side. What do you do with each one?

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. Start by naming the unknown with a letter. Then read the whole phrase for its meaning: what quantity are you starting from, what happens to it, and in what order? Once you can answer that, this vocabulary helps you write down each operation:

WordsOperationExample phraseExpression
sum, more than, increased by, total++seven more than xxx+7x + 7
difference, less than, decreased by, fewer−-five less than xxx−5x - 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 x−5x - 5, not 5−x5 - 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:

5x−3.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 it was the meaning of the phrase, not just its words, that decided the operation and the order.

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 2⋅3+4=102 \cdot 3 + 4 = 10. The parentheses are what make sure “twice the sum” doubles the whole sum, not just part of it.

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+3y−7.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 a ++ or −- sign written at the main level of the expression, not one tucked inside parentheses; a grouped piece like (x+4)(x + 4) from the last example stays together as one piece until the parentheses are removed. By convention a term carries the sign written in front of it, so the subtracted piece here 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+3y−75x + 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 labeled coefficients, x and y are variables, and the minus 7 is labeled the constant term.5x+3y−7termtermtermcoefficientconstantvariables: 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

Which statement about the expression 9k+29k + 2 is correct?

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 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 "5757", the number fifty-seven, which is the wrong number entirely, not the product 5×75 \times 7. Written with parentheses, the same substitution gives 5(7)=355(7) = 35, which is what 5x5x actually means.

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.

Why the same expression gives different values for different inputs#

An expression with a variable is not one fixed number. It is a set of instructions that produces a number once you choose the variable’s value; the instructions stay the same, but what you choose does not.

Take 2x+12x + 1. Substituting x=3x = 3 gives 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 instructions, multiply by two and add one, are identical both times. Only the number substituted for xx changed, from 33 to 55, and that alone is what changed the result, from 77 to 1111.

This is exactly what the word variable promises: because xx can be any number, the expression can produce a different value for each number you choose. Getting a different answer when you substitute a different value is expected, not a mistake.

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 evaluated at those values at once: the area, w×hw \times h, and the perimeter, 2(w+h)2(w + h). Setting the two numbers is the substitution; the readout is the evaluation.

Try it first with one letter changing. Set w=4w = 4, then step hh from 11 to 55 and watch the area. It runs 44, 88, 1212, 1616, 2020, the single expression 4h4h evaluated at five different heights: one expression, five inputs, five results. Then set w=5w = 5 and h=3h = 3. Before you look at the readout, work out w×hw \times h and 2(w+h)2(w + h) yourself on paper, and check your answers against what the rectangle reports.

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 4 Evaluate 2a2−b2a^2 - b when a=3a = 3 and b=5b = 5

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

2a2−b=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=2⋅9=18.2(3)^2 = 2 \cdot 9 = 18.

Then subtract the value of bb:

18−5=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. The parentheses matter most in that case, because they keep the whole value, sign included, together as one piece.

Worked example 5 Evaluate 3x+13x + 1 when x=−2x = -2

Substitute −2-2 for xx, keeping it in parentheses so the multiplication and the sign both stay clear:

3x+1=3(−2)+1.3x + 1 = 3(-2) + 1.

The parentheses matter here more than ever. Without them, "3−23-2" would read as a subtraction instead of the multiplication 3×(−2)3 \times (-2) that 3x3x actually means, and the sign on the 22 could be lost along the way.

Now follow the order of operations, multiplying before adding:

3(−2)+1=−6+1=−5.3(-2) + 1 = -6 + 1 = -5.

So when x=−2x = -2, the expression 3x+13x + 1 is worth −5-5.

Check your understanding

Evaluate 4n−34n - 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.

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems 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)

A book showing you how to share thirty coins among five people, written out entirely in words, is how algebra problems were solved and recorded for a very long time.

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 stand not only for the number you are hunting for, but also for the numbers you already know. He used consonants for the known amounts and vowels for the unknown ones.

That was a small change of notation with a big effect. One line of letters could now stand for every problem of one shape at once, written in symbols instead of paragraphs. 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.