$$f(x) = \begin{cases} x-1 & x \geq 0 \\ 1-x & x <0 \end{cases}$$
$$g(x) = \begin{cases} x& x\geq 0 \\ x^2 & x < 0 \end{cases}$$
It asks me for the compositions $f(g(x))$.
What I did: it seemed easy to me, since
$$f(g(x)) = \begin{cases} x-1 & x \geq 0 \\ 1-x^2 & x < 0 \end{cases}$$
$$g(f(x)) = \begin{cases} x-1 & x \geq 0 \\ (1-x)^2 & x < 0 \end{cases}$$
Instead in the solution there is:
$$g(f(x)) = \begin{cases} 1-x & x < 0 \\ (x-1)^2 & 0 \leq x < 1 \\ x-1 & x \geq 1 \end{cases}$$
I don't get that solution. Some clarifications?
Hint. To see why your answer $$ (\color{red}{\times}) \qquad f(g(x)) = \begin{cases} x - 1 & \text{if } x \ge 0, \\ 1 - x^2 & \text{if } x < 0 \end{cases} $$ is incorrect, consider $f(g(-2))$. Clearly $$ g(-2) = (-2)^2 = 4, $$ so $$ f(g(-2)) = f(4) = 4 - 1 = 3. $$ However, your answer suggests that $$ (\color{red}{\times}) \qquad f(g(-2)) = 1 - (-2)^2 = -3. $$ Try to identify the mistake that caused this discrepancy. Then, use this understanding to fix your expressions for $f(g(x))$ and $g(f(x))$.
Here's an additional hint in case you cannot find the mistake.