# Function composition, tell me if it's right please

I have to do the function composition $f \circ f$

$$f(x)= \left\{ \begin{array}{c} 2 \quad\text{if} \;x=1\\ x-1 \quad \text{if}\; x>1\\ \end{array} \right.$$

$$f(f(x))= \left\{ \begin{array}{c} 2 \quad\text{if}\; x=1\\ x-2 \quad\text{if}\; x>1\\ \end{array} \right.$$

Is it right?

• Can you clarify your notation further? What is $f$ in your piecewise definition? What about $i$? Jan 8, 2018 at 16:34
• Looking at x = 1 it certainly doesn't look right... when x = 1 f(x) = 2 so f(f(x)) = f(2) = 1... Jan 8, 2018 at 16:38

$f(f(x))$ is $$f(f(x))= \left\{ \begin{array}{c} 2 \quad\text{if} \;f(x)=1\\ f(x)-1 \quad \text{if}\; f(x)>1\\ \end{array} \right.$$ but $f(x)=1 \iff x=2$, and $f(x)>1 \iff (x>2 \text{ or } x=1)$. Therefore, $$f(f(x))= \left\{ \begin{array}{c} 2 \quad\text{if} \;x=2\\ f(x)-1 \quad \text{if}\; x>2 \text{ or } x=1\\ \end{array} \right. = \left\{ \begin{array}{c} 2 \quad\text{if} \;x=2\\ x-2 \quad \text{if}\; x>2\\ 1 \quad \text{if}\; x=1\\ \end{array} \right.$$
When $x=1$, $f(x)=f(1)=2$ so at this $x$, $$f(f(x))=f(f(1))=f(2)=2-1=1$$ instead of $2$.
When $x>1$, $f(x)=x-1$ so at such $x$, $$f(f(x))=f(x-1)=\left\{ \begin{array}{c} 2 \quad\text{if} \;x-1=1\implies x=2\\ x-1-1 \quad \text{if}\; x-1>1 \implies x>2\\ \end{array} \right.$$ Hence, $$f(f(x))=\left\{ \begin{array}{c} 1 \quad\text{if} \;x=1\\ 2\quad\text{if}\; x=2\\ x-2 \quad \text{if}\; x>2\\ \end{array} \right.$$