# 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?

-
Have you tried just computing all the cases? Note that $a=0$ is one of the cases that works ; in that case since $b > 0$ the image and the range are the non-negative real numbers. – Patrick Da Silva Feb 2 '12 at 1:25
@PatrickDaSilva - just try to figure out the cases cause me headache – Victor Feb 2 '12 at 1:29
There is a smart way to figure out all the cases but to get rid of some very quickly ; look at Lopsy's answer. – Patrick Da Silva Feb 2 '12 at 1:32

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$.

-
I just added some math typesetting. Very good answer ; you thought it through properly. – Patrick Da Silva Feb 2 '12 at 1:34
lopsy- i think you make some mistake on the sentence that after the first paragraph accoding to this: artofproblemsolving.com/Wiki/index.php/2003_AMC_12A_Problems/… – Victor Feb 2 '12 at 4:02
What exactly is the mistake? – Lopsy Feb 2 '12 at 12:29