What Is a Variable in Algebra?
A plain explanation of variables as letters that stand for numbers, the jobs they do, and the mistakes that trip up beginners.
Key takeaways
- A variable is a letter or other symbol that stands for a number, and it follows the ordinary rules of arithmetic.
- Variables can name an unknown value, describe a general pattern, or track a quantity that changes.
- Within one problem, the same letter means the same number every time it appears.
- A variable stands for a number or a measured amount, never for an object or a unit label.
- Different letters are allowed to have equal values unless the problem says otherwise.
A variable is a symbol, usually a letter, that stands for a number. Sometimes the number is one you have not found yet, sometimes it can be any number from a certain collection, and sometimes it is a quantity that changes. In every case the letter holds a place where a number belongs, and it obeys the same rules numbers obey.
That one idea lets you write a single line that covers thousands of calculations. Instead of listing the cost of 1 ticket, 2 tickets and 3 tickets at 8 dollars each, you write 8n and let n be the number of tickets.
A letter that holds a number's place
Look at the expression n + 5. By itself it has no single value. Once you choose a number for n, it does.
If n = 2, then n + 5 is 7. If n = 40, it is 45. If n = -9, it is -4. The letter is a slot, and the expression tells you what to do with whatever goes in the slot.
An expression is a combination of numbers, variables and operations, such as 3x - 1 or a² + b. It makes no claim that anything is true. It simply describes a calculation waiting to happen.
Algebra writing has a few habits that go with variables. A number written next to a letter means multiplication, so 3x is 3 times x. Two letters side by side, as in ab, mean a times b. A fraction bar means division, so y/4 is y divided by 4. A lone x means 1x.
The jobs a variable can do
The same kind of symbol serves different purposes, and knowing which one you are looking at tells you what to do next.
- An unknown. In 2x + 3 = 11, the letter x names a particular number that makes the statement true. Your task is to find it, and here x = 4.
- A general number. In a + b = b + a, the letters stand for any two numbers. Nothing needs solving, because the statement is always true.
- A varying quantity. In d = 60t, the distance d changes as the time t changes, for a vehicle holding a steady 60 miles per hour.
- A parameter. In y = mx + b, the letters m and b are fixed for any one line but differ from line to line.
These roles are not stamped on the letters. Context decides. The article on unknowns, parameters and placeholders shows several of them working side by side.
Variables compared with constants
A constant is a value that does not change within the problem. Numbers like 7, -2 and 1/3 are constants. So are named numbers such as π, which looks like a letter but always means the same value, approximately 3.14159.
In the expression 5x + 12, the 12 is a constant term and x is the variable. The 5 multiplying the variable is called a coefficient, a word explored further in terms, factors and coefficients.
Some letters are constants only by agreement. A problem might say "a gym charges a joining fee of f dollars plus 30 dollars a month." For one particular gym, f never changes. Across many gyms, it does.
Which numbers is the letter allowed to be?
Every variable comes with a set of permitted values, even when nobody writes it down. If n counts students, it must be a whole number that is zero or larger. Half a student makes no sense. If t measures temperature in degrees Celsius, negative and fractional values are fine, within physical limits.
The mathematics can restrict a variable too. In the expression 1/(x - 3), the value x = 3 is excluded, because it would require dividing by zero. In √x, when you are working with real numbers, x must be at least 0.
In a typical school algebra course, a variable with no stated restriction is assumed to be any real number for which the expression makes sense. The different number collections are laid out in the guide to real, rational, integer and whole numbers.
Rules that keep letters honest
Because variables stand for numbers, everything true for all numbers is true for them. You can reorder a sum, regroup a product and distribute multiplication over addition. For instance, 4(x + 2) = 4x + 8 for every value of x, which is the distributive property at work.
Two further agreements matter.
First, a letter keeps one value throughout a single problem. In x + x = 10, both copies of x are the same number, so x = 5. You cannot let one be 3 and the other 7.
Second, different letters may be equal. In x + y = 10, the pair x = 5 and y = 5 is a perfectly good solution. The letters give you permission to choose different values without requiring it.
The choice of letter carries no mathematical weight. The equations x + 4 = 9 and w + 4 = 9 ask the same question and have the same answer, 5.
A worked example from words to symbols
Say you are buying notebooks that cost 3 dollars each and one backpack that costs 25 dollars.
Let n = the number of notebooks (name the quantity)
Cost of notebooks = 3n dollars (price times count)
Total cost = 3n + 25 dollars (add the backpack) Now the expression answers a family of questions. For 4 notebooks, 3 × 4 + 25 = 37 dollars. For 10 notebooks, 3 × 10 + 25 = 55 dollars.
You can also run it backward. If you spent exactly 46 dollars, then 3n + 25 = 46. Subtract 25 to get 3n = 21, then divide by 3 to get n = 7. Checking, 3 × 7 + 25 = 46.
Notice how the role of n shifted. In the expression it could be any count of notebooks. In the equation it became an unknown with one correct value.
Mistakes beginners often make
Treating the letter as a thing. If n is "the number of notebooks," then 3n does not mean "3 notebooks." It means 3 dollars times however many notebooks there are. Writing a full phrase, including "the number of," prevents most of this confusion. The habit is covered in defining variables well.
Confusing variables with units. In "5 m," the m may mean meters. In "5m," an algebra problem may mean 5 times a number called m. Context and careful definitions settle it.
Gluing digits to letters. If x = 4, then 3x is 12, not 34. Side-by-side writing signals multiplication.
Believing a letter's place in the alphabet matters. The variable b is not automatically one more than a.
Assuming a variable is positive. The expression -x is the opposite of x. If x = -6, then -x = 6, which is positive.
Watching a variable vary
A table is a quick way to see what an expression does as its letter changes. Here is 2n + 5 for several values of n.
| n | 2n | 2n + 5 |
|---|---|---|
| 0 | 0 | 5 |
| 1 | 2 | 7 |
| 2 | 4 | 9 |
| 3 | 6 | 11 |
| 10 | 20 | 25 |
Reading down the right column, the result rises by 2 each time n rises by 1. The 2 in 2n controls the size of that step, and the 5 sets where the pattern starts when n = 0. You can now predict a value you have not listed: at n = 50, the expression gives 105.
Tables also expose false guesses. Suppose someone claims that 2n + 5 is the same as 7n. At n = 1 both give 7, which looks promising. At n = 2 they give 9 and 14. A single mismatch shows the claim is false in general, which is why one successful test never proves two expressions equal.
You can graph the same pairs as points, with n on the horizontal axis. If n only counts objects, the graph is a row of separate dots. If n can be any real number, the dots fill in to form a straight line.
Using letters to state a pattern
Some of the most useful work a variable does is to capture something you notice in arithmetic. Look at these sums of three consecutive whole numbers: 1 + 2 + 3 = 6, 4 + 5 + 6 = 15, and 10 + 11 + 12 = 33. Each total is three times the middle number.
Three examples suggest the pattern, but there are endlessly many cases. Let m be the middle number. Then the numbers are m - 1, m and m + 1.
(m - 1) + m + (m + 1)
= m + m + m - 1 + 1 (reorder the terms)
= 3m (-1 + 1 = 0) Because m could be any whole number, this short calculation covers every case at once. It even works for negative integers and fractions spaced one apart, since nothing in the steps depended on the kind of number.
That is a large part of why algebra exists. Arithmetic can check examples one at a time, while a variable lets you reason about all of them together.
Where variables lead next
Once a letter can stand for a number, you can evaluate expressions by substitution, tidy them by combining matching terms, and solve equations by undoing operations one at a time.
Later, variables stretch further. In functions, one variable depends on another. In linear algebra, a single letter can stand for a whole list or table of numbers. In abstract algebra, letters may stand for objects that are not numbers at all, such as rotations of a square, and you must check which rules still hold.
For now, a good test of understanding is to read an expression such as 2p - 7 aloud as a recipe: take some number, double it, then subtract seven. If you can do that, and then carry out the recipe for any value you are handed, the letter is doing its job and so are you.