# Domain and Range in function composition

I just came out of an exam that included this question.

Let $$g(x)=\sqrt{x^2-1}, ~|x|\geqslant1,$$$$f(x)=\sqrt{x^2+1},~x\in \mathbb{R}.$$ Find $gf$ and $fg$, stating their domain and range.

My answer was $$gf=g(f(x))=\sqrt{(\sqrt{x^2+1})^2-1}=\sqrt{x^2+1-1}=|x|$$with $D_{gf}:x\in \mathbb{R}$ and $R_{gf}:0\leqslant gf<\infty$ and $$fg=f(g(x))=\sqrt{(\sqrt{x^2-1})^2+1}=\sqrt{x^2-1+1}=|x|$$with $D_{fg}: |x|\geqslant 1$ and $R_{fg}: 1\leqslant fg<\infty$.

Can somebody tell me whether my answer is correct? In particular, although the $fg=gf$ they have different domain and range because they are obtained in a different way, is this right?

Thanks.

Edit: It was given in the question that $fg$ refers to the composition of the two functions.

• $gf$ would be the product (usually). The composition is denoted by $g\circ f$. – David Mitra Jun 25 '13 at 13:02

$gf$ usually refers to the product of the functions $g$ and $f$, in which case $(fg)(x) = f(x)g(x) = g(x)f(x) = (gf)(x)$. The domain will be $\{x \in \mathbb R : |x| \geq 1\} \;$ (which is the intersection of the domains of $f$ and $g$), and the range will be $\mathbb{R^+_0}$.
If indeed $fg$ is referring to the composition of $f$ and $g$, your answer appears correct!