The core idea
A function assigns exactly one output to each allowed input. Its domain records those inputs; its range records the outputs actually produced. In a composition, the output of the inner function must be an allowed input of the outer function.
1. A function includes a rule and allowed inputs
A function is a consistent assignment: each input in its domain has exactly one output. In f(x) = x², f names the function and x is an input placeholder; f(3) means 9, not f multiplied by 3. Different inputs can share an output: f(3) and f(−3) are both 9. That does not violate the definition. One input producing two different outputs would. A relation assigning both 2 and −2 to input 4 is therefore not a function unless a choice is specified. The square-root function makes such a choice: √4 is the nonnegative value 2. A graph passes the vertical-line test if every vertical line meets it at most once. Tables and verbal rules can define functions too; a formula is only one representation.
2. Separate domain, codomain and range
The domain is the set of allowed inputs. A codomain is the declared target set, while the range is the set of outputs actually reached. If f maps real numbers to real numbers by f(x) = x², its domain and codomain are both the real numbers, but its range is [0, ∞). Negative outputs never occur. Restrict the domain to [−2, 3] and the range becomes [0, 9], because zero is attained and the largest square is 9. Square brackets include an endpoint; round brackets exclude one. Infinity is not an endpoint that can be included. Context also restricts inputs: a model for completed pages accepts whole numbers, while a model for cloth length may accept positive fractions. Write these restrictions explicitly instead of allowing the formula to decide everything.
Sources: OpenStax: Domain and Range ↗
3. Preserve restrictions through algebra
Over the real numbers, a denominator cannot be zero and an expression under an even root cannot be negative. Thus 1/(x−2) excludes x = 2, and √(9−x²) requires x² ≤ 9, giving −3 ≤ x ≤ 3. Several requirements must hold together: take their intersection, not their union. Simplification can hide a restriction. The expression (x²−1)/(x−1) equals x+1 only for x ≠ 1. Cancelling x−1 does not create a value at the missing input. Its graph is the line y = x+1 with the point (1, 2) removed. Defining a new value at x = 1 would create an extended function, which is a separate decision. This distinction becomes useful later when studying limits and derivatives.
Sources: OpenStax: Domain and Range ↗ · OpenStax: Composition of Functions ↗
4. Worked case: convert length before calculating cost
An invented workshop charges ₹20 for setup and ₹5 per metre of a printed strip, accepting lengths from 0 to 10 metres. A learner measures a strip as 240 centimetres. Define g(c) = c/100 to convert centimetres to metres and f(m) = 20+5m to calculate rupees. The required composition is f(g(c)) = 20+5(c/100), with 0 ≤ c ≤ 1,000. At c = 240, g(240) = 2.4 and f(2.4) = ₹32. Reversing the order would feed centimetres into a rule expecting metres, then treat rupees as a length. The arithmetic expression g(f(240)) can be written, but it has no valid meaning in this model. Units reveal why the order matters before any calculation. The domain also enforces the workshop’s stated length limit.
Sources: OpenStax: Composition of Functions ↗
5. Worked case: a composition with two restrictions
Let g(x) = √(x+1) and f(u) = 1/(u−2). For f(g(x)) = 1/(√(x+1)−2), first require x ≥ −1 so the inner square root exists. Next require √(x+1) ≠ 2 so the outer denominator is nonzero. The excluded value is x = 3. Hence the domain is [−1, 3) ∪ (3, ∞). At x = −1 the output is −1/2, so the left endpoint is included. At x = 8 the output is 1. At x = 3 the inner output exists, but the second stage fails. This shows why checking only the first function is insufficient. Nor should you simply intersect the original domains: the outer restriction applies to g(x), not directly to x.
Each stage must accept its input
- Start with xFirst require x ≥ −1.
- g(x) = √(x + 1)The intermediate output is nonnegative.
- f(u) = 1/(u − 2)u cannot be 2, so x cannot be 3.
- Domain[−1, 3) ∪ (3, ∞)
Sources: OpenStax: Composition of Functions ↗ · OpenStax: Domain and Range ↗
6. Reversing a function requires unique recovery
An inverse function recovers the original input from an output. For f(x) = 3x+6 on all real numbers, undo addition and multiplication in reverse order: f⁻¹(y) = (y−6)/3. Both compositions return the starting number. The symbol f⁻¹ does not mean 1/f. Squaring on all real numbers has no inverse function because an output such as 9 does not tell you whether the input was 3 or −3. Restrict squaring to x ≥ 0 and the inverse becomes √y, with y ≥ 0. Domain and range exchange roles when an inverse exists. A useful final check is to follow one input through both stages and back, preserving units and allowed values. Reversible algebra must also preserve information.
Sources: OpenStax: Inverse Functions ↗
PUT IT INTO PRACTICE
Practice: compare two orders
- Take f(x) = 2x+3 and g(x) = x², both on the real numbers. Calculate f(g(2)) and g(f(2)) separately, showing the intermediate output.
- Write formulas for f(g(x)) and g(f(x)). Expand only after placing the whole inner expression inside the outer rule.
- Restrict the original input x to [−1, 2]. Find the range of each composition; check whether an interior input produces an extreme value.
- Solution: the orders give 11 and 49. Their formulas are 2x²+3 and (2x+3)². On [−1, 2], the first ranges from 3 to 11, with its minimum at x = 0. The second ranges from 1 to 49 because 2x+3 increases from 1 to 7. Endpoint checks alone would miss the first minimum.
Check your understanding
Can two inputs have one output?
Yes. The function condition concerns one output per input, not one input per output. Squaring provides a counterexample to the stronger claim.
Why is √(9−x²) not defined for x = 4 here?
Its radicand becomes −7, which has no real square root. The lesson works over real numbers; a different number system changes the discussion.
Does cancelling a factor fill a hole?
No. Cancellation assumes that factor is nonzero. The original expression still excludes the input making its denominator zero.
Why check the intermediate output?
The inner calculation may be legal while its result is forbidden for the outer function. Composition must pass both stages.
Is f⁻¹(x) the reciprocal of f(x)?
No. It denotes an inverse function that undoes f. A reciprocal divides 1 by the output and generally performs a different operation.
Can formulas alone establish a real application?
No. Units, input restrictions and the meanings of outputs must agree. A syntactically possible composition can still be meaningless in its stated context.
