Math Foundations

Algebra Basics: What Variables Are For

Variables are letters that stand in for numbers. See how expressions, substitution and like terms work, with small worked examples and common beginner mistakes.

On this page
  1. A letter is just a number you have not fixed yet
  2. Expressions, terms and coefficients
  3. Substitution: putting numbers in
  4. Using letters in formulas
  5. Simplifying: combining like terms
  6. Expanding brackets
  7. Why letters help
  8. Practicing

A letter is just a number you have not fixed yet

Algebra often looks intimidating because of the letters. But a variable is a simple idea: it is a symbol that stands in for a number. Sometimes the number is unknown, and sometimes it can change from one situation to the next. Using a letter lets you describe a rule once instead of repeating it for every possible number.

Imagine a hypothetical phone plan with a fixed charge of 5 plus 2 for every gigabyte used. Without algebra you would write out each case separately: 1 gigabyte costs 5 + 2, 2 gigabytes cost 5 + 4, and so on. With a letter, g, for the number of gigabytes, the rule becomes one expression: 5 + 2g. Now any amount can be handled by the same rule.

Expressions, terms and coefficients

An expression is a combination of numbers, letters and operations, such as 3n + 2. It does not have an equals sign, so it is not a statement that can be true or false. It is more like a recipe for producing a number once you know the letter’s value.

Some vocabulary helps when reading algebra:

  • A term is one part of an expression separated by plus or minus signs. In 3n + 2, the terms are 3n and 2.
  • A coefficient is the number multiplying a letter. In 3n, the coefficient is 3.
  • A constant is a term with no letter, like the 2.

A key convention is that writing a number next to a letter means multiplication. So 3n means 3 × n, not “3 and n side by side”. This is the source of a very common mistake, covered below.

Substitution: putting numbers in

Evaluating an expression means replacing the letter with a number and calculating. This is called substitution.

If n = 4, then 3n + 2 becomes 3 × 4 + 2. Multiplication comes before addition, so that is 12 + 2 = 14. The sequence of steps follows the usual order of operations, which is why that topic is worth learning alongside algebra.

Try another: what is 2(x + 5) when x = 3? First the bracket: 3 + 5 = 8. Then 2 × 8 = 16.

A frequent slip is to read 3n with n = 4 as “34”. It means 3 × 4 = 12. When you substitute, it can help to put the number in brackets first, writing 3(4), so the multiplication stays visible.

Using letters in formulas

Formulas are algebra you may already know. The perimeter of a rectangle with length l and width w is P = 2l + 2w. If l = 5 and w = 3, then P = 2 × 5 + 2 × 3 = 10 + 6 = 16. The same formula works for every rectangle; only the values change.

Variables in algebra are similar to variables in a spreadsheet, where a cell reference such as B2 holds a value that formulas can use, and to variables in programming, where a name holds a number or other data. If you plan to try python beginners material, you will find the same idea there, with the added feature that a value can be reassigned.

Simplifying: combining like terms

Like terms have the same letter part. You can add or subtract them by adding or subtracting their coefficients.

  • 2x + 3x = 5x. Think of it as two x’s plus three x’s, which makes five x’s.
  • 7y − 4y = 3y.
  • 4x + 2 cannot be simplified further, because 4x and 2 are different kinds of term.

A useful check is to substitute a number into both sides. Let x = 2 in 2x + 3x: that is 4 + 6 = 10, and 5x = 5 × 2 = 10. They match. Testing a number does not prove a rule in general, but it quickly catches errors.

Expanding brackets

When a number multiplies a bracket, it multiplies each term inside. This is the distributive property:

3(x + 4) = 3x + 12

Check with x = 1: the left side is 3 × 5 = 15, and the right side is 3 + 12 = 15. A common error is to multiply only the first term and write 3x + 4. Another is a sign error with subtraction: 2(x − 3) = 2x − 6, not 2x − 3.

Why letters help

The real benefit of variables is generality. A numerical fact such as 2 + 3 = 3 + 2 is true, but the statement a + b = b + a says the same thing for every pair of numbers at once. Letters also let you describe a relationship before you know the numbers, which is the starting point for solving problems. For example, “I think of a number, double it and add 3, and get 11” becomes 2n + 3 = 11. Finding n from a statement like this is the subject of the article on linear equations.

Variables also underlie graphs. When a rule links two quantities, such as the cost of the phone plan and the gigabytes used, each can be plotted on an axis, which is what graph reading is about.

Practicing

Short practice with immediate checking works well. Pick a number, substitute it into an expression before and after you simplify, and see whether the results agree. If they do not, you have found an error to investigate, which builds the kind of persistence described in discussions of problem-solving habits. Working through worked examples first, then trying similar questions with less guidance, is a common study approach, although how well it works varies between learners.

The complete guide to math foundations

Number Sense: The Foundation of Everyday Mathematics
Read the guide

Keep exploring

Guides from other topics

All topics →