Algebra 1 · Unit 1 · Topic 1.2
Variables and Evaluating Expressions
Use variables to describe changing quantities, evaluate expressions by substitution and order of operations, and connect input-output values to a graph.
A letter keeps a calculation reusable
Suppose a bike rental costs a fixed \(7\) dollars plus \(4\) dollars for each hour. Writing a separate calculation for every possible duration would be tedious. Let \(h\) represent the number of hours, and write the cost as
\[ C=7+4h. \]
Here \(h\) is a variable: its value can change from one rental to another. The \(7\) is a constant, and \(4\) is the coefficient multiplying \(h\). The right-hand side, \(7+4h\), is an expression; it describes a quantity without claiming that two quantities are equal. The full statement \(C=7+4h\) is an equation relating cost \(C\) to time \(h\). This distinction matters when a question asks you to evaluate an expression rather than solve an equation.
In this example, \(h\ge0\) because a rental cannot last a negative number of hours. If the business bills only whole hours, \(h\) must also be a whole number; if it bills partial hours, values such as \(1.5\) are possible. A variable does not automatically mean “any real number”—the situation can restrict its allowed values.
To evaluate \(7+4h\) at \(h=2.5\), replace every occurrence of \(h\) with \(2.5\), then carry out the multiplication before addition:
\[ 7+4(2.5)=7+10=17\text{ dollars}. \]
The expression itself remains \(7+4h\); \(17\) dollars is its value for this particular input. The units provide a check: \(4\) dollars per hour times \(2.5\) hours gives \(10\) dollars, which can be added to the fixed \(7\) dollars.
Substitute first; simplify second
For a purely numerical expression, a variable may be any permitted real number. The operation order is grouping symbols, exponents, multiplication and division from left to right, then addition and subtraction from left to right. Substitution comes before those calculations. Parentheses make a negative replacement visible as one number.
Return to the existing two-variable example. Evaluate \(2x^2-3y\) for \(x=-4\) and \(y=5\). The symbols \(x\) and \(y\) are independent inputs here; both values must be supplied before there is a single numerical answer.
\[ \begin{aligned} 2x^2-3y &=2(-4)^2-3(5) &&\text{substitute both values}\\ &=2(16)-15 &&\text{square }-4\text{ before multiplying}\\ &=32-15\\ &=17. \end{aligned} \]
Notice the different jobs of the symbols: \(2x^2\) means \(2\cdot(x\cdot x)\), whereas \((2x)^2\) would square the entire product. At \(x=-4\), they would be \(32\) and \(64\), respectively. Parentheses change what the exponent acts on.
The sign is another reason to write the substituted value in parentheses:
\[ (-4)^2=(-4)(-4)=16, \qquad -4^2=-(4^2)=-16. \]
The second expression has no parentheses around \(-4\), so the exponent applies to \(4\) and the minus sign is applied afterward. If you replace \(x\) by \(-4\) in \(x^2\), the correct result is \((-4)^2\), not \(-4^2\).
Several evaluations make a graph
A graph can collect the results of many substitutions. Consider the one-variable expression \(x^2-2\), and call its output \(E\). For this mathematical example, \(x\) may be any real number, and both axes use abstract number units; the plotted values are calculated, not measured data.
| Input \(x\) | Substitution into \(E=x^2-2\) | Output \(E\) | Graph point \((x,E)\) |
|---|---|---|---|
| \(-2\) | \((-2)^2-2=4-2\) | \(2\) | \((-2,2)\) |
| \(-1\) | \((-1)^2-2=1-2\) | \(-1\) | \((-1,-1)\) |
| \(0\) | \(0^2-2\) | \(-2\) | \((0,-2)\) |
| \(1\) | \(1^2-2=1-2\) | \(-1\) | \((1,-1)\) |
| \(2\) | \(2^2-2=4-2\) | \(2\) | \((2,2)\) |
To read the dot at \((-2,2)\), start at input \(x=-2\) on the horizontal axis and move vertically to output \(E=2\). That is exactly the calculation \((-2)^2-2=2\). The dots at \((-2,2)\) and \((2,2)\) share an output because squaring opposite inputs gives the same result. This does not mean that the two inputs are equal. The smooth curve includes inputs between the table values; for example, at \(x=0.5\), \(E=(0.5)^2-2=-1.75\).
Grouping changes the instruction
Compare \(3(a+2)\) with \(3a+2\). The first says “multiply the sum of \(a\) and \(2\) by \(3\)”; the second says “multiply \(a\) by \(3\), then add \(2\).” At \(a=-1\),
\[ 3((-1)+2)=3(1)=3, \qquad 3(-1)+2=-3+2=-1. \]
These expressions are not interchangeable. Testing one value exposes the difference, while the parentheses explain why it occurs. When evaluating a longer expression, keep the original grouping visible during substitution, simplify each grouped part, and only then combine the results.
Further reading
Topic coverage was checked against OpenStax Elementary Algebra 2e, §1.2: Use the Language of Algebra and OpenStax Prealgebra 2e, §2.2: Evaluate, Simplify, and Translate Expressions. The prose, rental scenario, table, calculations, and SVG graph here were independently created; textbook text, exercises, and artwork were not reproduced.