Quarry School

Composition of functions: crash course

about 15 min to listen10 lessons16 questions to tryUnit 4 of 17

Short view. Each lesson's rule, its steps and its trap. Switch to Full for a worked example and a question to try in every lesson.Full view. Each lesson's rule, its steps, one worked example with Watch it solved, the trap, and one question to try.

1 Combine two functions with arithmetic

Open the full lessonOnly this lesson

The rule

(f+g)(x)=f(x)+g(x); (f−g)(x)=f(x)−g(x); (fg)(x)=f(x)·g(x); (fg)(x)=f(x)g(x).

Use inputs allowed by both functions; for the quotient also require g(x)≠0.

How

  1. Find the requested operation and its order. g − f means the g answer minus the f answer.
  2. Use the same input in both original functions, because their outputs must refer to the same starting value.
  3. Record where both formulas work and, for division, where the bottom output is nonzero.
  4. Put each whole expression in parentheses before combining it. Simplify while keeping every original domain restriction.
  5. Check one permitted input directly in the original functions.

Worked example

Worked example

The same input, four different combinations

Let f(x) = x + 1 and g(x) = 2x. Find their sum, difference f − g, product, and quotient f divided by g at input 2. The question asks you to get both outputs at 2, then combine those outputs in four ways. Plan: evaluate both functions at the same input 2, combine their outputs in four ways, then derive the four combined formulas.

Show the steps and the answer

Same input: 2

f(2) = 3; g(2) = 4

3+4=7;3−4=−1

3×4=12;3÷4=34

  1. f(2)=2+1=3 and g(2)=2×2=4.Both functions receive input 2, so both answers describe that same input.
  2. (f+g)(2)=3+4=7.The sum adds the two outputs.
  3. (f−g)(2)=3−4=−1.The written order puts the f output first.
  4. (fg)(2)=3×4=12.The product multiplies the outputs.
  5. (fg)(2)=34.The quotient divides the f output by the nonzero g output.
  6. As formulas, (f+g)(x)=(x+1)+2x=3x+1 and (f−g)(x)=(x+1)−2x=1−x.Only matching x terms combine; the written subtraction order stays fixed.
  7. (fg)(x)=(x+1)(2x)=2x2+2x, and (fg)(x)=x+12x, requiring x≠0.Distribution multiplies both terms. The quotient removes the input 0 that makes 2x zero.
Answer
  • Sum: 7.
  • Difference: −1.
  • Product: 12.
  • Quotient: 34.
Double-check Undo each output operation at input 2: 7 − 4 = 3 checks the sum; −1 + 4 = 3 checks the difference; 12 ÷ 4 = 3 checks the product; 34 × 4 = 3 checks the quotient. The four combined formulas derived above also give these answers at 2.

The trap

Subtracting only the first term of a function. (x2 − 1) − (x − 1) subtracts the entire second expression, so both of its signs change.

Quick check

Try it before you open its steps. It is question 3 of 6 in the full lesson, where they run from easy to exam-hard.

Try it · level 3 of 6

Factor a difference of squares

Rewrite x2 − 16 as a product. You want two factors whose multiplication recreates the original expression. Plan: recognize x2 − 42, use the difference and sum of x and 4, then multiply to check.

Show the steps and the answer
x²4xx−4x−16−4x4
The opposite middle terms disappear when added.
  1. 16=42, so x2−16=x2−42.This is a difference of two squares.
  2. x2−42=(x−4)(x+4).Expanding gives x2 + 4x − 4x − 16; the middle terms cancel.
Answer
(x−4)(x+4).
Double-check At x = 6, 36 − 16 = 20 and (6 − 4)(6 + 4) = 2 × 10 = 20.

2 Composition passes one answer into the next function

Open the full lessonOnly this lesson

The rule

(f∘g)(x)=f(g(x)).

First apply g, then apply f to g's output.
The product (fg)(x)=f(x)·g(x) is a different operation.

How

  1. Rewrite the circle notation as nested parentheses, meaning one pair of parentheses inside another: (f ∘ g)(x) = f(g(x)).
  2. Name the inner function, which touches the original input.
  3. Evaluate that function and write its output as a separate intermediate, or in-between, answer.
  4. Put that whole intermediate answer into the outer function.
  5. Check the path: original input, inner output, final output.

Worked example

Worked example

Add 1, then double

Let g(x) = x + 1 and f(x) = 2x. Find (f ∘ g)(2). The input is 2; add 1 first, then use that answer as the input to the doubling function. Plan: finish g first, then carry its whole answer into f.

Show the steps and the answer
2g: add 1f: doublefirstsecond36
The 3 coming out of g goes into f.
  1. (f∘g)(2)=f(g(2)).The circle means composition, so g is the inner function.
  2. g(2)=2+1=3.The original input goes into g first.
  3. f(g(2))=f(3)=2×3=6.The output 3 from g is the input to f.
Answer
(f ∘ g)(2) = 6.
Double-check Combining the rules gives f(g(x)) = 2(x + 1); at 2 this is 2(2 + 1) = 6. The separate product at 2 is f(2)g(2) = 4 × 3 = 12, confirming that the two operations differ.

The trap

Starting with f because its name appears first. In f ∘ g, g receives the original input. Expand the circle notation before calculating.

3 Order changes the result, and units must fit

about 3 minOpen the full lessonOnly this lesson

The rule

Usually f(g(x))≠g(f(x)) as functions.

Check both orders rather than assuming equality.
For a meaningful composition, the inner output must be an acceptable outer input, including its units.

How

  1. For each order, identify the function nearest the original input.
  2. Evaluate or substitute that inner function into the other function.
  3. Compare the resulting formulas and their domains. A different answer at one allowed input proves the functions differ.
  4. For an application, label the starting input, intermediate output, and final output with units.
  5. Check that the intermediate unit matches the outer function's expected input unit.

Worked example

Worked example

Two orders of composition, and a unit check for fuel use

(a) Let f(x) = 2x + 5 and g(x) = x2. Find f(g(x)) and g(f(x)). Decide whether they are the same function. (b) A delivery van drives at a steady speed, so the distance it covers in t hours is D(t) = 60t miles. The van uses fuel according to G(d) = d30 gallons for d miles driven. Find the meaningful composition that gives gallons used after t hours, and evaluate it at t = 3. Explain why the other order, D(G(d)), is not meaningful.

Show the steps and the answer
  1. For f(g(x)), the inner function is g, because it acts on x first. For g(f(x)), the inner function is f.In a composition, the function written nearest the input is applied first.
  2. Substitute g(x) = x2 into f: f(g(x))=2(x2)+5=2x2+5.f doubles its input and adds 5, and here its input is x2.
  3. Substitute f(x) = 2x + 5 into g: g(f(x))=(2x+5)2=4x2+20x+25.g squares its input, and here its input is the whole expression 2x + 5.
  4. Compare the two results at x=1. f(g(1))=2(1)+5=7 and g(f(1))=(7)2=49. Both functions have domain all real numbers.A single allowed input that gives different outputs proves the functions are different.
  5. In part (b), label the units. For D, the input t is in hours and the output is in miles. For G, the input d is in miles and the output is in gallons.A composition is meaningful only if the inner output can be used as the outer input.
  6. Use the order G(D(t)). The chain is t hours →D(t) miles →G(D(t)) gallons. So G(D(t))=60t30=2t gallons.D gives miles, and miles is the unit G expects as its input.
  7. Evaluate at t=3. D(3)=60(3)=180 miles, and G(180)=18030=6 gallons.First find the intermediate output, then feed it into the outer function.
  8. Check the order D(G(d)). G(d) gives gallons, but D expects an input in hours.The intermediate unit (gallons) does not match the input unit D expects (hours), so this composition has no real-world meaning.
Answer
(a) f(g(x)) = 2x2 + 5 and g(f(x)) = 4x2 + 20x + 25. They are different functions, since at x = 1 the outputs are 7 and 49. (b) G(D(t)) = 2t gallons, and G(D(3)) = 6 gallons. D(G(d)) is not meaningful because G outputs gallons while D needs hours.
Double-check Part (a): at x = 0, f(g(0)) = 5 and g(f(0)) = 25. These still differ. Part (b): 3 hours at 60 miles per hour is 180 miles. At 30 miles per gallon, 180 miles uses 6 gallons. The formula 2t gives 2(3) = 6 and agrees.

Work to write

  1. f(g(x))=2x2+5
  2. g(f(x))=(2x+5)2=4x2+20x+25
  3. f(g(1)) = 7 ≠ 49 = g(f(1)), so f∘g ≠ g∘f
  4. t (hours) → D(t) (miles) → G(D(t)) (gallons)
  5. G(D(t))=60t30=2t
  6. G(D(3)) = 6 gallons
  7. D(G(d)) is not meaningful: G outputs gallons, but D needs hours

The trap

Treating a valid arithmetic calculation as proof that an application makes sense. Label the units as well as the numbers.

4 Follow a composition through tables

about 1 minOpen the full lessonOnly this lesson

The rule

To evaluate f(g(a)) from tables, read g(a), then use that output as the input for the f lookup.

A composition is defined only when both lookups exist.

How

  1. Read the nested notation and choose the inner table.
  2. Find the column labeled with the original input in that table.
  3. Read its output and write it as the intermediate value.
  4. Find that value among the input labels of the outer table, which may be a different column.
  5. Read the outer output. If either required input is absent from a complete table, the composition is undefined there.

Worked example

Worked example

Both orders from the tables at input 3

OpenStax problem

The two pictures list every input accepted by f and g. Find f(g(3)) and g(f(3)). You start at input 3 and find the final output in each order. Plan: read the inner table first, write its answer, and use that answer as an input in the outer table.

input xoutput f(x)16283341
The same picture, shown 5 times now: x: 1, 2, 3, 4; f(x): 6, 8, 3, 1.
input xoutput g(x)13253247
The same picture, shown 5 times now: x: 1, 2, 3, 4; g(x): 3, 5, 2, 7.
Show the steps and the answer
input xoutput f(x)16283341↓ evaluate: input given, read the output below it
In f, input 2 gives 8 and input 3 gives 3.
input xoutput g(x)13253247↓ evaluate: input given, read the output below it
In g, input 3 gives the intermediate value 2.
  1. For f(g(3)), read the column under 3 in the g picture: g(3)=2.g is the inner function in this expression.
  2. Move to the column under 2 in the f picture: f(2)=8.The intermediate answer 2 becomes the outer input.
  3. For g(f(3)), read the column under 3 in the f picture: f(3)=3.The reversed composition starts with f.
  4. Move to the column under 3 in the g picture: g(3)=2.The intermediate answer happened to equal the original input this time.
Answer
  • f(g(3)) = 8.
  • g(f(3)) = 2.
Double-check Read backward from the final answers. The 8 in f sits below input 2, and the 2 in g sits below input 3, so the first path is 3 → 2 → 8. For the other order, the 2 in g sits below 3, and the 3 in f sits below 3, so its path is 3 → 3 → 2.

The trap

Reading the same input column in both pictures. The outer lookup uses the inner output, which can move you to a new column.

Quick check

Try it before you open its steps. It is question 3 of 5 in the full lesson, where they run from easy to exam-hard.

Try it · level 3 of 5

Use the same table twice

Find p(p(3)) in this complete p table. You put the first answer through p again. Plan: read p under 3, then move to p under the number it returns.

input xoutput p(x)02142130
The same picture, shown 4 times now: x: 0, 1, 2, 3; p(x): 2, 4, 1, 0.
Show the steps and the answer
input xoutput p(x)02142130↓ evaluate: input given, read the output below it
The same picture again: x: 0, 1, 2, 3; p(x): 2, 4, 1, 0, read at x = 3 and 0.
input xoutput q(x)01132031
The same picture, shown 4 times now: x: 0, 1, 2, 3; q(x): 1, 3, 0, 1.
  1. p(3)=0.The innermost p acts on 3 first.
  2. p(p(3))=p(0)=2.The same function receives a new input, 0, on the second pass.
Answer
p(p(3)) = 2.
Double-check Read backward: p returns 2 under input 0, and p returns 0 under input 3. Multiplying p(3) by itself would give 0, which answers a different question.

5 Follow a composition across two graphs

about 1 minOpen the full lessonOnly this lesson

The rule

For f(g(a)): read the y-value of g at x=a; use that number as the x-value on f; read f's y-value.

A point (a, b) on g means g(a)=b.

How

  1. Choose the inner graph from the function nearest the starting input.
  2. Locate that input on the inner graph's x-axis and move vertically to its curve.
  3. Read the curve's y-coordinate as the intermediate output.
  4. Locate that number on the outer graph's x-axis and move vertically to its curve.
  5. Read the outer y-coordinate as the final answer. Check each graph's own scale.

Worked example

Worked example

A line feeds a square graph

The first picture is g(x) = x + 2 and the second is f(x) = x2. Use the labeled points to find f(g(2)). The input is 2 on g; the resulting height selects the input on f. Plan: read the inner curve at the starting horizontal input, then carry its height to the outer x-axis.

g(2) = 4242468
On g, input 2 meets the line at height 4.
Show the steps and the answer
f(4) = 162426101418
On f, the new input 4 meets the curve at height 16.
  1. On g, find the labeled point (2, 4), so g(2)=4.The point's horizontal coordinate is the input and its vertical coordinate is the output.
  2. Move to input 4 on f's horizontal axis.g's output becomes f's input, rather than staying a height.
  3. Read the labeled point (4, 16), so f(4)=16.The outer graph gives the final output at the intermediate input.
Answer
f(g(2)) = 16.
Double-check The formulas give g(2) = 2 + 2 = 4, then f(4) = 42 = 16. This separate formula calculation agrees with the graph reading.

The trap

Using the first graph's output as a height on the second graph. Move it to the second x-axis before finding the outer output.

Quick check

Try it before you open its steps. It is question 3 of 5 in the full lesson, where they run from easy to exam-hard.

Try it · level 3 of 5

A negative handoff can work

Using g(x) = x + 2 and f(x) = x2, find f(g(−3)). The input is negative, and the first output is also negative. You want the second graph’s output at that handoff. Plan: read g at −3, then start on f to the left of zero.

(−3, −1)−4−224−4−22468
y = x + 2, with the point (−3, −1).
Show the steps and the answer
(−1, 1)−4−22426101418
y = x2, with the point (−1, 1).
  1. On g, the point (−3,−1) gives g(−3)=−1.A point below the horizontal axis has a negative output.
  2. Put −1 on f’s horizontal axis. The point (−1,1) gives f(−1)=1.Negative inputs are positions to the left of zero; their square is nonnegative.
  3. f(g(−3))=1.The final output is the second graph’s height, not the first output’s sign.
Answer
f(g(−3))=1.
Double-check The original formulas give g(−3) = −3 + 2 = −1 and f(−1) = (−1)(−1) = 1. The combined formula gives (−3 + 2)2 = 1 as well.

6 Evaluate formulas one number at a time

about 2 minOpen the full lessonOnly this lesson

The rule

For f(h(a)), calculate h(a) first; then substitute that entire numerical answer into every input slot of f.

The input-variable letter does not change the instructions.

How

  1. Expand circle notation into parentheses if needed.
  2. Copy the inner formula and replace every input letter with the original number, using parentheses for negative numbers.
  3. Complete that arithmetic and write the intermediate output.
  4. Copy the outer formula and replace every input letter with that output.
  5. Complete the arithmetic and check by substituting into a combined formula.

Worked example

Worked example

Both orders at input 1

OpenStax problem

Let f(t) = t2 − t and h(x) = 3x + 2. Find f(h(1)) and h(f(1)). You start at 1 and want the final output in each order. Plan: finish the inner arithmetic, then insert its answer into every outer slot. The input letters t and x are slot names; their difference does not change the method.

Show the steps and the answer
1h: 3x + 2f(t) = t² − tfirstsecond520
1 goes into h: 3x + 2, then 5 into f(t) = t2 − t: 20.
1f(t) = t² − th: 3x + 2firstsecond02
1 goes into f(t) = t2 − t, then 0 into h: 3x + 2: 2.
  1. For f(h(1)), start with h(1)=3×1+2=5.h is the inner function for this order.
  2. f(h(1))=f(5)=52−5=25−5=20.The output 5 replaces both occurrences of t in f.
  3. For h(f(1)), start with f(1)=12−1=1−1=0.f is the inner function for the reversed order.
  4. h(f(1))=h(0)=3×0+2=2.The intermediate output 0 is a valid numerical input to h.
Answer
  • f(h(1)) = 20.
  • h(f(1)) = 2.
Double-check Using the combined formulas with one starting letter gives f(h(x)) = (3x + 2)2 − (3x + 2), which gives 25 − 5 = 20 at x = 1. The reversed formula h(f(t)) = 3(t2 − t) + 2 gives 0 + 2 = 2 at t = 1. Different input-slot letters describe the same instructions.

The trap

Replacing only the squared input in t2 − t. The same input goes into both positions, so f(5) is 52 − 5.

Quick check

Try it before you open its steps. It is question 2 of 4 in the full lesson, where they run from easy to exam-hard.

Try it · level 2 of 4

Fill every outer slot and reverse the order

Let f(t) = t2 − t and h(x) = 3x + 2. Find f(h(1)) and h(f(1)). You start at 1 and want the final output in each order. Plan: finish the inner arithmetic, then insert its answer into every outer slot. The input letters t and x are slot names; their difference does not change the method.

Show the steps and the answer
1h: 3x + 2f(t) = t² − tfirstsecond520
The same picture again: 1 goes into h: 3x + 2, then 5 into f(t) = t2 − t: 20.
1f(t) = t² − th: 3x + 2firstsecond02
The same picture again: 1 goes into f(t) = t2 − t, then 0 into h: 3x + 2: 2.
  1. For f(h(1)), start with h(1)=3×1+2=5.h is the inner function for this order.
  2. f(h(1))=f(5)=52−5=25−5=20.The output 5 replaces both occurrences of t in f.
  3. For h(f(1)), start with f(1)=12−1=1−1=0.f is the inner function for the reversed order.
  4. h(f(1))=h(0)=3×0+2=2.The intermediate output 0 is a valid numerical input to h.
Answer
  • f(h(1)) = 20.
  • h(f(1)) = 2.
Double-check Using the combined formulas with one starting letter gives f(h(x)) = (3x + 2)2 − (3x + 2), which gives 25 − 5 = 20 at x = 1. The reversed formula h(f(t)) = 3(t2 − t) + 2 gives 0 + 2 = 2 at t = 1. Different input-slot letters describe the same instructions.

7 Substitute the whole inside expression

about 3 minOpen the full lessonOnly this lesson

The rule

To form f(g(x)), replace every input-variable occurrence in f with the whole parenthesized expression g(x).

(a+b)2=a2+2ab+b2, because (a+b)(a+b) has two cross products ab.

How

  1. Copy the outer formula and identify every input slot.
  2. Write the complete inner formula in parentheses in every slot.
  3. Keep powers outside those parentheses so they act on the entire input.
  4. Expand with distribution. For a square, multiply the two identical parentheses and keep both cross products.
  5. Combine like terms, preserve any domain restrictions, and check a small allowed input by the two-stage route.

Worked example

Worked example

A square makes the middle term

Let f(x) = x2 − 6 and g(x) = 3x + 2. Find (f ∘ g)(x) and (g ∘ f)(x). You want one formula for each order. Plan: put the complete inner formula into the outer input place, multiply out any square using four products, and collect matching terms.

Show the steps and the answer
9x²6x3x6x423x2
The two middle rectangles contribute 6x each, so the middle term is 12x.
1g: 3x + 2f: u² − 6firstsecond519
The input u names the entire number handed to f.
  1. (f∘g)(x)=f(3x+2)=(3x+2)2−6.The outer f squares its whole input before subtracting 6.
  2. (3x+2)2=(3x+2)(3x+2)=9x2+6x+6x+4.Each of the two terms in one copy multiplies each term in the other copy.
  3. (f∘g)(x)=9x2+12x+4−6=9x2+12x−2.The two middle products add to 12x, and 4 − 6 = −2.
  4. (g∘f)(x)=g(x2−6)=3(x2−6)+2.Now g multiplies f’s entire output by 3 and adds 2.
  5. (g∘f)(x)=3x2−18+2=3x2−16.The factor 3 multiplies both x2 and −6, then −18 + 2 = −16.
Answer
  • (f∘g)(x)=9x2+12x−2.
  • (g∘f)(x)=3x2−16.
  • Both domains are all real numbers.
Double-check At x = 1, g(1) = 5 and f(5) = 19, matching 9 + 12 − 2 = 19. Reversing gives f(1) = −5 and g(−5) = −13, matching 3 − 16 = −13.

The trap

Writing (2x + 1)2 = 4x2 + 1. The square multiplies two whole sums, so the two cross products must appear.

Quick check

Try it before you open its steps. It is question 4 of 7 in the full lesson, where they run from easy to exam-hard.

Try it · level 4 of 7

A square with a negative term

Let f(x) = x2 + 1 and g(x) = 3x − 2. Find f(g(x)). You want to square the whole difference and then add 1. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.

Show the steps and the answer
9x²−6x3x−6x4−23x−2
The labels record signed products.
  1. f(g(x))=(3x−2)2+1.The square acts on all of g's output.
  2. (3x−2)2=9x2−6x−6x+4.Each cross product contains one negative factor, while (−2)(−2) is positive.
  3. f(g(x))=9x2−12x+5.The cross products add to −12x and 4 + 1 = 5.
Answer
9x2−12x+5.
Double-check At 1, g(1) = 1 and f(1) = 2; 9 − 12 + 5 = 2.

8 A composite domain has two gates

Open the full lessonOnly this lesson

The rule

The domain of f∘g consists of the x values allowed by g for which g(x) is allowed by f.

Keep original restrictions when simplifying the composite formula.

How

  1. Find the inner domain. Record inputs making an inner denominator zero or violating any other inner requirement.
  2. Find what the outer function cannot accept. For an outer denominator, determine its forbidden input values.
  3. Set g(x) equal to each forbidden outer input and solve. Exclude the solutions that are in the inner domain.
  4. Keep only starting inputs passing both gates. For roots, use inequalities rather than only equations, as the next lesson explains.
  5. Write the result in interval notation and check a permitted input and each excluded input using the original stages.

Worked example

Worked example

Two different failures in a fraction composition

OpenStax problem

Let f(x) = 5x−1 and g(x) = 43x−2. Find the domain of (f ∘ g)(x). You want every starting number that can get through g and then f. Plan: find where the first bottom is zero, then find where g hands f the number 1; exclude both starts.

Show the steps and the answer
0.672
The open points exclude 23 and 2. The label 0.67 approximates 23; use the exact fraction in your answer.
  1. Gate 1: set 3x−2=0 to find the starting input that makes g divide by zero.A zero inner bottom prevents any in-between answer.
  2. Add 2: 3x=2. Divide by 3: x=23. Plug back in: 3×23−2=2−2=0. Exclude 23.Balanced operations find the failed start, and substitution confirms the zero bottom.
  3. Gate 2: f cannot accept 1, since 1−1=0. Find every start whose g answer is 1.The outer function receives g(x), so the forbidden number is a handoff value.
  4. Solve 43x−2=1. On the inner domain multiply by the nonzero 3x−2: 4=3x−2.This locates starts that reach the forbidden outer input. The first exclusion makes the multiplication legal.
  5. Add 2: 6=3x. Divide by 3: x=2.These operations find the start that causes the second failure.
  6. Plug back in: g(2)=46−2=1, and f(1)=50. Exclude 2.The first stage works at 2, but its answer breaks the second division.
  7. Keep x≠23 and x≠2. Split the line at these two excluded points.All remaining starts pass both original bottoms.
Answer
  • Domain: (−∞, 23) ∪ (23, 2) ∪ (2, ∞).
  • Set-builder: {x | x ≠ 23 and x ≠ 2}.
Double-check At x = 0, g(0) = −2 and f(−2) = −53, so a permitted input works. At x = 23, g fails. At x = 2, g(2) = 1 exists but f(1) fails. The two exclusions have different causes.

The trap

Checking only the simplified final denominator. That can lose an inner restriction which disappeared during algebra.

Quick check

Try it before you open its steps. It is question 3 of 5 in the full lesson, where they run from easy to exam-hard.

Try it · level 3 of 5

An inner restriction only

Let g(x) = 2x+4 and f(x) = x2. Find the composite domain. You want a defined inner fraction followed by a square. Plan: inspect the original inside rule, then inspect the outside rule at the inside answer, keeping both restrictions.

Show the steps and the answer
−3gsquarefirstsecond24
Only the inner denominator limits this path.
  1. Set x+4=0 to locate the inner zero bottom. Subtract 4: x=−4. Plug back in: −4+4=0. Exclude −4.The equation identifies the failed first-stage input.
  2. No further exclusion is needed.The outer square accepts any real intermediate output.
Answer
(−∞,−4)∪(−4,∞).
Double-check At −3, g(−3) = 2 and f(2) = 4. At −4 the first stage divides by zero.

9 Square roots add boundary checks

about 2 minOpen the full lessonOnly this lesson

The rule

A(x) requires A(x)≥0.

A denominator A(x) requires A(x) > 0.
For f(g(x)), apply every root requirement at its own stage and keep both gates.

How

  1. Write the inner radicand requirement before using the inner function's output.
  2. Substitute the inner output into the outer radicand and require it to be nonnegative.
  3. Use the inner range when possible. A real square root output is always at least zero.
  4. Before squaring an inequality, check that both compared sides are nonnegative. Then square and solve while preserving the earlier requirements.
  5. If a root is a denominator, replace its nonnegative condition with a greater than zero one.
  6. Combine the bounds and test endpoints in the original two-stage formula.

Worked example

Worked example

A root inside a root

OpenStax problem

Let f(x) = x+2 and g(x) = 3−x. Find (f ∘ g)(x) and its domain. You want a nested-root formula and the starting inputs for which both roots exist. Plan: find where the inner root exists, then use its nonnegative output to check the outer radicand after adding 2.

Show the steps and the answer
3included(−∞, 3]
Starting input 3 is included because an ordinary root accepts radicand zero.
  1. (f∘g)(x)=f(3−x)=3−x+2.The whole inner root replaces the outer input.
  2. The inner root requires 3−x≥0.A real square root cannot have a negative radicand.
  3. −x≥−3, so x≤3.Subtracting 3 gives the first inequality; multiplying by −1 reverses its direction.
  4. The outer root requires 3−x+2≥0. This adds no restriction.Where the inner root exists, it is at least zero, so adding 2 makes the outer radicand at least 2.
Answer
  • (f∘g)(x)=3−x+2.
  • Domain: (−∞, 3].
Double-check At x = 3, the inner output is 0 and the outer output is 2, so the endpoint is included. At x = 4, the inner radicand is −1, so that input fails. At x = −6, g(−6) = 3 and f(3) = 5, confirming that a composite input can lie outside f's own domain x ≥ −2.

The trap

Demanding a positive radicand for every square root. Ordinary roots allow zero; roots in denominators must avoid zero because of division.

Quick check

Try it before you open its steps. It is question 4 of 7 in the full lesson, where they run from easy to exam-hard.

Try it · level 4 of 7

An inner root reaches a forbidden outer input

Let g(x) = x+9 and f(x) = 3x−5. Find the domain of f(g(x)). You need the root to exist and its answer to avoid 5. Plan: keep the inner lower bound, solve x+9 = 5, then exclude the verified start.

Show the steps and the answer
−916[−9, 16) ∪ (16, ∞)
Include −9, where the inner root is zero. Exclude 16, where that root is 5 and the outer bottom is zero.
  1. Gate 1: x+9≥0 gives x≥−9.This finds the starting inputs where the inner root exists.
  2. Gate 2: f rejects input 5, since 5−5=0. Solve x+9=5 to find the start that hands f that value.The equation locates the failed outer handoff.
  3. Both sides are nonnegative. Square: x+9=25. Subtract 9: x=16.Squaring reverses the existing root here; subtraction isolates the failed start.
  4. Plug back in: g(16)=25=5 and f(5)=30. Exclude 16.The candidate truly breaks gate 2 and already lies in the inner domain.
  5. At the lower boundary −9,g(−9)=0 and f(0)=3−5=−35, so include −9.A zero root is permitted here because the outer bottom is −5, not zero.
Answer
Domain: [−9, 16) ∪ (16, ∞).
Double-check At x = 0, g(0) = 3 and f(3) = −32, so an input between the boundaries works. At 16 only the second stage fails.

10 Decompose by naming the inside and outside jobs

about 3 minOpen the full lessonOnly this lesson

The rule

To write h(x)=f(g(x)), choose g as the inside job and f as the job applied to its output.

Check by substitution and preserve h's original domain.

How

  1. Work out h at a permitted small input. The final job you perform suggests the outer function; everything before it suggests the inner function.
  2. Define g(x) as that package, which will be calculated first.
  3. Define f(x) as the operation applied to one input package.
  4. Substitute g(x) into f and show that f(g(x)) recreates h(x).
  5. Check the composite domain against the original domain. A formula match alone can hide a lost input.
  6. If another split is requested, choose a different package and repeat the same checks.

Worked example

Worked example

Three decompositions

Write each as f(g(x)): (a) h(x) = 5−x2; (b) h(x) = (5x − 4)3; (c) h(x) = 1x+8. You want an inside calculation followed by the finishing operation. Plan: name everything before the last operation as g, name the last operation as f, then recompose and compare domains.

Show the steps and the answer
15 − x²rootfirstsecond42
Part (a) builds the radicand before taking its root.
15x − 4cubefirstsecond11
Part (b) builds the whole expression before cubing it.
1x + 8reciprocalfirstsecond91/9
Part (c) builds a nonzero bottom before taking its reciprocal.
  1. (a) Choose g(x)=5−x2 and f(u)=u. Recompose: f(g(x))=5−x2.The inside builds the radicand; the outside takes its root. u is another name for f’s input slot.
  2. Require 5−x2≥0. Rearrange to x2≤5, so −5≤x≤5.This finds the starts whose radicand is nonnegative. Their distance from zero is at most 5 ≈ 2.24.
  3. Test x=2 and x=−2: both give radicand 5−4=1. Start 3 gives 5−9=−4 and fails.These tests show why both a lower and an upper boundary are needed.
  4. (b) Choose g(x) = 5x − 4 and f(u) = u3. Recompose: f(g(x))=(5x−4)3.Build the whole parenthesized expression first, then cube it. Neither stage restricts real starts.
  5. (c) Choose g(x)=x+8 and f(u)=1u. Recompose: f(g(x))=1x+8.Addition builds the bottom before taking the reciprocal.
  6. Locate the failed bottom by solving x+8=0: subtract 8, giving x=−8. Plug back in: −8+8=0. Exclude −8.This equation finds the one start whose inside answer cannot enter the reciprocal.
Answer
  • (a)g(x)=5−x2
  • f(u)=u.
  • Domain: [−5, 5].
  • (b)g(x)=5x−4
  • f(u)=u3.
  • Domain: (−∞, ∞).
  • (c) g(x) = x + 8
  • f(u)=1u.
  • Domain: (−∞, −8) ∪ (−8, ∞).
Double-check At start 1, (a) gives inside 4 then root 2; (b) gives inside 1 then cube 1; (c) gives inside 9 then reciprocal 19. Direct substitution into each original function gives the same answer. The symbolic recompositions verify every allowed start, and the domains match the original root and bottom requirements.

The trap

Giving the two correct component formulas in the wrong order. Recompose f(g(x)) on paper before accepting your decomposition.

Quick check

Try it before you open its steps. It is question 4 of 7 in the full lesson, where they run from easy to exam-hard.

Try it · level 4 of 7

A quadratic package under a root

Decompose h(x) = 10−x2 and give its domain. The expression 10 − x2 is quadratic: its highest input power is x2. You want the radicand-building job, the root job, and the permitted starts. Plan: identify the last operation, name the earlier work as g, then recompose and check the allowed starts.

Show the steps and the answer
allowed x10 − x²rootfirstsecond10 − x² ≥ 0√(10 − x²)
The quadratic package must remain nonnegative.
  1. Take g(x)=10−x2 and f(x)=x.The quadratic expression is the package inside the root.
  2. f(g(x))=10−x2.The entire radicand fills the outer input slot.
  3. Require 10−x2≥0, so x2≤10 and −10≤x≤10.The distance of x from zero must be no more than 10.
  4. Starts 3 and −3 give inside 10−9=1 and work. Starts 4 and −4 give 10−16=−6 and fail. Since 10≈3.16, both boundaries lie between those pairs.This makes the two-sided distance bound concrete.
Answer
  • g(x)=10−x2
  • f(x)=x.
  • Domain: [−10, 10].
Double-check At x = 1 the stages give 9 then 3, matching the original 10−1 = 9 = 3. At both endpoints x2 = 10 and the root is zero, so both are included.

11 Quick checks for the whole unit

8 questions

Quick check 1 of 8

Let f(x) = x2 + 2 and g(x) = 4x. Find f(g(1)) and g(f(0)). You want the output of each two-step route.

Show the steps and the answer
Answer
  • f(g(1)) = f(4) = 18, because g acts first.
  • g(f(0)) = g(2) = 8, because f acts first.

Quick check 2 of 8

Use the two pictured complete tables. Find p(q(2)); then find every start x for which p(q(x)) = 5. The first gives an input and asks for an output; the second gives an output and asks for inputs.

input xoutput p(x)15213443
The outer p table lists all four accepted inputs.
input xoutput q(x)11233241
The inside q table supplies each in-between answer.
Show the steps and the answer
input xoutput p(x)15213443↓ evaluate: input given, read the output below it
The outer p table lists all four accepted inputs.
input xoutput q(x)11233241↓ evaluate: input given, read the output below it
The inside q table supplies each in-between answer.
Answer
  • p(q(2)) = p(3) = 4.
  • p(q(x)) = 5 requires q(x) = 1, so x = 1 or x = 4, because only p(1) is 5 and the q output 1 appears in those two columns.

Quick check 3 of 8

p(t) counts pages printed in t minutes, and w(n) gives grams of ink used for n pages. What does w(p(8)) measure, and why does p(w(8)) lack the stated meaning?

Show the steps and the answer
Answer
  • w(p(8)) measures grams of ink used in 8 minutes of printing, because pages are the shared handoff.
  • p(w(8)) passes grams to a rule expecting minutes, so its units do not match.

Quick check 4 of 8

Let f(u) = 2u−4 and g(x) = x+11. Find the domain of f(g(x)). You want starts where the root exists and its answer does not make the outer bottom zero.

Show the steps and the answer
−115[−11, 5) ∪ (5, ∞)
Keep the root boundary −11 and remove the outer failure at 5.
Answer
  • [−11, 5) ∪ (5, ∞), because x ≥ −11 makes the root real and x+11 = 4 gives x + 11 = 16, hence excluded start 5. At 5 the root is 4 and the outer bottom is 0
  • at −11 the outer bottom is −4 and works.

Quick check 5 of 8

Let f(x) = 5x − 2. Find f(f(x)). You want to feed the first answer into the same rule again.

Show the steps and the answer
Answer
f(f(x)) = 5(5x − 2) − 2 = 25x − 12, because the second application acts on the entire first answer, rather than squaring that answer.

Quick check 6 of 8

Let g(x) = x − 7 and f(u) = u. Find the domain of f(g(x)). You need the inner output to be allowed under the root.

Show the steps and the answer
Answer
[7, ∞), because x − 7 ≥ 0 gives x ≥ 7 and 0 is defined at the endpoint.

Quick check 7 of 8

Now use g(x) = x − 7 and f(u) = 1u. Is input 7 still allowed? Find the domain.

Show the steps and the answer
Answer
  • Input 7 is excluded.
  • Domain: (7, ∞), because the denominator x−7 must be real and nonzero, requiring x − 7 > 0.

Quick check 8 of 8

The pictures show g(x) = 6 − x and f(x) = x2 with no answer labels. Read f(g(2)) from the grid. You want the height on g at input 2, then the height on f at that new input.

246246
Read g’s height over horizontal input 2.
2426101418
Use the first height as the new input on f.
Show the steps and the answer
Answer
g(2) = 4, then f(4) = 16, because the first height becomes the second horizontal input.