On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

Math · Algebra Fundamentals · Grade 6-8

Variables

A variable is a letter standing in for an unknown or changing number, like the x in x+5=12.

x+3=7  ⟹  x=4

Quick Answer

A variable is a letter standing in for an unknown or changing number, like the x in x+5=12. Use one when you know how a quantity behaves but not yet its value, or when the value changes from case to case. Naming the quantity lets you write the relationship down first: "the cost is 3n dollars for n tickets" works for 2 tickets or 200. In one problem a letter may have to be one particular number; in another it can take many values.

Why This Matters

With a variable you can write one rule that covers every case: a phone plan charging $15 a month plus $2 per gigabyte costs 15+2g dollars, whatever g is. Without one you are stuck testing numbers one at a time, and you can never be sure a lucky guess is the only answer. Equations, formulas and functions are all sentences written with variables.

Intuitive Explanation

Picture a sealed envelope with x written on it. Someone slips in a $5 bill, and now the envelope holds $12 in all. You can't see inside, but it must have started with $7. Writing x+5=12 is the same picture in symbols: x is the envelope. The letter is not the answer. It is a name for the place where the answer goes.

A variable can also stand for a number that changes. If a taxi charges $3 per mile, the fare for m miles is 3m dollars. Here m has no single correct value: put in 2 and the fare is $6, put in 10 and it is $30. One short rule describes every trip.

Not every letter in math is a variable. In the circle formula A=πr2, the letters A and r are variables, but π is a constant: it is always about 3.14159. Units are another look-alike: in "5 m" the m means metres, not a number. To tell them apart, ask whether different numbers could sit in that spot. If the letter is fixed or names a unit, it is not a variable.

Each problem sets its own variables. The x that equals 7 in one problem can equal −2 in the next, and two different letters, such as x and y, are allowed to have the same value.

Think of it like this. A variable is a labelled jar on a shelf. You can say "the red jar holds 3 more marbles than the blue jar" without knowing either amount, and the sentence stays true whatever is inside. Unlike a jar, though, a variable in an equation is often forced to hold one particular number.

Core idea. A variable is a symbol that holds a number you don't know yet or one that can change.


When to Use

Reach for a variable when a problem mentions an amount you don't know yet ("some number", "how many were there") or an amount that changes ("for any number of tickets", "after t hours"). Pick a letter, say what it stands for and in what units, then write the relationship. If every number in the story is already given, just compute. If a letter names a fixed value like π or a unit like cm, treat it as a constant or a label.

Tip. Ask: Is a letter being used to hold a number we don't know yet or one that can vary?

How to Recognize It

Before you treat a letter as a variable, look at what the letter is doing in the problem: holding a fixed number, labelling a unit, or standing for an amount that is unknown or free to change.

  1. Could the letter take a different value in another version of the same situation?

    If yes, as with n tickets or t hours, it is a variable. If no, because it names one fixed number such as π≈3.14, it is a constant, even though it is written as a letter.

  2. Is the letter a unit written after a number, like the m in 5 m or the g in 20 g?

    If yes, it is a label for metres or grams, not a number-holder, and there is nothing to solve for. If no, check whether the letter stands alone or has a number multiplying it.

  3. Is a number written right in front of the letter, as in 4w?

    If yes, that number is a coefficient: 4w means 4 times w. The coefficient is known; only w is unknown or changing. Keep the two roles apart when you read each term.

  4. Does the problem already give every amount, with nothing missing or changing?

    If yes, you do not need a variable; plain arithmetic gives the answer. If no, pick a letter for the missing or changing amount and write down what it stands for, with its units.

Variables compared with Constant, Coefficient, and Operation symbol

Variables, constants, coefficients and operation signs sit side by side in a line like 3x+5, so they are easy to blur together. Ask of each symbol whether it can change, is one fixed number, multiplies a letter, or commands an action.

Variables

Meaning
Use this when a quantity is unknown or changing and you want to name it before computing.
Key test
Is a letter being used to hold a number we don't know yet or one that can vary?
Formula
x+3=7  ⟹  x=4
Example
A bag has some marbles; after adding 5 there are 12. Write a variable equation and find how many were in the bag.

Constant

Meaning
A fixed number that never changes, like 3 or π.
Key test
Use when the value is known and stays put, not something to solve for.
Example
The 5 in x+5

Coefficient

Meaning
A number multiplying a variable, attached to it.
Key test
Use when you mean the number stuck to the letter, not the letter itself.
Example
The 2 in 2x

Operation symbol

Meaning
A sign like + or × that tells you what to do.
Key test
Use when the symbol commands an action rather than holding a value.
Example
The + in x+5

Formula & Notation

x+3=7  ⟹  x=4
A variable x ranges over a domain D; in the equation x+5=12, we seek x∈D such that the open sentence x+5=12 is satisfied, i.e., {x∈R∣x+5=12}={7}.

How to read it: Variables are typically lowercase letters: x, y, z for unknowns; a, b, c for parameters; n, k for integers.

Worked Examples

Example 1 — Find the unknown

Easy

A bag has some marbles; after adding 5 there are 12. Write a variable equation and find how many were in the bag.
Show the steps and the answer
  1. Let x be the number of marbles in the bag at the start.

    The starting amount is the one number the story doesn't give, so it gets the letter.

  2. Translate the story: start with x, add 5, end with 12, so x+5=12.

    "Adding 5" becomes +5 and "there are 12" becomes =12; the equation says exactly what the sentence says.

  3. Undo the adding: x=12−5=7.

    Taking 5 from each side keeps the two sides equal and leaves x by itself.

  4. Put 7 back into the story: 7+5=12.

    The total comes out right, so the bag held 7 marbles.

Answer: x=7

Takeaway: Give the unknown starting amount a letter, write the story as an equation, then undo what was done to it.

Example 2 — All-known arithmetic

Standard

There are 7 marbles in a bag and you add 5 more; how many now?
Show the steps and the answer
  1. List what the story gives: 7 marbles to start and 5 added.

    Both numbers that feed the calculation are known; only the result is asked for.

  2. Compute 7+5=12.

    When nothing before the answer is hidden, the operations can simply be carried out in order.

  3. Compare with the bag problem, where the start was hidden and the total of 12 was given.

    You could write n=7+5, but the letter adds nothing here. A variable pays off when the unknown sits inside the relationship, as the starting amount did.

Answer: 12

Takeaway: If you can reach the answer by doing the operations in order, compute it; use a variable when the unknown is tangled inside the relationship.

Example 3 — Find the mistake: different letters, same value

Application

Pens cost p dollars each and notebooks cost n dollars each. Two pens and three notebooks cost $10 in total, and a pen costs $2. Lee writes: "Since p=2 and n is a different letter, n cannot be 2." Find the mistake and find n.
Show the steps and the answer
  1. Write the total as an equation and put in p=2: 2(2)+3n=10, so 4+3n=10.

    Two pens at $2 cost $4, and the rest of the $10 must pay for the notebooks.

  2. Solve: 3n=10−4=6, so n=6÷3=2.

    Subtracting 4 and then dividing by 3 isolates n.

  3. Compare with Lee's rule: it would throw out n=2, the actual answer.

    Different letters name different things (pens, notebooks), not necessarily different numbers.

  4. Check the prices: 2(2)+3(2)=4+6=10.

    The total matches $10, so a notebook really does cost the same as a pen.

Answer: n=2: a notebook costs $2, the same as a pen.

Takeaway: Two letters only promise two quantities; the equations decide whether their values happen to match.

Where You'll See It

  • Phone plan bill

    A plan charges $15 a month plus $2 per gigabyte. Calling the gigabytes g, the bill is 15+2g dollars. One formula covers every month: 4 GB costs $23 and 10 GB costs $35.

  • Spreadsheet cells

    A tax cell in a spreadsheet might hold the formula "0.08 times cell B2". B2 acts as a variable: change the price in it from $50 to $80 and the tax updates from $4 to $6.40 without retyping anything.

  • Scaling a pancake recipe

    A recipe uses 2 eggs for every 8 pancakes, so p pancakes need p4 eggs. For 24 pancakes that is 6 eggs. The letter p lets the cook plan for any number of guests with one rule.

Common Mistakes

  1. The slip: Treating x as always meaning the same number across different problems

    Instead: a variable's value is set by its own equation, not fixed forever.

  2. The slip: Reading the letter as the answer instead of a placeholder

    Instead: the variable names the unknown; solving reveals the number.

  3. The slip: Thinking different letters must mean different numbers

    Instead: x and y can happen to equal the same value.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. A number n plus 9 equals 15. Write an equation and find n.

    Hint: What number added to 9 gives 15?

  2. Movie tickets cost $4 each. Write an expression for the cost of t tickets, then find the cost of 7 tickets.

    Hint: Each ticket adds another $4 to the cost.

  3. A rectangle is L cm long and 5 cm wide. Its perimeter is 26 cm. Write an equation and find L.

    Hint: The perimeter adds two lengths and two widths.

  4. Find values of x and y that make both x+y=10 and x=y true.

    Hint: If the two numbers are equal, each one is half of the total.

  5. A bike rental costs C=3h+20 dollars: $3 per hour plus a $20 deposit. Which symbols are variables, which number is the coefficient, and which number is the constant?

    Hint: Which quantities change from one rental to the next, and which stay fixed?

  6. In the last problem x was 4. Now, for x+10=12, Jo writes "x=4 again". Correct the mistake.

    Hint: Does a letter keep its value from one problem to the next?

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Why is x the letter everyone uses for the unknown?

The habit goes back to René Descartes, whose 1637 book on geometry used letters from the end of the alphabet, xx, yy and zz, for unknown amounts and letters from the start, aa, bb and cc, for known ones. Other writers copied him and the custom stuck. A popular story says his printer had spare x's, but nobody has proved it. Any letter works: tt for time or cc for cost makes your work easier to read.

What does xy mean when there is no sign between the letters?

Two letters side by side, or a number next to a letter, are multiplied: xyxy means x×yx \times y and 3x3x means 3×x3 \times x. Algebra drops the ×\times partly because it looks like the letter xx. So if x=4x = 4 and y=5y = 5, then xy=20xy = 20, not 45. Digits are the exception: 45 always means forty-five, never 4×54 \times 5, which is why 3⋅43 \cdot 4 needs a dot.

Is a variable always a letter?

No. Any symbol that holds a number can do the job. Early worksheets use a box, as in □+3=7\square + 3 = 7; spreadsheets use cell names like B2; computer programs use whole words such as score or total. Letters became the standard in algebra because they are quick to write and easy to tell apart. What makes something a variable is its job, holding a value, not its shape.

Can a variable be a negative number or a fraction?

Yes, unless the situation rules it out. In x+9=4x + 9 = 4, xx must be −5-5, and in 2x=32x = 3, xx is 32\frac{3}{2}. The letter has no built-in sign. Also, −x-x is not automatically negative: if x=−5x = -5, then −x=5-x = 5. A story can limit the values, though: if nn counts people, it must be a whole number of at least 0.

Learning Path

← Before

EqualNumber Sense
Variables

You are here

You need Equal (both sides name the same amount) and Number Sense (what the operations do) first. Variables add a way to name an amount before you know it, or an amount that changes. Next, Expressions combine variables with operations, as in 3n+2, and Equations set two expressions equal so you can find the value a variable must take.

See Also