Composition of two functions is constant
Solution 1:
NO.
$$f(x) = \begin{cases} 1 & x \geq 0 \\ 0 & x < 0 \end{cases}$$
$$g(x) = x^2, \,\,\, \forall x \in \mathbb{R}$$
We then have $$f(g(x)) = f(x^2) = 1, \,\,\,\, \forall x \in \mathbb{R}$$ whereas $$g(f(x)) = f(x)^2 = \begin{cases} 1 & x \geq 0 \\ 0 & x < 0 \end{cases}$$