Skip to content

Composite and inverse functions

A composite function applies one function and then another. An inverse function reverses the action of a one-to-one function. The two ideas are linked: if f1f^{-1} exists, composing it with ff returns the original input.

This lesson explains how to calculate composites, find inverses, choose valid domains and ranges, and avoid the notation errors that make these questions harder than they need to be.

You should be comfortable with:

The composite function fgfg means “apply gg first, then apply ff”:

fg(x)=f(g(x)).fg(x)=f(g(x)).

The function nearest to xx acts first. You can picture the input passing through two machines:

xg(x)f(g(x)).x\longmapsto g(x)\longmapsto f(g(x)).

Similarly,

gf(x)=g(f(x)),gf(x)=g(f(x)),

so ff acts first. In general,

fg(x)gf(x).fg(x)\ne gf(x).

Let

f(x)=3x2,g(x)=x2+1.f(x)=3x-2,\qquad g(x)=x^2+1.

To find fg(x)fg(x), substitute the whole expression g(x)=x2+1g(x)=x^2+1 wherever xx appears in ff:

fg(x)=f(g(x))=3(x2+1)2=3x2+1.\begin{aligned} fg(x)&=f(g(x))\\ &=3(x^2+1)-2\\ &=3x^2+1. \end{aligned}

For gf(x)gf(x), substitute f(x)=3x2f(x)=3x-2 into gg:

gf(x)=g(f(x))=(3x2)2+1=9x212x+5.\begin{aligned} gf(x)&=g(f(x))\\ &=(3x-2)^2+1\\ &=9x^2-12x+5. \end{aligned}

These expressions are different because changing the order changes the calculation.

Example 2: evaluating at a particular input

Section titled “Example 2: evaluating at a particular input”

Using the same functions, find fg(2)fg(2).

One method is to use the composite found above:

fg(2)=3(2)2+1=13.fg(2)=3(2)^2+1=13.

You can also work from the inside out:

g(2)=22+1=5,g(2)=2^2+1=5,

then

f(5)=3(5)2=13.f(5)=3(5)-2=13.

The second method is often safer when only one numerical value is required.

Let

f(x)=x+4,g(x)=x2,h(x)=1x.f(x)=x+4,\qquad g(x)=x^2,\qquad h(x)=\frac1x.

Find fgh(x)fgh(x). Read from right to left:

xh1xg1x2f1x2+4.x\xmapsto{h}\frac1x \xmapsto{g}\frac1{x^2} \xmapsto{f}\frac1{x^2}+4.

Therefore,

fgh(x)=1x2+4,x0.fgh(x)=\frac1{x^2}+4,\qquad x\ne0.

The restriction x0x\ne0 comes from h(x)=1/xh(x)=1/x. Simplifying a composite must not make you forget restrictions inherited from the original functions.

For fg(x)=f(g(x))fg(x)=f(g(x)) to be defined:

  1. xx must lie in the domain of gg.
  2. The output g(x)g(x) must lie in the domain of ff.

Let

f(x)=x,g(x)=2x6.f(x)=\sqrt{x},\qquad g(x)=2x-6.

Then

fg(x)=2x6.fg(x)=\sqrt{2x-6}.

For a real square root, its input must be non-negative:

2x60,2x-6\ge0,

so the domain is

x3.x\ge3.

In the reverse order,

gf(x)=2x6,gf(x)=2\sqrt{x}-6,

whose domain is x0x\ge0. Again, order matters.

Let

f(x)=1x2,g(x)=x+5.f(x)=\frac1{x-2},\qquad g(x)=x+5.

Then

fg(x)=1x+3.fg(x)=\frac1{x+3}.

The denominator cannot be zero, so x3x\ne-3. Equivalently, g(x)g(x) cannot equal 22, since 22 is excluded from the domain of ff.

An inverse function undoes the original function. If

f(4)=11,f(4)=11,

then

f1(11)=4.f^{-1}(11)=4.

The symbol f1f^{-1} does not mean the reciprocal 1/f1/f. These are different objects:

f1(x)1f(x).f^{-1}(x)\ne\frac1{f(x)}.

For example, if f(x)=2x+3f(x)=2x+3, then its inverse is (x3)/2(x-3)/2, while its reciprocal is 1/(2x+3)1/(2x+3).

Where both compositions are defined,

f1f(x)=xf^{-1}f(x)=x

and

ff1(x)=x.ff^{-1}(x)=x.

The first composition applies ff and then undoes it. The second applies the inverse and then reverses that operation with ff.

Use this reliable procedure:

  1. Write y=f(x)y=f(x).
  2. Rearrange the equation to make xx the subject.
  3. Replace yy by xx and write the result as f1(x)f^{-1}(x).
  4. State the domain of the inverse when it is relevant.

Let

f(x)=5x7.f(x)=5x-7.

Start with

y=5x7.y=5x-7.

Rearrange for xx:

y+7=5x,y+7=5x,

x=y+75.x=\frac{y+7}{5}.

Therefore,

f1(x)=x+75.f^{-1}(x)=\frac{x+7}{5}.

Check by composition:

f(f1(x))=5(x+75)7=x.f\left(f^{-1}(x)\right) =5\left(\frac{x+7}{5}\right)-7 =x.

This check catches most rearrangement errors.

Example 7: inverse of a fractional function

Section titled “Example 7: inverse of a fractional function”

Let

f(x)=3x+1x2,x2.f(x)=\frac{3x+1}{x-2},\qquad x\ne2.

Write

y=3x+1x2.y=\frac{3x+1}{x-2}.

Multiply both sides by x2x-2:

y(x2)=3x+1.y(x-2)=3x+1.

Collect the terms containing xx:

yx2y=3x+1,yx-2y=3x+1,

yx3x=2y+1,yx-3x=2y+1,

x(y3)=2y+1.x(y-3)=2y+1.

Hence

x=2y+1y3,x=\frac{2y+1}{y-3},

so

f1(x)=2x+1x3,x3.f^{-1}(x)=\frac{2x+1}{x-3},\qquad x\ne3.

The inverse excludes 33 because 33 is not in the range of the original function. Notice that the domain and range swap:

domain(f1)=range(f),range(f1)=domain(f).\operatorname{domain}(f^{-1})=\operatorname{range}(f), \qquad \operatorname{range}(f^{-1})=\operatorname{domain}(f).

A function has an inverse function only if it is one-to-one on its stated domain. This means that every output comes from exactly one input.

The horizontal line test gives a graphical check. If any horizontal line crosses the graph more than once, the function is not one-to-one and has no inverse on that domain.

For example, f(x)=x2f(x)=x^2 on all real numbers has no inverse function because

f(2)=f(2)=4.f(2)=f(-2)=4.

The proposed inverse x\sqrt{x} could not know whether to return 22 or 2-2.

We can make f(x)=x2f(x)=x^2 invertible by restricting its domain.

If

f(x)=x2,x0,f(x)=x^2,\qquad x\ge0,

then

f1(x)=x,x0.f^{-1}(x)=\sqrt{x},\qquad x\ge0.

If instead

f(x)=x2,x0,f(x)=x^2,\qquad x\le0,

then

f1(x)=x,x0.f^{-1}(x)=-\sqrt{x},\qquad x\ge0.

The same formula for ff therefore produces different inverses on different restricted domains.

Example 8: inverse of a restricted quadratic

Section titled “Example 8: inverse of a restricted quadratic”

Let

f(x)=(x3)2+5,x3.f(x)=(x-3)^2+5,\qquad x\ge3.

Find f1f^{-1}.

Begin with

y=(x3)2+5.y=(x-3)^2+5.

Then

y5=(x3)2.y-5=(x-3)^2.

Because the original domain says x3x\ge3, we know x30x-3\ge0. We therefore take the positive square root:

x3=y5,x-3=\sqrt{y-5},

x=3+y5.x=3+\sqrt{y-5}.

Thus

f1(x)=3+x5,x5.f^{-1}(x)=3+\sqrt{x-5},\qquad x\ge5.

The inverse domain x5x\ge5 is the range of ff.

If the original restriction had been x3x\le3, the inverse would instead be

f1(x)=3x5.f^{-1}(x)=3-\sqrt{x-5}.

The points on a function and its inverse have their coordinates exchanged:

f(a)=bf1(b)=a.f(a)=b\quad\Longleftrightarrow\quad f^{-1}(b)=a.

So if (a,b)(a,b) lies on y=f(x)y=f(x), then (b,a)(b,a) lies on y=f1(x)y=f^{-1}(x). Exchanging coordinates reflects a graph in the line

y=x.y=x.

This explains why the domain and range swap. It also provides a visual check: the graphs of a function and its inverse should be mirror images in y=xy=x. See transformations of graphs for related graph techniques.

Solving equations using composites and inverses

Section titled “Solving equations using composites and inverses”

Let

f(x)=2x+1,g(x)=x24.f(x)=2x+1,\qquad g(x)=x^2-4.

Solve fg(x)=19fg(x)=19.

First form the composite:

fg(x)=f(x24)=2(x24)+1=2x27.fg(x)=f(x^2-4)=2(x^2-4)+1=2x^2-7.

Now solve:

2x27=19,2x^2-7=19,

2x2=26,2x^2=26,

x2=13,x^2=13,

x=±13.x=\pm\sqrt{13}.

Both answers are valid unless the domain has been restricted.

Example 10: use an inverse to solve an equation

Section titled “Example 10: use an inverse to solve an equation”

Let f(x)=x3+4f(x)=x^3+4. Solve f(x)=31f(x)=31.

The inverse is

f1(x)=x43.f^{-1}(x)=\sqrt[3]{x-4}.

Apply f1f^{-1} to both sides:

x=f1(31)=3143=3.x=f^{-1}(31)=\sqrt[3]{31-4}=3.

This is the function version of performing inverse operations on an equation.

Suppose

f(x)=2x5f(x)=2x-5

and

fg(x)=6x+7.fg(x)=6x+7.

Find g(x)g(x).

Since fg(x)=f(g(x))fg(x)=f(g(x)), applying ff to g(x)g(x) gives

2g(x)5=6x+7.2g(x)-5=6x+7.

Therefore,

2g(x)=6x+12,2g(x)=6x+12,

so

g(x)=3x+6.g(x)=3x+6.

Alternatively, apply f1f^{-1} to the composite:

g(x)=f1(6x+7)=(6x+7)+52=3x+6.g(x)=f^{-1}(6x+7)=\frac{(6x+7)+5}{2}=3x+6.

  • Reading fg(x)fg(x) from left to right. The inside function acts first, so fg(x)=f(g(x))fg(x)=f(g(x)).
  • Treating f1(x)f^{-1}(x) as 1/f(x)1/f(x). An inverse reverses a function; a reciprocal divides 11 by its output.
  • Replacing only part of an expression. When substituting g(x)g(x) into ff, use brackets around the entire expression before simplifying.
  • Assuming every function has an inverse. A function must be one-to-one on its stated domain.
  • Writing ±\pm automatically when inverting a quadratic. The domain restriction determines which square-root branch is valid.
  • Forgetting domains after simplifying. Restrictions from denominators, roots and the original function still apply.
  • Checking only ff1(x)ff^{-1}(x). When domains are delicate, check both ff1(x)ff^{-1}(x) and f1f(x)f^{-1}f(x) on their appropriate domains.

Given

f(x)=x3,g(x)=2x2,f(x)=x-3,\qquad g(x)=2x^2,

find fg(x)fg(x) and gf(x)gf(x).

Answer

fg(x)=f(2x2)=2x23.fg(x)=f(2x^2)=2x^2-3.

gf(x)=g(x3)=2(x3)2=2x212x+18.gf(x)=g(x-3)=2(x-3)^2=2x^2-12x+18.

Find the inverse of

f(x)=x+43.f(x)=\frac{x+4}{3}.

Answer

From y=(x+4)/3y=(x+4)/3,

3y=x+4x=3y4.3y=x+4\quad\Longrightarrow\quad x=3y-4.

Therefore,

f1(x)=3x4.f^{-1}(x)=3x-4.

The function

f(x)=x26x+11f(x)=x^2-6x+11

has domain x3x\ge3. Find f1(x)f^{-1}(x) and state its domain.

Answer

Complete the square:

f(x)=(x3)2+2.f(x)=(x-3)^2+2.

Since x3x\ge3, take the positive square root when reversing the function:

y=(x3)2+2,y=(x-3)^2+2,

x=3+y2.x=3+\sqrt{y-2}.

Hence

f1(x)=3+x2,x2.f^{-1}(x)=3+\sqrt{x-2},\qquad x\ge2.

Let

f(x)=1x,g(x)=x4.f(x)=\frac1x,\qquad g(x)=x-4.

Find fg(x)fg(x) and state its domain.

Answer

fg(x)=f(x4)=1x4.fg(x)=f(x-4)=\frac1{x-4}.

The input to ff cannot be zero, so x40x-4\ne0. The domain is therefore x4x\ne4.

Composite and inverse functions support later work with function transformations, exponential functions, and inverse trigonometric functions. Before moving on, make sure you can explain why composition order matters and why a domain restriction may be necessary before an inverse exists.