The functions $f$ and $g$ are defined by $$\begin{align} &f(x)=2\sqrt{1-e^{-x}}\quad x\in\mathbb{R},x\geqslant 0\\ &g(x)=\ln(4-x^2)\quad x\in\mathbb{R},-2<x<2. \end{align}$$ Explain why
(i) $f\circ g$ can't be formed as a composite function
(ii) $g\circ f$ can be formed as a composite function.
This is the first time I've faced a question like this, so I'm not totally sure what the answer to this is.
This is my attempt:
For $-2<x<2$, $g(x)$ varies between $-\infty$ and $\ln4$. However, to form the composite function $f\circ g$ we require $$g(x)\in\mathbb{R},g(x)\geqslant 0$$ but this is not always the case here, since as explained before $g(x)$ can also take negative values. Hence we cannot form the composite function $f\circ g$.
On the other hand, for $x\geqslant0$ we know that $f(x)$ is always between $0$ and $2$, which fits with our requirement for us to be able to form $g\circ f$ as a composite function (ie the requirement that $-2<f<2$), hence we can indeed form $g\circ f$.
Is that right? I'm not completely sure that my reasoning is ironclad.
Thank you for your help.
Yes, you're right.
You just need to look at what the images of $f,g$ are. If any of the images of $f$ or $g$ aren't contained in the domain of the other their composition won't be well defined.
The image of $g$ is just $(-\infty, g(0)=\log(4)]$, and the image of $f$ is just $[0,2)$. So the image of $f$ is contained in the domain of $g$ (which is to say that $[0,2)\subset(-2,2)$) while the image of $g$ isn't contained on the domain of $f$ (because $-1\in (-\infty, \log(4)]$ but $-1\not\in[0,\infty)$) hence you can define $g\circ f$ but not $f\circ g$.
A short, intuitive answer is try to evaluate $(f\circ g)(-1)$. Since $g(-1)<0$ $f(g(-1))$ isn't well defined so $f\circ g$ can't be well defined, while since for every value $f(x)$ can take $g$ has an image for that value $g\circ f$ is.