Combining and Composing Functions

Learning goals

  • Form arithmetic combinations and retain every restriction from the original functions
  • Evaluate compositions from tables and formulas by following the inside function first
  • Compare composition orders and explain how intermediate units connect a model
  • Determine a composite domain by checking the input and the intermediate output
  • Decompose a formula and verify both its rule and its allowed inputs

Combining outputs at the same input

Suppose f(2)=9f(2)=9 and g(2)=3g(2)=3. At input 22, we can add the outputs to get 1212, subtract them to get 66, multiply them to get 2727, or divide them to get 33. Each calculation uses the same input in both functions.

These arithmetic combinations of functions apply the named operation to the two outputs:

CombinationOutput at input xx
Sum f+gf+gf(x)+g(x)f(x)+g(x)
Difference f−gf-gf(x)−g(x)f(x)-g(x)
Product fgfgf(x)g(x)f(x)g(x)
Quotient f/gf/gf(x)/g(x)f(x)/g(x)

Write DfD_f and DgD_g for the domains of ff and gg, respectively. An input must belong to both original domains before either pair of outputs exists. Therefore the sum, difference, and product have domain Df∩DgD_f\cap D_g, the intersection of the two domains. The quotient needs the additional condition g(x)≠0g(x)\ne0. These are the domains of the combined functions unless a narrower domain is explicitly specified.

Worked example 1 Four operations, two domain decisions

Problem. Let f(x)=x+2f(x)=x+2 on all real inputs and g(x)=10−xg(x)=\sqrt{10-x} on its natural real domain. Give a formula and domain for each combination.

Part A: The sum f+gf+g.

Part B: The difference f−gf-g.

Part C: The product fgfg.

Part D: The quotient f/gf/g.

Solution. The root requires 10−x≥010-x\ge0, or x≤10x\le10. Since ff accepts every real input, the shared domain is (−∞,10](-\infty,10].

Part A: Add the outputs:

(f+g)(x)=x+2+10−x.(f+g)(x)=x+2+\sqrt{10-x}.

The domain is (−∞,10](-\infty,10].

Part B: Subtract the second output from the first:

(f−g)(x)=x+2−10−x.(f-g)(x)=x+2-\sqrt{10-x}.

The domain is again (−∞,10](-\infty,10].

Part C: Multiply the outputs:

(fg)(x)=(x+2)10−x.(fg)(x)=(x+2)\sqrt{10-x}.

The domain is (−∞,10](-\infty,10]. The product is defined at x=10x=10, where the root is zero.

Part D: Divide the first output by the second:

(fg)(x)=x+210−x.\left(\frac fg\right)(x)=\frac{x+2}{\sqrt{10-x}}.

Now the root must also be nonzero. Exclude x=10x=10, leaving domain (−∞,10)(-\infty,10).

Check your understanding

The declared domains of ff and gg are [−5,4][-5,4] and [1,7][1,7]. What is the domain of f+gf+g?

Answer choices

A simpler formula keeps its original restrictions

Simplifying a quotient changes its written form. It does not supply an output where the original quotient was undefined.

Worked example 2 A canceled factor leaves an excluded input

Problem. Let a(x)=x2−64a(x)=x^2-64 and b(x)=x−8b(x)=x-8, both on all real inputs. Define Q=a/bQ=a/b.

Part A: Simplify Q(x)Q(x) and state its domain.

Part B: Find Q(2)Q(2).

Part C: Decide whether Q(8)Q(8) exists.

Solution. Part A: The denominator b(x)b(x) is zero at x=8x=8, so that input is excluded before we simplify. For the remaining inputs,

Q(x)=(x−8)(x+8)x−8.Q(x)=\frac{(x-8)(x+8)}{x-8}.

Canceling the nonzero factor gives Q(x)=x+8Q(x)=x+8 for x≠8x\ne8. Its domain is (−∞,8)∪(8,∞)(-\infty,8)\cup(8,\infty).

Part B: Input 22 is allowed, giving Q(2)=10Q(2)=10.

Part C: Input 88 is not allowed, because the original quotient would divide zero by zero. Thus Q(8)Q(8) does not exist.

Cancel the factor, keep the exclusionAll real inputs except 8 are allowed in the quotient. The open point at 8 remains after cancellation.5811Cancel the factor, keep the exclusion
Cancel the factor, keep the exclusion

The function H(x)=x+8H(x)=x+8 on all real inputs has an extra point at input 88. It agrees with QQ wherever QQ is defined, but they are different functions because their domains differ. This remains true when a simplification looks harmless, such as multiplying a partially defined function by zero.

Passing one output into another function

Arithmetic uses two outputs at the same input. Composition instead uses one output as the next input. If g(−2)=4g(-2)=4 and f(4)=13f(4)=13, then starting at −2-2, applying gg, and applying ff gives 1313.

We write this as

(f∘g)(−2)=f(g(−2))=13.(f\circ g)(-2)=f(g(-2))=13.

The general notation is (f∘g)(x)=f(g(x))(f\circ g)(x)=f(g(x)), read “f composed with g.” The inner function gg acts first. The symbol ∘\circ does not mean multiplication.

For example, let f(u)=3u+1f(u)=3u+1 and g(x)=x2g(x)=x^2, both on all real inputs. Replace the entire input of ff with x2x^2:

(f∘g)(x)=3x2+1.(f\circ g)(x)=3x^2+1.

In the other order, the whole output 3x+13x+1 becomes the input to the squaring rule:

(g∘f)(x)=(3x+1)2.(g\circ f)(x)=(3x+1)^2.

At input −2-2, the first order gives 1313, while the second gives 2525. Some particular pairs of functions do give the same composite in both orders, but there is no general permission to swap them.

For a table, perform the same two lookups: first find g(x)g(x) in the inner table, then look for that value as an input in the outer table. Do not read both tables at the original input.

Check your understanding

Given g(3)=7g(3)=7, f(7)=2f(7)=2, and f(3)=5f(3)=5, what is (f∘g)(3)(f\circ g)(3)?

Answer choices

Order and units belong to the model

Worked example 3 A fixed discount before or after tax

Problem. A pricing model uses a discount D(p)=p−12D(p)=p-12 dollars for an amount p≥12p\ge12 dollars and a tax rule T(p)=1.08pT(p)=1.08p dollars for p≥0p\ge0. Compare starting prices p≥12p\ge12, so both policies below are available. No other fees apply.

Part A: Write the price rule for discount first, then tax, and evaluate it for a starting price of 100100 dollars.

Part B: Write the price rule for tax first, then discount, and evaluate it at the same starting price.

Part C: State which policy is cheaper and by how much throughout the stated comparison domain.

Solution. Part A: Tax acts on the discounted amount, so it is the outer function:

T(D(p))=1.08(p−12).T(D(p))=1.08(p-12).

At p=100p=100, the discount leaves 8888 dollars and the tax gives 95.0495.04 dollars.

Part B: The discount acts on the taxed amount:

D(T(p))=1.08p−12.D(T(p))=1.08p-12.

At p=100p=100, tax gives 108108 dollars and the discount leaves 9696 dollars.

Two orders for the same starting priceThe first chain applies D to 100 dollars, giving 88 dollars, then T gives 95.04 dollars. The second applies T to 100 dollars, giving 108 dollars, then D gives 96 dollars.Discount, then tax100dollars88dollars95.04dollarsDTTax, then discount100dollars108dollars96dollarsTD
Two orders for the same starting price

Part C: The first rule is 1.08p−12.961.08p-12.96; the second is 1.08p−121.08p-12. Discount first is therefore cheaper by 0.960.96 dollars for every p≥12p\ge12. The tax is applied to a smaller amount in that policy.

Units also decide whether a proposed chain describes the intended process. Suppose L(t)=2tL(t)=2t gives liters of liquid after tt minutes, and M(v)=0.9vM(v)=0.9v gives the mass in kilograms of vv liters of that liquid. Use nonnegative times and volumes. Then M(L(t))M(L(t)) converts minutes to liters to kilograms.

The intermediate quantity connects the rulesTime t in minutes is sent to L, whose output L(t) is in liters. M accepts that volume and returns M(L(t)) in kilograms.Follow both the value and its unittminutesL(t)litersM(L(t))kilogramsLM
The intermediate quantity connects the rules

At three minutes, LL gives six liters, which MM converts to 5.45.4 kilograms. The reversed expression L(M(t))L(M(t)) does not describe this process: MM expects liters, not minutes, and LL expects minutes, not kilograms. Substituting numerical formulas alone would hide the mismatch.

Check your understanding

A model A(s)A(s) converts seconds to meters traveled, and B(d)B(d) converts meters traveled to energy used in joules. Which expression gives energy as a function of time?

Answer choices

Checking both stages of a composite domain

An input can pass the first rule and still fail the second. For h(x)=20−x2h(x)=\sqrt{20-x^2} and r(u)=1/ur(u)=1/u, input 22 passes through both stages:

Check the value passed to the reciprocalThe chain starts with input 2. The function h(x)=square root of 20 minus x squared sends 2 to 4. The reciprocal function r sends 4 to one fourth. At an input with h(x)=0, the second step would fail.An input accepted at both stages2input x4output h(2)1/4output r(4)hr
Check the value passed to the reciprocal

But if the square root gives zero, the reciprocal cannot use that output. The second check concerns h(x)h(x), not the original number xx.

Worked example 4 A square root inside a reciprocal

Problem. Let h(x)=20−x2h(x)=\sqrt{20-x^2} on its natural real domain, and let r(u)=1/ur(u)=1/u for u≠0u\ne0.

Part A: Write (r∘h)(x)(r\circ h)(x) and find its domain.

Part B: Determine whether input 00 is allowed, and explain how that is consistent with the domain of rr.

Solution. Part A: Substitute the root into the reciprocal:

(r∘h)(x)=120−x2.(r\circ h)(x)=\frac1{\sqrt{20-x^2}}.

The inner root needs 20−x2≥020-x^2\ge0. The outer reciprocal needs the root to be nonzero, so together the conditions require 20−x2>020-x^2>0. Equivalently,

x2<20.x^2<20.

This means −25<x<25-2\sqrt5<x<2\sqrt5, giving domain (−25,25)(-2\sqrt5,2\sqrt5).

Both endpoints are excludedThe domain is all real x strictly between negative 2 square root 5 and positive 2 square root 5. Both endpoints are open because the square root would be zero.−2√502√5Both endpoints are excluded
Both endpoints are excluded

Part B: Input 00 is allowed. The inner function sends it to 20\sqrt{20}, a nonzero number that rr accepts. The reciprocal never receives 00 in this calculation.

The domain rule follows the actual sequence. For f∘gf\circ g, first require x∈Dgx\in D_g. Then require g(x)∈Dfg(x)\in D_f. In set notation,

Df∘g={x∈Dg:g(x)∈Df}.D_{f\circ g}=\{x\in D_g:g(x)\in D_f\}.

Read this as the inputs accepted by gg whose outputs are accepted by ff. Intersecting DfD_f and DgD_g would test the same original input against both functions, which is the rule for arithmetic combinations, not composition. Keep any declared restrictions even when the composite formula simplifies.

Check your understanding

Let f(u)=9−uf(u)=\sqrt{9-u} and g(x)=2x+1g(x)=2x+1, each on its natural real domain. What is the domain of f∘gf\circ g?

Answer choices

Splitting a formula into stages

To decompose a function is to write it as a composition of simpler functions. Choose an intermediate quantity, name the rule that produces it, and describe what is done to it next. Then substitute back and check the domain.

Worked example 5 Two useful ways to split one rule

Problem. The function H(x)=1/(x2+2)H(x)=1/(x^2+2) has domain R\mathbb R.

Part A: Write H=f∘gH=f\circ g with g(x)=x2+2g(x)=x^2+2. State a rule and domain for ff, then verify the composite domain.

Part B: Give a different decomposition using k(x)=x2k(x)=x^2. Verify that it produces the same function on all real inputs.

Solution. Part A: After forming x2+2x^2+2, take its reciprocal. Choose f(u)=1/uf(u)=1/u for u≠0u\ne0. Then

f(g(x))=1x2+2.f(g(x))=\frac1{x^2+2}.

The inner output is at least 22, so it never reaches the forbidden input 00. Every real xx survives both stages.

Part B: After forming x2x^2, add 22 and take the reciprocal. Choose j(u)=1/(u+2)j(u)=1/(u+2) for u≠−2u\ne-2. Then

j(k(x))=1x2+2.j(k(x))=\frac1{x^2+2}.

Since k(x)≥0k(x)\ge0, it never reaches −2-2. This composite also has domain R\mathbb R. The decompositions differ, but both reproduce the formula and the original domain.

Check your understanding

To write H(x)=7+2xH(x)=\sqrt{7+2x} as f(g(x))f(g(x)) using g(x)=7+2xg(x)=7+2x, which outer rule works?

Answer choices

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems Start →
More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (optional)

Arthur Cayley spent fourteen years working as a lawyer while continuing to publish mathematics. During that period he produced about 250 mathematical papers. One, published in 1854, explored an unusual kind of algebra: its symbols could stand for operations, such as rearranging objects, rather than ordinary numbers.

Writing two operation symbols together meant performing one operation after the other. Cayley carefully specified the order and noted that reversing it could change the result. His paper helped begin the study of abstract groups, although it attracted little attention at first. In 1863, he left law to become a professor of pure mathematics at Cambridge, accepting a substantial drop in income to make mathematics his profession.

Source: Janet Heine Barnett’s historical study, including Cayley’s original text, especially pages 48 to 50.

Your progress

See all your progress →