Composing Piecewise Functions I was wondering how to compose piecewise functions.
On a practice exam I was reading, a question asks what F(F(x)) will look like if F(x)= 2x if x<1/2 and = 2-2x if x>=1/2.
Would I just substitute the original parts into themselves? (like 2(2x)=4x and 2-2(2-2x)=4x-2?) On the solution to the question, there are 4 intervals instead of 2 for F(F(x)). How would I go about getting those intervals, since the method I listed only gives 2 intervals?
Thanks.
 A: Our function F is given as:
$F(x)=\left\{\begin{matrix} 2x & x<1/2 \\ 2-2x & x \ge 1/2 \end{matrix}\right.$
So for inputs on both sides of the breakpoint $x=1/2$, it gives outputs in the range $\left(-\infty,1\right]$. Which means that when you compose it with itself, you have to consider four possible events:


*

*$x<1/2$ and $F(x)<1/2$

*$x<1/2$ and $F(x) \ge 1/2$

*$x \ge 1/2$ and $F(x)<1/2$

*$x \ge 1/2$ and $F(x) \ge 1/2$


Because in cases 1 and 3, the second time you plug it into the function you need to remember to double the value, while in cases 2 and 4 you have to double and then subtract the result from 2. The important thing to consider is whether all four cases exist - and from the preceding paragraph, we know that this is true.
So, let's see what happens in each case (and how we get to them):


*

*If $x<1/2$, then $F(x)=2x$ and so $F(x)<1/2\implies 2x<1/2 \implies x<1/4$. The intersection of those two is just $x<1/4$, so in this range $F(F(x))=2\times F(x)=2\times(2x)=4x$.

*Again, $x<1/2\implies F(x)=2x$, so $F(x)\ge 1/2 \implies x \ge 1/4$, so in the end we have $1/4 \le x < 1/2$. In this range, $F(F(x))=2-2\times F(x)=2-2\times 2x=2-4x$.

*This time, $x \ge 1/2 \implies F(x) = 2-2x$, so $F(x) < 1/2 \implies 2-2x < 1/2 \implies x > 3/4$. And in this range, $F(F(x))=2\times F(x) = 2(2-2x) = 4-4x$.


I'll leave case #4 for you as an exercise.
EDIT: To show it with some actual numbers.
$x = -1$: Clearly $x < 1/2$, so $F(x) = F(-1) = 2 \times -1 = -2$. So when we calculate $F(F(x))$, we want to take that value we just calculated and put it back in the function. So where does $F(x)$ lie? Clearly it's still less than 1/2, so $F(F(x)) = F(-2) = 2 \times -2 = -4$.
$x = 3/8$: We are still in $x < 1/2$ territory here, so $F(x) = F(3/8) = 2 \times 3/8 = 3/4$. Now when we feed that back into F, what range are we in? $3/4 \ge 1/2$, so this time $F(F(x)) = F(3/4) = 2 - 2 \times 3/4 = 1/2$.
$x = 1$: Here $x \ge 1/2$, so $F(x) = F(1) = 2 - 2 \times 1 = 0$. But since $F(x) = 0 < 1/2$, $F(F(x)) = F(0) = 2 \times 0 = 0$.
$x = 5/8$: Again $x \ge 1/2$, so $F(x) = F(5/8) = 2 - 2 \times 5/8 = 3/4$. So in this case $F(x) > 1/2$, so we have to again feed it in as $F(F(x)) = F(3/4) = 2 - 2 \times 3/4 = 1/2$.
To look at it another way, think of it as $F(F(x)) = F(y)$ where $y = F(x)$. Then ask yourself - how does $F(y)$ behave depending on the value of $y$? How does the value of $x$ affect the value of $y$? How do those two facts interact?
