Contest problem on domain and range of square root function I have no clue how to do this problem:

Let $f(x)=\sqrt{ax^2+bx}$. For how many real values $a$ is there at least one positive real value of $b$ for which the domain of $f$ and the range of $f$ are the same set?

The answer is two but what is the complete solution?
 A: First off, $ax^2+bx$ is a quadratic, and the domain of $f$ is the region where the quadratic is non-negative. If this set includes any negative numbers, it's game over: $f(x)$ can never be negative, so the range won't match the domain.
Therefore, $ax^2 + bx < 0$ when $x < 0$. It immediately follows that $a$ is negative or zero.
If $a$ is zero, we win: setting $b=1$ (or your favorite positive number) works. So $a=0$ is one solution to the problem.
Otherwise, $a$ is negative. Solving the quadratic, the solutions are $0$ and $-b/a$, so the domain of $f$ is $[0, -b/a]$. This has to include only positive numbers, so b must be positive. Now, the quadratic ranges from $f(0)$ to its maximum $f(-b/2a)$, since $-b/2a$ is right between the zeroes, so the range of the function $f$ is
$[0, b\sqrt{-1/4a}]$.
Therefore, since the range and domain are equal, $-b/a = b\sqrt{-1/4a} \rightarrow -1/a = \sqrt{-1/4a}$, and the unique solution of this latter equation is $a=-4$.
In summary, there are two solutions, $a=0$ and $a=-4$.
