# Composition of Functions

In addition to adding, subtracting, multplying and dividing, two functions can be composed. The composition of a function is when the x-value is replaced by a function. For example if p(x) = x3 and q(x) = x - 1, the compostition of p with q is:

$p\circ q=p\left(q\left(x\right)\right)=p\left(x-1\right)={\left(x-1\right)}^{3}$

The notation $p\circ q$, reads "p composed with q". Which means that the value of x is replaced by q(x) in function p.

THE DEFINITION OF COMPOSITION OF FUNCTIONS

The composition of the function p is

$\left(p\circ q\right)\left(x\right)=p\left(q\left(x\right)\right)$

where the domain of $p\circ q$ is the set of all x in the domain of q such that q(x) is in the domain of p.

Let's look at a couple examples.

Example 1: Given p(x) = x2 - 1 and q(x) = x + 3 find the composite function and its domain of $\left(p\circ q\right)\left(x\right)$ and $\left(q\circ p\right)\left(x\right)$. Then evaluate $\left(p\circ q\right)\left(3\right)$.
 Step 1: Find $\left(p\circ q\right)\left(x\right)$ and its domain. $\left(p\circ q\right)\left(x\right)=p\left(q\left(x\right)\right)$ Def'n of compos. $p\left(x+3\right)={\left(x+3\right)}^{2}-1$  Sub. q(x) $\left(p\circ q\right)={x}^{2}+6x+9-1$ Simplify $\left(p\circ q\right)={x}^{2}+6x+8$ The domain of p(x) = x2 - 1 is the set of all real numbers. The domain of q(x) = x + 3 is the set of all real numbers. Therefore the domain of $\left(p\circ q\right)$ is the set of all real numbers. Step 2: Find $\left(q\circ p\right)\left(x\right)$ and its domain. $\left(q\circ p\right)\left(x\right)=q\left(p\left(x\right)\right)$ Def'n of compos. $q\left({x}^{2}-1\right)=\left({x}^{2}-1\right)+3$ Sub. p(x) $\left(q\circ p\right)={x}^{2}+2$  Simplify The domain of q(x) = x + 3 is the set of all real numbers. The domain of p(x) = x2 - 1 is the set of all real numbers. Therefore the domain of $\left(q\circ p\right)$ is the set of all real numbers. Step 3: Evaluate $\left(p\circ q\right)\left(x\right)$ when x = 3. $\left(p\circ q\right)\left(x\right)={x}^{2}+6x+8$ $\left(p\circ q\right)\left(3\right)={3}^{2}+6\left(3\right)+8=35$
Example 2: Given $p\left(x\right)=\sqrt{4x}$ and q(x) = x2 find the composite function and its domain of $\left(p\circ q\right)\left(x\right)$ and $\left(q\circ p\right)\left(x\right)$. Then evaluate $\left(p\circ q\right)\left(-5\right)$.
 Step 1: Find $\left(p\circ q\right)\left(x\right)$ and its domain. $\left(p\circ q\right)\left(x\right)=p\left(q\left(x\right)\right)$ Def'n of compos. $p\left({x}^{2}\right)=\sqrt{4{x}^{2}}$     Sub. q(x) $\left(p\circ q\right)=2x$ Simplify The domain of $p\left(x\right)=\sqrt{4x}$ is the set of all real numbers such that $x\ge 0$. The domain of q(x) = x2 is the set of all real numbers. Therefore the domain of $\left(p\circ q\right)$ is the set of all real numbers such that $x\ge 0$. Step 2: Find $\left(q\circ p\right)\left(x\right)$ and its domain. $\left(q\circ p\right)\left(x\right)=q\left(p\left(x\right)\right)$   Def'n of compos. $q\left(\sqrt{4x}\right)={\left(\sqrt{4x}\right)}^{2}$     Sub. p(x) $\left(q\circ p\right)=4x$   Simplify The domain of q(x) = x2 is the set of all real numbers. The domain of $p\left(x\right)=\sqrt{4x}$ is the set of all real numbers such that $x\ge 0$. Therefore the domain of $\left(p\circ q\right)$ is the set of all real numbers such that $x\ge 0$. Step 3: Evaluate $\left(q\circ p\right)\left(x\right)$ when x = -5. $\left(p\circ q\right)\left(x\right)=4x$ $\left(p\circ q\right)\left(-5\right)=4\left(-5\right)=-20$

 Related Links: Math algebra Extreme Value Theorem Even and Odd Functions Calculus Topics

To link to this Composition of Functions page, copy the following code to your site: