A piecewise function is one that has different operations, depending on the values of the input
The piecewise function is;
![g(x) = \begin{cases} -\left | x + 2 \right |&\mathbf{ \text{ if } -5 \leq x < 0 }\\ 2 \cdot x - 2 &\mathbf{ \text{ if } 0 < x \leq 2}\\ 2 &\mathbf{ \text{ if } 2 \leq x \leq 5}\end{cases}](/tpl/images/1409/0587/809b3.png)
Reason:
The general form of the absolute value function is presented as follows;
![f(x) = \mathbf{a \left | x - h \right | + k}](/tpl/images/1409/0587/bcd7c.png)
The function given in the graph are;
Domain; -5 ≤ x < 0
Function; ![g(x) = -\left | x + 2 \right |](/tpl/images/1409/0587/7c848.png)
Domain; 0 < x ≤ 2
Points on the graph are;
(0, -2), and (2, 2)
Slope = (2 - (-2))/(2 - 0) = 2
g(x) - (-2) = 2·(x - 0)
∴ Function; g(x) = 2·x - 2
Domain; 2 ≤ x ≤ 5
Function; g(x) = 2
Therefore, we have the following piecewise function;
![g(x) = \mathbf{ \begin{cases} -\left | x + 2 \right |& \text{ if } -5 \leq x < 0 \\ 2 \cdot x - 2 & \text{ if } 0 < x \leq 2\\ 2 & \text{ if } 2 \leq x \leq 5\end{cases}}](/tpl/images/1409/0587/a3c85.png)
Learn more about piecewise functions here: