How to find the composition of case-defined functions?

620 Views Asked by At

Let $$g(x)= \begin{cases} 3+x & \text{if $x\leq0$} \\ 3-x &\text{if $x > 0$} \end{cases}$$

Find $f$ if $f$ is defined as $f(x) = g(g(x))$. How to solve the problem analytically? I can calculate specific values of $f$, but don't know how to obtain a general formula for it.

2

There are 2 best solutions below

0
On

Note that $$f(x) = g(g(x)) = \begin{cases} 3+g(x) & \text{if }g(x) \leq 0\\ 3-g(x) & \text{if }g(x) > 0 \end{cases}$$ Now $g(x) \leq 0$, when $x \leq -3$ or $x \geq 3$ and $g(x) > 0$ when $x \in (-3,3)$. Hence, $$f(x) = g(g(x)) = \begin{cases} 3+(3+x) = x+6& x \leq -3\\ 3-(3+x) = -x & x \in (-3,0]\\ 3- (3-x) = x& x \in (0,3)\\ 3+(3-x) = -x+6& x \geq 3 \end{cases}$$

0
On

$$g(x)=3-|x|$$ so $$g(g(x))=3-|3-|x||$$