Suppose we assume domain is defined as all the input values for which arealoutput is defined.

So, for $\displaystyle g(x)=\sqrt{x}$ the domain is $\displaystyle x\ge0$ since any negative number will result in an imaginary output. The range of $\displaystyle g(x)$ is also all non-negative numbers.

But suppose $\displaystyle f(x)=x^2$. The composite function $\displaystyle (f \circ g)(x)$ would look like this: $\displaystyle (f \circ g)(x)={\sqrt{x}}^2$. For this function, $\displaystyle -1$ could be considered a valid input value since $\displaystyle \sqrt{-1}^2 = i^2 = -1$, which is a real number.

So the question is: is $\displaystyle -1$ in the domain of $\displaystyle (f \circ g)(x)$? Or would it be considered an invalid input since you're plugging the output of $\displaystyle g(x)$ into $\displaystyle f(x)$, and $\displaystyle g(x)$ doesn't have any output for $\displaystyle x=-1$? Is this even a valid question - seems to me if you're considering $\displaystyle i$ then maybe the whole definition of domain needs to be changed to account for it. Is this done?

I quickly searched the Math Help Forum for help with this question. The only relevant post I found was Composition of Function, but that made things even more unclear. Biffboy uses this example to demonstrate how the domain of the composite function doesnothave to be limited to the range of the 'input' function. But then he does exactly that. His example is even cited by Sylvia104 as a good one showing how the domain doesn't have to be so limited.