Question:
Let $R^{+}$be the set of all non-negative real numbers. If $f: R^{+} \rightarrow R^{+}$and $g: R^{+} \rightarrow R^{+}$are defined as $f(x)=x^{2}$ and $g(x)=+\sqrt{x}$, find fog and gof. Are they equal functions?
Solution:
Given, $f: R^{+} \rightarrow R^{+}$and $g: R^{+} \rightarrow R^{+}$
So, fog: $R^{+} \rightarrow R^{+}$and gof: $R^{+} \rightarrow R^{+}$
Domains of fog and gof are the same
$(f o g)(x)=f(g(x))=f(\sqrt{x})=(\sqrt{x})^{2}=x$
$(g o f)(x)=g(f(x))=g\left(x^{2}\right)=\sqrt{x^{2}}=x$
So, $(f o g)(x)=(g o f)(x), \forall x \in R^{+}$
Hence, fog = gof