Let $f,g:\mathbb{R}\rightarrow\mathbb{R}$ be functions given by
$$f(x)=(x-1)^2 \quad \text{and}\quad g(y) \ \begin{cases}0,\qquad
\qquad y<0\\\sqrt{y}+1\quad\quad y\geq 0.\end{cases}
$$
Show that $g\circ f = \mathfrak{i}_\mathbb{R}$ where $\mathfrak{i}_\mathbb{R}$ is the identity function on $\mathbb{R}$.
Determine $f\circ g$.
I tried doing the first part and seem to not be getting it...
Suppose $x\geq 1$. Then $f(x)\geq 0$.
We have $g(f(x)) = \sqrt{(x-1)^2} + 1 = |x-1| + 1 = x-1+1 = x$
Now suppose $x<1$. Then $f(x)\geq 0$ and so
$g(f(x)) = \sqrt{(x-1)^2}+1 = |x-1|+1 = 1-x + 1 = 2-x$
I don't see how this is the identity function.
Also, I see that the range of $g$ is $[1,\infty]\cup\{0\}$.
You are right, the question is wrong.
$$g(f(0)) = g(1)=\sqrt{1}+1=2 \neq 0.$$
As for $f \circ g$, just consider $y<0$ and $y \geq 0$ and evaluate separately.