Skip to main content

Function Composition

Assume that we have a function that defines the relationship between aa and bb and another function that expresses the relationship between bb and cc. We can use function composition to create a brand new function using these functions to express a relationship between aa and cc. This is one of the main ways to combine functions together.

Algebraic Operations

Besides function composition, we can combine functions using algebraic operations. Given the functions f(x)f(x) and g(x)g(x), we can combine them using these operations...

  1. (f+g)(x)=f(x)+g(x)(f + g)(x) = f(x) + g(x)
  2. (fg)(x)=f(x)g(x)(f - g)(x) = f(x) - g(x)
  3. (fg)(x)=f(x)g(x)(fg)(x) = f(x)g(x)
  4. (fg)(x)=f(x)g(x)whereg(x)0(\frac{f}{g})(x) = \frac{f(x)}{g(x)} \:\text{where}\: g(x) \neq 0

An example of combining function using algebraic operation includes...

Example\underline{Example}

Let f(x)=x1f(x) = x - 1 and g(x)=x21g(x) = x^2 - 1, find (fg)(x)(f - g)(x).

(fg)(x)=f(x)g(x)(f - g)(x) = f(x) - g(x)

(fg)(x)=(x1)(x21)(f - g)(x) = (x - 1) - (x^2 - 1)

(fg)(x)=x1x2+1(f - g)(x) = x - 1 - x^2 + 1

(fg)(x)=x2+x(f - g)(x) = -x^2 + x

Composition of Functions

As discussed before, another way to combine functions is through function composition. Given the functions f(x)f(x) and g(x)g(x), the function composition is (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)). The left side of the equation is read as ff composed with gg at xx, and the right side of the equation is read as ff of gg of xx.

The way (fg)(x)(f \circ g)(x) works is that the xx is the input of gg and the output of gg becomes the input of ff. So, to evaluate (fg)(x)(f \circ g)(x) for a specific value of xx, we substitute the value into g(x)g(x) and solve for g(x)g(x). After this we substitute the resulting value of g(x)g(x) into f(x)f(x) and solve for f(x)f(x). This is the solution for (fg)(x)(f \circ g)(x).

On the other hand, to evaluate (fg)(x)(f \circ g)(x) for all values of xx we substitute the expression for g(x)g(x) into f(x)f(x) and simplify.

Example\underline{Example}

Let f(x)=3x+1f(x) = 3x + 1 and g(x)=3xg(x) = 3 - x, find f(g(x))f(g(x)) and g(f(x))g(f(x)).

f(g(x))=2(g(x))+1=2(3x)+1=62x+1=2x+7f(g(x)) = 2(g(x)) + 1 = 2(3 - x) + 1 = 6 - 2x + 1 = -2x + 7

g(f(x))=3(f(x))=3(2x+1)=32x1=2x+2g(f(x)) = 3 - (f(x)) = 3 - (2x + 1) = 3 - 2x - 1 = -2x + 2

(fg)(x)=2x+7(f \circ g)(x) = -2x + 7 and (gf)(x)=2x+2(g \circ f)(x) = -2x + 2

Domain

The domain of f(g(x))f(g(x)) is the set of inputs xx in the domain of gg for which g(x)g(x) is in the domain of ff.

To determine the domain of f(g(x))f(g(x)), we first find the domain of gg and ff. We then exclude any inputs of xx for which g(x)g(x) is not in the domain of ff. The remaining domain of gg is the domain of the entire composition.

Example\underline{Example}

Find the domain of (fg)(x)(f \circ g)(x) where f(x)=5x1f(x) = \frac{5}{x - 1} and g(x)=43x2g(x) = \frac{4}{3x - 2}.

The domain of g(x)g(x) is all real numbers except for when 3x2=03x - 2 = 0 which is x=23x = \frac{2}{3}.

The domain of f(x)f(x) is all real numbers except for when x1=0x - 1 = 0 which is x=1x = 1.

We need to find out when g(x)=1g(x) = 1 and exclude it from the domain.

43x2=14=3x26=3xx=2\frac{4}{3x - 2} = 1 \to 4 = 3x - 2 \to 6 = 3x \to x = 2

This means our domain is all real numbers excluding x=23,2x = \frac{2}{3}, 2. In other words, (,23)(23,2)(2,)(-\infty, \frac{2}{3}) \cup (\frac{2}{3}, 2) \cup (2, \infty).

Decomposition

In some cases, we can decompose a complicated function into a composition of two simpler functions. Note that there are various compositions a function can have. An example of a decomposition is...

Example\underline{Example}

Write f(x)=434+x2f(x) = \frac{4}{3 - \sqrt{4 + x^2}} as the composition of two functions.

Let h(x)=4+x2h(x) = \sqrt{4 + x^2} and g(x)=43xg(x) = \frac{4}{3 - x}. Then f(x)=(gh)(x)=g(h(x))f(x) = (g \circ h)(x) = g(h(x)).