1.2 - Combining functions

1.2 - Combining functions

Applying one function after another creates a new function, but the order and permitted inputs both matter. In this part of 1.2, you will form composite rules, decide when a composition exists, and solve equations while keeping the original domain restrictions.

Order of composition

Start with 33, double it, then add 11: the answer is 77. Add 11 first, then double: the answer is 88. Why does using the same two operations give different answers? A composition records their order.

Let f(x)=2xf(x)=2x and g(x)=x+1g(x)=x+1. The chain 3↦6↦73\mapsto6\mapsto7 means apply ff, then gg. Cambridge writes the combined function as gfgf: the function nearest the input acts first.

Composite function

The composite function gfgf means gg after ff: first calculate f(x)f(x), then use that output as the input to gg. It is not multiplication of g(x)g(x) by f(x)f(x).

To form an expression, replace every occurrence of the input variable in the outer rule by the entire inner expression. Brackets protect that expression.

Order of composition

gf(x)=g(f(x)),fg(x)=f(g(x)).gf(x)=g(f(x)),\qquad fg(x)=f(g(x)).

In general, gf≠fggf\ne fg. Each composition also requires the inner outputs to be permitted inputs to the outer function.

Not in the formula booklet: learn it.

The following pair uses the same two functions and changes only their order.

Worked example 1: applying g after f

Question. Functions ff and gg are defined for all real xx by f(x)=2x−1f(x)=2x-1 and g(x)=x2+3g(x)=x^2+3. Find gf(x)gf(x) and gf(2)gf(2).

Plan. Put 2x−12x-1 into the square in gg, then simplify.

gf(x)=g(2x−1)apply f first=(2x−1)2+3use the whole input=4x2−4x+4expand and collect\begin{aligned} gf(x)&=g(2x-1) &&\text{apply }f\text{ first}\\ &=(2x-1)^2+3 &&\text{use the whole input}\\ &=4x^2-4x+4 &&\text{expand and collect} \end{aligned}

Answer. gf(x)=4x2−4x+4gf(x)=4x^2-4x+4, and gf(2)=12gf(2)=12.

Check. Following the original chain, f(2)=3f(2)=3 and g(3)=12g(3)=12, agreeing with the composite expression.

Reverse the order. This time the square is formed before doubling and subtracting 11.

Worked example 2: applying f after g

Question. For the same functions f(x)=2x−1f(x)=2x-1 and g(x)=x2+3g(x)=x^2+3, find fg(x)fg(x) and fg(2)fg(2).

Plan. Replace the input in ff by x2+3x^2+3.

fg(x)=f(x2+3)=2(x2+3)−1double the entire input=2x2+5\begin{aligned} fg(x)&=f(x^2+3)\\ &=2(x^2+3)-1 &&\text{double the entire input}\\ &=2x^2+5 \end{aligned}

Answer. fg(x)=2x2+5fg(x)=2x^2+5, and fg(2)=13fg(2)=13.

Check. g(2)=7g(2)=7, then f(7)=13f(7)=13. The values 1212 and 1313 confirm that reversing the order can change the result.

A repeated composition is written f2(x)=f(f(x))f^2(x)=f(f(x)). For example, if f(x)=2x−1f(x)=2x-1, then f2(x)=2(2x−1)−1=4x−3f^2(x)=2(2x-1)-1=4x-3. This differs from [f(x)]2=(2x−1)2[f(x)]^2=(2x-1)^2, which squares the output.

Watch out

The wrong line g(2x−1)=2x2−1+3g(2x-1)=2x^2-1+3 substitutes into only part of the square. The correct line is g(2x−1)=(2x−1)2+3g(2x-1)=(2x-1)^2+3.

Try the reversed order with a fresh pair.

When composition exists

An output from the first function must be a legal input to the second. If even one input in the stated domain of ff produces an output outside the domain of gg, then gfgf cannot be formed on the whole stated domain of ff.

Condition for a composite

The composite gfgf, with domain equal to the stated domain of ff, exists only when

range of f ⊆ domain of g.\text{range of }f\ \subseteq\ \text{domain of }g.

Here ⊆\subseteq means “is contained in”, including the possibility of equality.

Not in the formula booklet: learn it.

For example, if ff has range y≥4y\ge4 and gg has domain x≥1x\ge1, every output of ff can enter gg, so gfgf exists. The two sets need not be equal. Do not compare the two domains, and do not compare the range of gg with the domain of ff when deciding about gfgf.

Sometimes a composition fails for the original functions, but a restriction of the inner function's domain makes it possible. State that restriction explicitly: you are then forming a composite using the restricted function, rather than claiming that the original composite existed.

Worked example 3: including the boundary

Question. Let f(x)=x−3f(x)=x-3 for x≥0x\ge0, and g(x)=xg(x)=\sqrt{x} for x≥0x\ge0. Determine whether gfgf exists for the stated functions. If it does not, find the largest restriction of the domain of ff that permits it, and give the composite rule.

Plan. Compare the whole range of ff with the domain of gg, then require f(x)≥0f(x)\ge0.

The range of ff is y≥−3y\ge-3. It includes negative values, which are outside the domain of gg; for instance, f(0)=−3f(0)=-3.

For a restriction that works,

f(x)≥0⟺x−3≥0⟺x≥3.f(x)\ge0\quad\Longleftrightarrow\quad x-3\ge0\quad\Longleftrightarrow\quad x\ge3.

This is already inside the original domain x≥0x\ge0.

Answer. The original gfgf does not exist on x≥0x\ge0. Restricting ff to x≥3x\ge3 permits the rule gf(x)=x−3gf(x)=\sqrt{x-3}, with domain x≥3x\ge3.

Check. At the boundary x=3x=3, the chain is 3↦0↦03\mapsto0\mapsto0, which is defined. Every x≥3x\ge3 gives a non-negative inner output.

Change the outer rule by taking its reciprocal. Zero is now forbidden, so the endpoint changes from inclusive to strict.

Worked example 4: excluding the boundary

Question. Let f(x)=x−3f(x)=x-3 for x≥0x\ge0, and h(x)=1/xh(x)=1/\sqrt{x} for x>0x>0. Determine whether hfhf exists for the stated functions. Find the largest restriction of the domain of ff that permits it and give its rule.

Plan. Require the inner output to be strictly positive, because it enters a square root in a denominator.

The range y≥−3y\ge-3 of ff is not contained in x>0x>0. For the restricted function,

x−3>0⟺x>3.x-3>0\quad\Longleftrightarrow\quad x>3.

Answer. The original hfhf does not exist on x≥0x\ge0. Restricting ff to x>3x>3 gives hf(x)=1/x−3hf(x)=1/\sqrt{x-3}, with domain x>3x>3.

Check. At x=4x=4, the chain gives 11. At x=3x=3, it would require 1/01/0, confirming why equality must be excluded.

Always retain the original restrictions. If the inner function had domain x≥7x\ge7, the requirement x>3x>3 would leave the composite domain at x≥7x\ge7, rather than enlarge it to x>3x>3. Cancelling algebraic factors also does not restore an input excluded by an original rule.

Exam tip

Support an existence decision with the relevant range and domain. A successful numerical example proves only that one chain works; the condition must hold for every input in the inner function's stated domain.

Use the strict boundary in a new composition.

Equations with composites

A composite equation is an ordinary equation after you have formed the correct rule. Its solutions must still belong to the composite's domain. Algebra can produce a candidate that the function itself does not allow.

Worked example 5: a non-negative input

Question. Let f(x)=x2f(x)=x^2 for x≥0x\ge0, and g(x)=2x+1g(x)=2x+1 for x∈Rx\in\mathbb R. Solve gf(x)=19gf(x)=19.

Plan. Form g(f(x))g(f(x)), solve the equation, then apply the domain of ff.

The range of ff is y≥0y\ge0, contained in the domain of gg, so the composite exists on x≥0x\ge0.

gf(x)=2x2+12x2+1=19x2=9subtract 1 and divide by 2\begin{aligned} gf(x)&=2x^2+1\\ 2x^2+1&=19\\ x^2&=9 &&\text{subtract }1\text{ and divide by }2 \end{aligned}

The real numbers whose square is 99 are 33 and −3-3. Only 33 is in the domain.

Answer. x=3x=3.

Check. f(3)=9f(3)=9, then g(9)=19g(9)=19. The rejected value −3-3 is not a permitted input to ff, even though it satisfies the algebraic equation.

Change only the domain of the inner function. The equation is unchanged, but the accepted answer switches branch.

Worked example 6: a non-positive input

Question. Let h(x)=x2h(x)=x^2 for x≤0x\le0, and g(x)=2x+1g(x)=2x+1 for x∈Rx\in\mathbb R. Solve gh(x)=19gh(x)=19.

Plan. Use the same composite algebra, then keep the candidate allowed by x≤0x\le0.

gh(x)=2x2+1,2x2+1=19⟹x=±3.gh(x)=2x^2+1, \qquad 2x^2+1=19\quad\Longrightarrow\quad x=\pm3.

Only the negative candidate belongs to the stated domain.

Answer. x=−3x=-3.

Check. h(−3)=9h(-3)=9, then g(9)=19g(9)=19. The positive candidate would require evaluating h(3)h(3), which is undefined.

For an equation such as gf(x)=fg(x)gf(x)=fg(x), first find both composite rules and both domains. A solution must belong to both domains, so use their intersection. If the resulting equation has no permitted root, state that there is no solution.

Watch out

“x=±3x=\pm3” solves x2=9x^2=9 over all real numbers. It is not the final answer when the original function restricts xx to one side of zero. Test candidates against the original domain before substituting them into the original chain.

Solve one more equation on a negative branch.

Quick Recap

  • In gfgf, apply ff first and gg second; substitute the whole inner expression.
  • For the stated functions, the range of ff must be contained in the domain of gg.
  • If a domain restriction is needed, state it explicitly and retain every original restriction.
  • Solve a composite equation using its rule, then reject candidates outside its domain.

The opening calculations differ because composition records an order: doubling before adding 11 is not the same as adding 11 before doubling.