Functions, Domain and Composition
Read f(x) notation, find the domain and range of a function, and chain two functions together with composition, working from the inside out.
Welcome back!
Step 1 of 13Learn
A machine with one rule
A vending machine is a good picture of a function. You press B4 and you get the same snack every time. If pressing B4 sometimes gave you chips and sometimes gave you a cookie, you would call the machine broken.
A function works the same way: every input produces exactly one output. The input is usually called x and the output y or f(x). Many inputs may share an output (two buttons can both give water), but one input can never give two different outputs.
On a graph this becomes the vertical line test. If any vertical line crosses the graph more than once, some x value has two y values, so the graph is not a function. A parabola opening upward passes the test. A circle fails it, because a vertical line through the middle hits the top and the bottom.
In a table, look for a repeated input with different outputs. The pairs (2, 5) and (2, 7) together break the rule, while (2, 5) and (3, 5) are fine.
Step 2 of 13Practice · Choose one
Which of these relations is not a function?
Step 3 of 13Practice · Diagram
A function as a machine
Which part of the machine breaks if the input 5 can give either 2 or 8?
Tap the shape that answers the question, then press Check.
- Input x
An element of the domain.
- Rule f
The same rule every time, like a vending machine button.
- Exactly one output f(x)
Two different inputs may share an output, but one input can never give two outputs.
Step 4 of 13Learn
Reading f(x) notation
The notation f(x) is read "f of x." It names the function (f) and the input (x). It does not mean f times x.
To evaluate, replace every x with the input, using parentheses. For f(x) = 2x² − 3x + 1:
- f(3) = 2(3)² − 3(3) + 1 = 18 − 9 + 1 = 10
- f(−1) = 2(−1)² − 3(−1) + 1 = 2 + 3 + 1 = 6
- f(a + 1) = 2(a + 1)² − 3(a + 1) + 1 = 2a² + 4a + 2 − 3a − 3 + 1 = 2a² + a
The parentheses matter most with negatives. Writing −1² instead of (−1)² gives −1 instead of 1, and that single slip is the most common error on function questions.
The notation also works backward. "Solve f(x) = 6" means find the inputs that produce 6. That is a different question from "find f(6)," which asks for an output.
Step 5 of 13Practice · Work it out
For f(x) = 2x² − 3x + 1, what is f(−2)?
Step 6 of 13Explore
Evaluate f(x) = ax² + bx + c at any input
The defaults give f(x) = 2x² − 3x + 1. Move the input slider t and watch the readout; then change a, b and c to see the curve and the value change together.
- f(t)
- 10
Step 7 of 13Learn
Domain and range
The domain is the set of inputs a function accepts. The range is the set of outputs it actually produces.
For most Algebra 2 functions the domain is all real numbers, except where something breaks. Two things break:
- Division by zero. For f(x) = 1/(x − 4), the input 4 makes the denominator 0, so the domain is all real numbers except 4.
- Even roots of negative numbers. For g(x) = √(x + 3), the expression under the root must be at least 0, so x + 3 ≥ 0 and the domain is x ≥ −3.
The range takes more thought. For g(x) = √(x + 3), the smallest output is √0 = 0 and outputs grow without limit, so the range is y ≥ 0. For h(x) = x² + 5, squares are never negative, so outputs start at 5: the range is y ≥ 5.
In interval notation, x ≥ −3 is written [−3, ∞). A square bracket includes the endpoint; a parenthesis excludes it. Infinity always gets a parenthesis because it is not a number you can reach.
Step 8 of 13Practice · Match the pairs
Match each function with its domain.
Tap an answer, then tap the place where it belongs (or drag it there).
- f(x) = √(x − 2)
- f(x) = 1/(x + 2)
- f(x) = x² − 2
- f(x) = √(2 − x)
Step 9 of 13Learn
Composition: one function feeding another
A composition sends the output of one function straight into another. The notation f(g(x)), also written (f ∘ g)(x), means "do g first, then apply f to the result."
Take f(x) = x + 3 and g(x) = x².
- f(g(2)): first g(2) = 4, then f(4) = 7.
- g(f(2)): first f(2) = 5, then g(5) = 25.
The order changed the answer. Composition is usually not commutative.
You can also compose with expressions. f(g(x)) = f(x²) = x² + 3, while g(f(x)) = g(x + 3) = (x + 3)² = x² + 6x + 9.
Compositions model chains of steps in real life. A store takes 20% off with d(p) = 0.8p, then adds 8% tax with t(p) = 1.08p. The price you pay for a $50 item is t(d(50)) = 1.08 × 40 = $43.20.
Step 10 of 13Diagram
f(g(2)) with f(x) = x + 3 and g(x) = x²
Read a composition from the inside out: the output of g becomes the input of f.
Tap a shape with to see more.
- Start: 2
- g squares it
g(2) = 2² = 4. The inside function acts first.
- 4
- f adds 3
f(4) = 4 + 3.
- Result: 7
Step 11 of 13Note
Step 12 of 13Practice · Work it out
Let f(x) = 3x − 1 and g(x) = x² + 2. What is g(f(1))?
Step 13 of 13Practice · True or false
For any two functions, f(g(x)) is always equal to g(f(x)).
Lesson complete!