Domain and Range for composite function 
Given the function $f(x) = x^2$ with the domain $[0, \infty)$ and
  $g(x) = \sin(x)$ with domain $(- \infty, \infty)$. What are the domain
  and range of $f(g(x))$ and $(g(f(x))$?

I start the problem by finding both $f(g(x))$ and $g(f(x))$. It appears that:
$g(f(x)) = \sin(x^2)$ and $f(g(x)) = (\sin(x))^2$

First, I consider the composition function $f(g(x))$:
We know that $Dom(g)$ is given by $(- \infty, \infty)$, and the $Ran(g)$ is $ [-1,1].$ We also know that $Dom(f)$ is given by $[0,\infty)$, and $Ran(f) = [0,\infty)$.
I realize that $Ran(g)$ is not a subset of $Dom(f)$. So, this does not exist (?)

For the second one, I realize that $Ran(f) \subset Dom(g),$ hence, the domain for $g(f(x)) = [0,\infty)$. Since $\sin(x)$ oscillates, then the range for $g(f(x)) = [-1,1]$.
Am i right? Thank you in advance. 
 A: You are wrong about the domain of $f$.
$f(x)=x^2$ has the domain $(-\infty,\infty)$. Therefore $Ran(g)$ is actually a subset of $Dom(f)$.
The domains of $f(g(x))$ and $g(f(x))$ are both $(-\infty,\infty)$: i.e. $\mathbb R$, all real numbers.
The range of $f(g(x))=(\sin(x))^2$ is $[0,1]$. The zero is attained at $x=0$ and the one at $x=\frac{\pi}2$. The continuity of the functions guarantees that all intermediate values are also attained.
The range of $g(f(x))=\sin(x^2)$ is $[-1,1]$. The minus-one is attained at $x=\sqrt{\frac{3\pi}2}$ and the one at $x=\sqrt{\frac\pi 2}$. The continuity of the functions guarantees that all intermediate values are also attained.

A: This answer, unlike my previous answer, assumes that $f(x)=x^2$ is the restricted function with domain $[0,\infty)$.
You are right about $g(f(x))$: the domain is $\mathbb R=(-\infty,\infty)$ and its range is $[-1,1]$.
As for $f(g(x))$, it is defined whenever $g(x)\ge 0$, so in contrast with what you wrote it does sometimes exist. Since $g(x)=\sin(x)$ the condition holds when $x$ is in the first or second quadrant, i.e. for $x\in[2k\pi,(2k+1)\pi]$ for some $k\in\mathbb Z$, or we could say for $\operatorname{frac}\left(\frac x{2\pi}\right)\le\frac 12$.
This restricted domain does not change the range of $f(g(x))$ since for every $x$ where $\sin(x)<0$ we can use $-x$ where $f(g(x))$ is defined and the values are equal. So the range of $f(g(x))$ is $[0,1]$, just as for the unrestricted $f$.

