# Composite Functions

### (How to find the expression of a composite function)

Put simply, a composite function is a function of a function.
The idea is to place a function inside another function. To do this we replace every $$x$$ we see inside a function by another function.

Given two functions $$f(x)$$ and $$g(x)$$ we can make two (usually different) composite functions: $f\begin{bmatrix}g(x)\end{bmatrix} \quad \text{and}\quad g\begin{bmatrix}f(x)\end{bmatrix}$ The first of the two is read "$$f$$ of $$g$$ of $$x$$" and the second "$$g$$ of $$f$$ of $$x$$". We'll often see these written in the alternative notation: $\begin{pmatrix}f \circ g \end{pmatrix}(x) \quad \text{and} \quad \begin{pmatrix}g \circ f \end{pmatrix}(x)$ Note: either of the two notations refer to the same thing, meaning: $f\begin{bmatrix}g(x)\end{bmatrix} = \begin{pmatrix}f \circ g \end{pmatrix}(x)$

## How to build the expression for a composite function

Given two functions, $$f(x)$$ and $$g(x)$$, we construct the composite function: $f\begin{bmatrix}g(x)\end{bmatrix}$ By replacing every $$x$$, in the expression for $$f(x)$$ by the entire function $$g(x)$$.

Similarly, to construct: $g\begin{bmatrix}f(x)\end{bmatrix}$ replace every $$x$$, in the expression for $$g(x)$$ by the entire function $$f(x)$$.

The method we've just read is illustrated in the following tutorial, watch it now.

## Tutorial

In the following tutorial we learn what a composite function is as well as how to contruct a composite function, given two functions $$f(x)$$ and $$g(x)$$.

Although it was mentionned in the tutorial we've just seen, it's worth making a note of the following important result.

## Important Result

Given two functions $$f(x)$$ and $$g(x)$$ it is important to know that in general: $f\begin{bmatrix}g(x) \end{bmatrix} \neq g\begin{bmatrix}f(x) \end{bmatrix}$ Note: it is possible for the two composite functions to be equal, but most of the time they won't be.

## Example

Given the functions $$f(x)$$ and $$g(x)$$ defined as: $f(x) = 2x-7$

and
$g(x) = x^2-1$ Find an expression for:
1. the composite function $$f\begin{bmatrix}g(x)\end{bmatrix}$$.
2. the composite function $$g\begin{bmatrix}f(x)\end{bmatrix}$$.

### Solution

1. We find $$f\begin{bmatrix}g(x)\end{bmatrix}$$ by replacing every $$x$$, in the expression of $$f(x)$$, by $$g(x)$$ that's: \begin{aligned} f\begin{bmatrix}g(x)\end{bmatrix} & = 2g(x) - 7 \\ & = 2\begin{pmatrix}x^2 - 1 \end{pmatrix} - 7 \\ & = 2x^2 - 2 - 7 \\ f\begin{bmatrix}g(x)\end{bmatrix} & = 2x^2 - 9 \end{aligned}
2. We find $$g\begin{bmatrix}f(x)\end{bmatrix}$$ by replacing every $$x$$, in the expression of $$g(x)$$, by $$f(x)$$ that's: \begin{aligned} g\begin{bmatrix}f(x)\end{bmatrix} & = \begin{pmatrix}f(x) \end{pmatrix}^2 - 1 \\ & = \begin{pmatrix} 2x- 7 \end{pmatrix}^2 - 1 \\ & = 4x^2 - 28x + 49 - 1 \\ g\begin{bmatrix}f(x)\end{bmatrix} & = 4x^2 - 28x +48 \end{aligned}

## Exercise 1

1. Given the functions $$f(x) = 3x+5$$ and $$g(x)=x^2+4$$, find an expression for:
1. the composite function $$f\begin{bmatrix}g(x)\end{bmatrix}$$
2. the composite function $$g\begin{bmatrix}f(x)\end{bmatrix}$$

2. Given the functions $$f(x) = \sqrt{x}$$ and $$g(x) = 3x - 9$$, find an expression for:
1. the composite function $$\begin{pmatrix}f \circ g \end{pmatrix}(x)$$
2. the composite function $$\begin{pmatrix}g \circ f \end{pmatrix}(x)$$

3. Given the functions $$f(x) = \frac{5}{x+2}$$ and $$g(x)=x^2+1$$, find an expression for:
1. the composite function $$f\begin{bmatrix}g(x)\end{bmatrix}$$
2. the composite function $$g\begin{bmatrix}f(x)\end{bmatrix}$$

4. Given the functions $$f(x) = 3x+5$$ and $$g(x)=-x^2+1$$, find an expression for:
1. the composite function $$f\begin{bmatrix}g(x)\end{bmatrix}$$
2. the composite function $$g\begin{bmatrix}f(x)\end{bmatrix}$$

5. Given the functions $$f(x) = \frac{3}{2x}$$ and $$g(x) = 4x + 5$$, find an expression for:
1. the composite function $$\begin{pmatrix}f \circ g \end{pmatrix}(x)$$
2. the composite function $$\begin{pmatrix}g \circ f \end{pmatrix}(x)$$

1. For $$f\begin{bmatrix}g(x)\end{bmatrix}$$, we find: $f\begin{bmatrix}g(x)\end{bmatrix} = 3x^2+17$
2. For $$g\begin{bmatrix}f(x)\end{bmatrix}$$, we find: $g\begin{bmatrix}f(x)\end{bmatrix} = 9x^2+30x + 29$
1. For $$\begin{pmatrix}f \circ g \end{pmatrix}(x)$$, we find: $\begin{pmatrix}f \circ g \end{pmatrix}(x) = \sqrt{3x-9}$
2. For $$\begin{pmatrix}g \circ f \end{pmatrix}(x)$$, we find: $\begin{pmatrix}g \circ f \end{pmatrix}(x) = 3\sqrt{x}-9$
1. For $$f\begin{bmatrix}g(x)\end{bmatrix}$$, we find: $f\begin{bmatrix}g(x)\end{bmatrix} = \frac{5}{x^2+3}$
2. For $$g\begin{bmatrix}f(x)\end{bmatrix}$$, we find: $g\begin{bmatrix}f(x)\end{bmatrix} = \frac{x^2+4x+29}{x^2+4x+4}$