Function transformations order I'm trying to understand the order in which to apply transformations to a function's graph. For example, given the following function $f(x)$: 

and wanting to get the graph of $f(1+|x|)$, should I first "translate" or should I first apply the modulus? That is: given $f(x)$, should I first draw $f(x+1)$ and then $f(|x| + 1)$ or should I draw $f(|x|)$ and then $f(|x|+1)$?
According to my textbook, we should first translate, then we have to apply the modulus to get the correct graph of $f(|x| + 1)$, which is:

Sorry for the axis values.
How do I determine the order of the transformations to perform (even in more complex cases)?
Thank you!
 A: A method that often works is to consider the graph of the function exactly as what it is: A set of points in the plane.


*

*Write down the wanted graph


\begin{align*}
G = \{ (x, f(1+|x|)) \mid x\in\mathbb{R} \}\subset\mathbb{R}^2
\end{align*}


*Parametrize the set with the argument of the function:


\begin{align*}
G &= \{ ( x, f(\bar x) ) \mid x\in\mathbb{R}: \bar x = 1 + |x| \}
\end{align*}


*Extract geometrical operations like translation and reflection -- maybe for pieces of the graph:


\begin{align*}
G &= \{ ( x, f(\bar x) ) \mid (x \geq 0 \wedge \bar x = 1 + x)\; \vee\; (x < 0 \wedge \bar x = 1 - x) \}\\
 &= \{ ( x, f(\bar x) ) \mid x \geq 0 \wedge \bar x = 1 + x \} \cup \{ ( x, f(\bar x) ) \mid x < 0 \wedge \bar x = 1 - x \}
\end{align*}
Shift these operations back into the points such that you can apply them to the set:
\begin{align*}
 G&= \{ ( \bar x-1, f(\bar x) ) \mid \bar x \geq 1 \} \cup \{ ( 1-\bar x, f(\bar x) ) \mid \bar x > 1 \}\\
 G&= \left[(-1,0) + f_{\geq 1}\right] \cup \left[(1,0) + \begin{pmatrix}-1&0\\0&1\end{pmatrix} f_{>1}\right]
\end{align*}
With $S$ beeing some subset of the domain of $f$ we use in the last line the symbol $f_S:= \{(x,f(x))\mid x\in S\}$.
There follows a sloppy interpretation of the last equation for $G$:
1. Part on the left-hand side of $\cup$:
1.1. take the part with $x\geq 1$ of the graph of $f$
1.2. translate it by the vector $(-1,0)$ (i.e., in $x$ -direction)
2. Part on the right-hand side of $\cup$:
2.1. take the part of $f$ with $x>1$
2.2. reflect it at the line $x=0$ in $x$-direction; (projection onto the $x$-axis is $(-\infty,-1)$)
2.3. translate it by the vector $(1,0)$
3. put these two partial graphs together into one diagram
