Sub topic 2
Variables: Letters That Stand for Numbers
This chapter assumes you can work with integers and fractions, follow the order of operations, and understand simple exponents such as \(3^2\). You will use those skills to read and evaluate algebraic expressions.
What is a variable?
A variable is a letter or symbol that represents a number. The number can be unknown, or it can change depending on the situation. Common variable names include \(x\), \(y\), \(n\), and \(t\).
For example:
\[ x + 4 \]
The letter \(x\) is a variable. The expression means “a number plus four.” Until someone gives \(x\) a value, the expression does not have one fixed numerical result.
A variable does not always mean that the value is completely unknown. In a particular problem, you might be told that \(x=7\). You can then replace \(x\) with 7 and calculate the result.
Reading variables in expressions
Multiplication signs are often omitted in algebra. These forms all mean multiplication:
- \(3x\) means \(3 \times x\).
- \(xy\) means \(x \times y\).
- \(4(a+2)\) means \(4 \times (a+2)\).
When a number is written directly next to a variable, the number is called the coefficient. The coefficient tells you how many copies of the variable are being added.
For example:
\[ 5x=x+x+x+x+x \]
The coefficient of \(x\) is 5. If no number is shown, the coefficient is 1:
\[ x=1x \]
A negative sign changes the coefficient. In \(-3y\), the coefficient is \(-3\), not 3.
A number without a variable is a constant. In \(2x+9\), 9 is a constant because its value does not depend on \(x\).
| Expression | Variable | Coefficient | Constant |
|---|---|---|---|
| \(7p-4\) | \(p\) | \(7\) | \(-4\) |
| \(-q+6\) | \(q\) | \(-1\) | \(6\) |
Assigning values to variables
To evaluate an expression means to find its numerical value after assigning values to its variables. Substitute the assigned value wherever the variable appears, then use the order of operations.
Suppose \(x=3\). Evaluate:
\[ 2x^2-5 \]
Substitute 3 for \(x\):
\[ 2(3)^2-5 \]
Evaluate the exponent first:
\[ 2(9)-5=18-5=13 \]
Therefore, \(2x^2-5=13\) when \(x=3\).
If the value is negative, use parentheses during substitution. For \(y=-2\):
\[ y^2=(-2)^2=4 \]
The parentheses matter. Without them, the notation \(-2^2\) is normally interpreted as \(-(2^2)=-4\).
x = 3
result = 2 * x**2 - 5
print(result) # 13
y = -2
print(y**2) # 4Variables in formulas
Variables can represent measurable quantities. For a rectangle, the area formula is:
\[ A=lw \]
Here, \(A\) represents area, \(l\) represents length, and \(w\) represents width. If \(l=8\) meters and \(w=3\) meters, then:
\[ A=8 \times 3=24 \]
The area is 24 square meters.
A variable's meaning depends on the context. The letter \(t\) might represent time in one formula and temperature in another. Always identify what a variable represents before interpreting an expression.
Exercise
Evaluate 3n - 2 when n = -4.
Show answer
Substitute -4 for n: 3(-4) - 2 = -12 - 2 = -14.