I am a little confused about how to find the domain and the range of the function $f(g(x))$ when only given the two graphs. I kind of understand the solution, but I am struggling to use the domain of $g(x)$ to find the domain and range of $f(g(x))$. Is there a general method that can be used to solve these types of questions? Thanks.
Let's walk through the solution for $f \circ g.$
To determine the domain, consider that when we evaluate $(f \circ g)(x) = f(g(x)),$ we evaluate $g(x)$ first, and then plug that value in to $f.$ So, our domain is all values $x$ which are in the domain of $g$ so that we can evaluate $g(x),$ and for which $g(x)$ is in the domain of $f$ so that we can evaluate $f$ at $g(x).$ In this case, $g$ can take all real numbers, and the range of $g$ is a subset of the domain of $f,$ so the domain of $f \circ g$ is also all real numbers, or $(-\infty, \infty).$
Now to determine the range, we need to look at what values $f$ can give when we plug in the output (or range) from $g(x).$ That is to say, the range of $f \circ g$ is the image of $f$ on the range of $g.$ In this case, the range of $g$ is $(-2, 2),$ so we want the values which $f(x)$ outputs when $x$ is in the interval $(-2, 2).$ From the graph we can see that this is $(-15, 1).$
Does this approach help you understand the problem for $g \circ f$?
Temporarily, throw away the math and stretch your intution around an entirely different scenario.
You have a key to a room that is currently locked. You unlock the door, enter the room, and find a 2nd key on a table. You take this 2nd key, and go to a 2nd room that is locked.
You use this 2nd key to unlock the door to the 2nd room. Now, you can (finally) enter the 2nd room.
The analogy is apt. You are trying to interpret the composition function $[f \circ g](x) = f[g(x)].$
One $x_0$ value at a time, you examine the output of $g(x_0)$. This is similar to unlocking the first room, to pick up the key to the 2nd room.
You feed this value $g(x_0)$ into the function $f$ to compute $f[g(x_0)]$. You note the value $f[g(x_0)]$. So, on a piece of scratch paper, where you are graphing the function $f\circ g$, under the value $x = x_0$, you graph that the result of $[f\circ g](x_0)$ is $f[g(x_0)].$
It is as if, having used the 2nd key, you can unlock the 2nd room, and enter it.