Skip to main content

Variables and Expressions

Imagine you want to describe a rule that works for every number at once — "double it and add three" — without writing out infinitely many examples. That single idea, a letter standing in for any number, is the doorway to all of algebra. A variable lets you capture a pattern, a relationship, or an unknown quantity in one compact symbol, and an expression lets you build meaningful combinations out of those symbols.

This page is where arithmetic grows up. You already know how to add, multiply, and follow order of operations with numbers; here you learn to do the same with symbols, so that one line of algebra can speak about an entire family of situations at once. Master this and everything downstream — equations, functions, calculus — becomes readable.

Learning Objectives

By the end of this page, you should be able to:

  • Explain what a variable is and distinguish it from a constant.
  • Identify the terms, coefficients, and constants in an algebraic expression.
  • Apply the distributive property to expand and factor expressions.
  • Combine like terms correctly to simplify expressions.
  • Use the order of operations (PEMDAS) to evaluate expressions without ambiguity.
  • Substitute values into an expression and evaluate the result reliably.

Quick Answer

A variable is a symbol (usually a letter) that represents a number whose value can vary or is unknown. An algebraic expression is a combination of variables, numbers, and operations — such as 3x+5 3x + 5 — that has no equals sign, so it names a quantity rather than making a claim. Each additive piece is a term; the number multiplying a variable is its coefficient; a lone number is a constant. You simplify an expression by using the distributive property, a(b+c)=ab+aca(b + c) = ab + ac, and by combining like terms (terms with the identical variable part). You evaluate an expression by substituting numbers for the variables and applying PEMDAS: Parentheses, Exponents, Multiplication/Division (left to right), Addition/Subtraction (left to right).

Where It Came From

For most of human history, mathematics had no symbols for the unknown at all. Problems were written entirely in words — a style historians call rhetorical algebra. A Babylonian scribe around 1800 BCE could solve what we would call a quadratic equation, but expressed it as a recipe in sentences: "I added the area and the side, and it was 3/4." There was no "xx" to point at, so every problem had to be reasoned about verbally, from scratch.

The first real crack toward symbolism came from Diophantus of Alexandria (around 250 CE), whose Arithmetica introduced abbreviations for the unknown and its powers. This syncopated algebra — shorthand, but not yet a true symbolic system — was a genuine leap, though his notation could not express general relationships flexibly.

The word algebra itself comes from al-Khwārizmī, a scholar in Baghdad around 820 CE, whose book al-Kitāb al-mukhtaṣar fī ḥisāb al-jabr wa'l-muqābala gave us the term al-jabr ("restoration," the act of moving a subtracted term to the other side). Remarkably, al-Khwārizmī still wrote everything in words — no symbols — yet he systematized methods that worked for whole classes of problems. That shift from clever one-off tricks to general procedures is the seed of everything here.

The true revolution — letters standing for numbers — arrived with the French mathematician François Viète around 1591. Viète had the decisive insight: use letters not just for unknowns but also for known but unspecified quantities (parameters). Suddenly you could write a formula once and it spoke about every case at once. A generation later René Descartes (1637) gave us the notation we still use today — x,y,zx, y, z for unknowns, a,b,ca, b, c for constants, and exponents written as superscripts like x3x^3.

Why did this matter so much? Because a good symbol does part of the thinking for you. Once "the unknown" is a thing you can write down, move around, and manipulate mechanically, you no longer have to hold the entire problem in your head in words. The invention of the variable turned mathematics from a collection of verbal puzzles into a portable, general-purpose machine for reasoning.

Variables, Terms, Coefficients, and Constants

A variable is a placeholder for a number. In 3x+5 3x + 5, the letter xx can stand for any number; if x=4x = 4, the expression equals 17 17. Variables come in two flavours in practice: an unknown we want to find (as in an equation), or a parameter that can range over many values (as in a formula or function).

An expression is any legal combination of numbers, variables, and operations with no equals sign. Compare:

  • 3x+5 3x + 5 is an expression — it names a quantity.
  • 3x+5=17 3x + 5 = 17 is an equation — it makes a claim that could be true or false.

That distinction matters: you simplify or evaluate expressions, but you solve equations.

Inside an expression, the pieces separated by ++ and - signs are called terms. In

7x24x+9, 7x^2 - 4x + 9,

there are three terms: 7x2 7x^2, 4x-4x, and 9 9 (the sign travels with the term).

  • The coefficient is the numerical multiplier of a term. In 7x2 7x^2 the coefficient is 7 7; in 4x-4x it is 4-4.
  • A constant is a term with no variable — here, 9 9. Its value never changes.
  • The variable part of a term is what is left after the coefficient: x2x^2 and xx above.

A subtle point: a term like xx has coefficient 1 1 (it is really 1x 1x), and x-x has coefficient 1-1. Forgetting this invisible 1 1 is one of the most common beginner errors.

Worked Example: Dissecting an Expression

Take the expression

5a3a+23b+8. 5a^3 - a + \tfrac{2}{3}b + 8.

TermCoefficientVariable partType
5a3 5a^35 5a3a^3variable term
a-a1-1aavariable term
23b\tfrac{2}{3}b23\tfrac{2}{3}bbvariable term
8 88 8constant

Note that a-a has coefficient 1-1, not 0 0, and that a coefficient can be a fraction. There are four terms in two different variables, aa and bb.

The Distributive Property

The distributive property connects multiplication and addition. It states:

a(b+c)=ab+ac.a(b + c) = ab + ac.

In words: multiplying a sum by a number is the same as multiplying each piece and adding. This is not a convention we chose — it is forced by what multiplication means (repeated addition / area). Picture a rectangle of height aa and width b+cb + c: its area is a(b+c)a(b+c), but you can also split it into two rectangles of areas abab and acac. Same rectangle, two descriptions.

The property runs both ways. Read left to right you expand; read right to left you factor.

Worked Example: Expanding

Simplify 4(2x+3) 4(2x + 3).

4(2x+3)=42x+43=8x+12. 4(2x + 3) = 4 \cdot 2x + 4 \cdot 3 = 8x + 12.

Worked Example: A Negative Multiplier

Simplify 3(x5)-3(x - 5). The multiplier is 3-3, and it distributes to both terms, keeping careful track of signs:

3(x5)=(3)(x)+(3)(5)=3x+15.-3(x - 5) = (-3)(x) + (-3)(-5) = -3x + 15.

The second sign flip — (3)(5)=+15(-3)(-5) = +15 — is where students most often slip. The safest habit is to treat subtraction as "plus a negative": x5x - 5 is x+(5)x + (-5), then distribute.

Worked Example: Factoring (the reverse)

Rewrite 6y+15 6y + 15 as a product. Both terms share a factor of 3 3:

6y+15=3(2y+5). 6y + 15 = 3(2y + 5).

Check by expanding: 32y+35=6y+15 3 \cdot 2y + 3 \cdot 5 = 6y + 15. ✓

Combining Like Terms

Like terms are terms with exactly the same variable part — the same letters raised to the same powers. Only like terms can be added or subtracted, and doing so just means adding their coefficients. Think of it as counting: 3x+5x 3x + 5x is "3 of something plus 5 of the same something," giving 8x 8x, exactly as 3 apples plus 5 apples is 8 apples.

Crucially, xx and x2x^2 are not like terms — xx and x2x^2 represent different quantities (a length versus an area, loosely), so 3x+2x2 3x + 2x^2 cannot be collapsed into a single term. Likewise 3x 3x and 3y 3y are unlike.

Worked Example: Full Simplification

Simplify 2(3x+4)5x+7 2(3x + 4) - 5x + 7.

Step 1 — distribute: 2(3x+4)5x+7=6x+85x+7. 2(3x + 4) - 5x + 7 = 6x + 8 - 5x + 7.

Step 2 — group like terms (variable terms together, constants together): (6x5x)+(8+7).(6x - 5x) + (8 + 7).

Step 3 — combine: x+15.x + 15.

So 2(3x+4)5x+7=x+15 2(3x + 4) - 5x + 7 = x + 15. Notice 6x5x=1x=x 6x - 5x = 1x = x; the coefficient became 1 1.

Worked Example: Two Variables and Powers

Simplify 4a2+3aa2+2a6+b 4a^2 + 3a - a^2 + 2a - 6 + b.

Group by identical variable parts:

  • a2a^2 terms: 4a2a2=3a2 4a^2 - a^2 = 3a^2
  • aa terms: 3a+2a=5a 3a + 2a = 5a
  • bb terms: bb (nothing to combine)
  • constants: 6-6

Result: 3a2+5a+b6 3a^2 + 5a + b - 6. The a2a^2, aa, and bb terms stay separate because their variable parts differ.

Order of Operations (PEMDAS) and Evaluating

When you finally replace variables with numbers, the expression must give one unambiguous value. That requires an agreed order of operations, remembered by PEMDAS:

  1. Parentheses (and other grouping symbols) — innermost first
  2. Exponents (and roots)
  3. Multiplication and Division — left to right, as a single tier
  4. Addition and Subtraction — left to right, as a single tier

The two big traps: multiplication and division share a rank (you go left to right, not "all multiplication first"), and the same is true for addition and subtraction. "MD" and "AS" are pairs, not four separate steps.

Worked Example: Pure Arithmetic

Evaluate 6+2×(3+4)2÷7 6 + 2 \times (3 + 4)^2 \div 7.

=6+2×(7)2÷7(parentheses)=6+2×49÷7(exponent)=6+98÷7(multiply, left to right)=6+14(divide)=20.(add)\begin{aligned} &= 6 + 2 \times (7)^2 \div 7 &&\text{(parentheses)}\\ &= 6 + 2 \times 49 \div 7 &&\text{(exponent)}\\ &= 6 + 98 \div 7 &&\text{(multiply, left to right)}\\ &= 6 + 14 &&\text{(divide)}\\ &= 20. &&\text{(add)} \end{aligned}

Worked Example: Evaluating an Expression by Substitution

Evaluate 2x23x+1 2x^2 - 3x + 1 when x=4x = -4.

Substitute, using parentheses around the 4-4 to protect the sign:

2(4)23(4)+1=2(16)3(4)+1(exponent first: (4)2=16)=32+12+1=45.\begin{aligned} 2(-4)^2 - 3(-4) + 1 &= 2(16) - 3(-4) + 1 &&\text{(exponent first: } (-4)^2 = 16)\\ &= 32 + 12 + 1 \\ &= 45. \end{aligned}

The exponent applies only to the number in parentheses, so (4)2=16(-4)^2 = 16, not 16-16. Writing 42-4^2 without parentheses would mean (42)=16-(4^2) = -16 — a completely different value, and a classic exam trap.

Real-World Applications

  • Physics and engineering. The distance a dropped object falls is d=12gt2d = \tfrac{1}{2}gt^2. Here gg is a parameter (about 9.8 m/s2 9.8\ \text{m/s}^2) and tt is a variable; one expression covers every falling object at every instant.
  • Personal finance. A phone plan costing $20 plus $0.10 per gigabyte is the expression c=20+0.10gc = 20 + 0.10g. Evaluate at g=30g = 30 to get $23. The variable lets one formula price every possible month.
  • Computer programming. Variables are the core of code. A line like total = price * quantity + shipping is an algebraic expression the machine evaluates using exactly the order-of-operations rules you just learned.
  • Medicine. Drug dosing often scales with body mass: dose=km\text{dose} = k \cdot m, where kk is the per-kilogram rate and mm the patient's mass. One expression, safely applied to every patient.
  • Everyday estimation. A recipe for 4 4 that you want to make for nn people scales each ingredient by n4\tfrac{n}{4} — a variable expression you evaluate on the fly.

Common Mistakes

1. Dropping the invisible coefficient of 1 1. Misconception: in xxx - x, the terms somehow leave xx behind. Why it's wrong: xx means 1x 1x, so xx=1x1x=0x - x = 1x - 1x = 0. Correction: always read a lone variable as having coefficient 1 1 (and x-x as 1-1).

2. Distributing to only the first term. Misconception: 2(x+5)=2x+5-2(x + 5) = -2x + 5. Why it's wrong: the 2-2 multiplies every term inside, including the 5 5. Correction: 2(x+5)=2x10-2(x + 5) = -2x - 10. Draw arrows from the multiplier to each term as a check.

3. Mishandling exponents on negatives. Misconception: 32=9-3^2 = 9. Why it's wrong: without parentheses the exponent binds tighter than the negative sign, so 32=(32)=9-3^2 = -(3^2) = -9. Correction: use (3)2=9(-3)^2 = 9 only when the negative is genuinely inside the base — and always add parentheses when you substitute a negative value.

4. Treating M/D or A/S as strictly "M before D." Misconception: 8÷2×4=8÷8=1 8 \div 2 \times 4 = 8 \div 8 = 1. Why it's wrong: multiplication and division share one rank and are done left to right. Correction: 8÷2×4=4×4=16 8 \div 2 \times 4 = 4 \times 4 = 16.

5. Combining unlike terms. Misconception: 3x+2x2=5x2 3x + 2x^2 = 5x^2 or 5x3 5x^3. Why it's wrong: xx and x2x^2 are different quantities and cannot merge. Correction: leave it as 2x2+3x 2x^2 + 3x; only identical variable parts combine.

Comparison and Connections

IdeaWhat it isHas an == sign?What you do with it
ExpressionA combination of numbers, variables, operations, e.g. 3x+5 3x + 5NoSimplify or evaluate
EquationA claim that two expressions are equal, e.g. 3x+5=17 3x + 5 = 17YesSolve for the variable
TermOne additive piece of an expression, e.g. 4x-4xCombine with like terms
CoefficientNumerical multiplier of a term, e.g. the 4-4Add across like terms
ConstantA term with no variable, e.g. 9 9Combine with other constants

The distributive property and combining like terms are inverse-flavoured operations: distributing breaks apart a product into a sum, while factoring reassembles a sum into a product. Both preserve the value of the expression for every input — that is what "simplify" really guarantees. This idea of equivalent-but-tidier expressions is exactly what powers solving linear equations and, later, functions.

Practice Questions

Recall

Identify the terms, coefficients, and constant in 9mm2+4 9m - m^2 + 4.

Answer: Terms are 9m 9m, m2-m^2, and 4 4. Coefficients are 9 9 (on mm) and 1-1 (on m2m^2). The constant is 4 4.

Understanding

Simplify 3(2x1)+4x 3(2x - 1) + 4x.

Answer: Distribute: 6x3+4x 6x - 3 + 4x. Combine like terms: (6x+4x)3=10x3(6x + 4x) - 3 = 10x - 3.

Application

Evaluate a2bc\dfrac{a^2 - b}{c} when a=5a = 5, b=4b = 4, and c=3c = 3.

Answer: The fraction bar groups numerator and denominator. Numerator: 524=254=21 5^2 - 4 = 25 - 4 = 21. Then 21÷3=7 21 \div 3 = 7.

Analysis

A rectangle has width ww and a length that is 3 3 more than twice the width. Write a simplified expression for its perimeter, then evaluate it for w=5w = 5.

Answer: Length =2w+3= 2w + 3. Perimeter =2(width)+2(length)=2w+2(2w+3)=2w+4w+6=6w+6= 2(\text{width}) + 2(\text{length}) = 2w + 2(2w + 3) = 2w + 4w + 6 = 6w + 6. At w=5w = 5: 6(5)+6=36 6(5) + 6 = 36. (Check directly: width 5 5, length 13 13, perimeter 2(5)+2(13)=10+26=36 2(5) + 2(13) = 10 + 26 = 36. ✓)

FAQ

Q: What's the actual difference between an expression and an equation? An expression (like 2x+1 2x + 1) names a quantity and has no equals sign — you can simplify or evaluate it but there's nothing to "solve." An equation (like 2x+1=9 2x + 1 = 9) asserts two things are equal, which you can solve to find the variable's value.

Q: Why does a letter with nothing in front of it have coefficient 1? Because multiplying by 1 1 changes nothing, mathematicians simply don't write it: xx and 1x 1x are the same. Making the 1 1 visible (1x 1x) is helpful when you're learning to combine like terms so you don't accidentally drop the term.

Q: Is 52-5^2 equal to 25 25 or 25-25? It's 25-25. The exponent applies only to the 5 5, giving 25 25, and the leading minus then negates it. You need parentheses, (5)2(-5)^2, to get +25+25.

Q: Does it matter whether I do multiplication or division first? No — they share the same priority. You work left to right through whichever comes first. Same for addition and subtraction. That left-to-right rule removes any ambiguity.

Q: Can a variable stand for more than one number at the same time? Within a single evaluation, a variable holds one value. But across a formula it's meant to represent any value from some allowed set — that generality is the whole point. In an equation, solving means finding the specific value(s) that make the statement true.

Q: Why can't I combine 3x 3x and 3y 3y into 6xy 6xy or 6 6? Because xx and yy can be different numbers, so "3 3 of the xx's" and "3 3 of the yy's" are counts of different things. Only terms with identical variable parts combine. 3x+3y 3x + 3y is already fully simplified.

Quick Revision

  • Variable: a symbol for a number that can vary or is unknown; constant: a fixed number.
  • Term: an additive piece; coefficient: its numerical multiplier; a lone variable has coefficient 1 1.
  • Expression has no == (simplify/evaluate); equation has == (solve).
  • Distributive property: a(b+c)=ab+aca(b + c) = ab + ac — distribute to every term, signs included.
  • Like terms share the identical variable part; combine by adding coefficients. xx and x2x^2 are unlike.
  • PEMDAS: Parentheses, Exponents, Multiply/Divide (left to right), Add/Subtract (left to right).
  • Watch: 32=9-3^2 = -9 but (3)2=9(-3)^2 = 9; always parenthesize substituted negatives.

Prerequisites

Next Topics