Let $f (x$) = $\sqrt{−x^2 + 20x + 400} + \sqrt {x^2 − 20x}$. How many elements in the range of $f$ are integers? 
Let $f (x$) = $\sqrt{−x^2 + 20x + 400} + \sqrt {x^2 − 20x}$. How many elements in the range of $f$ are integers?

I first let $y= x^2 -20x +100$. 
Then substitute it in the function ------->  $f(x) = \sqrt{-y+500}+\sqrt{y-100}$.
Which means, $100\leq{y}\leq{500}$. I then tried to find values of $y$ that would make both radicals disappear. I found four values of $y$ that made $f(x)$ integers; $100, 500, 356,$ and $244$. I also checked their discriminants and all of them were greater than $0$, which means each value of $y$ means two solutions for $x$, meaning, there are $8$ elements in the range of $f$ are integers. But the correct answer is $9$ and I can't seem to find the last one.
 A: By C-S $$\sqrt{400+2x-x^2}+\sqrt{x^2-20x}\leq\sqrt{(1+1)(400+2x-x^2+x^2-20x)}=20\sqrt2.$$
Also, since $$\sqrt{a}+\sqrt{b}=\sqrt{a+b+2\sqrt{ab}}\geq\sqrt{a+b},$$ we obtain: $$\sqrt{400+2x-x^2}+\sqrt{x^2-20x}\geq\sqrt{400+2x-x^2+x^2-2x}=20.$$
We got the maximal and the minimal value of $f$ and $f$ is a continuous function.
Can you end it now?
A: Hint:
Can you show $f(x) = \sqrt{-y+500}+\sqrt{y-100}$ is at least $20,$
and it has a maximum at $20\sqrt2$ when $y=300$?
If so, you can see the $9$ integer elements in the range are $20, 21, ..., 28$.
A: Let $z=y-300$.  You want to solve $\sqrt{200-z}+\sqrt{200+z}=N,$ where $N$ is an integer.
Square both sides:  $400+2\sqrt{200^2-z^2}=N^2$ or $\sqrt{200^2-z^2}=\dfrac{N^2-400}2,$
which means $0\le\dfrac{N^2-400}2\le200$ or $400\le N^2\le800.$
Note we must have $N\ge0$.  Can you take it from here?
A: One way to solve this problem is to differentiate the function. $$\frac{d}{dx}f(x) = \frac{-x+10}{\sqrt{-x^2+20x+400}} + \frac{x-10}{\sqrt{x^2-20x}}$$. This equals $0$ at $x = 10 \pm 10\sqrt{3}$. The domain of $f(x)$ is $[10-10\sqrt{5}, 0]$ $\cup$ $[20, 10+10\sqrt{5}]$. This means the six values to plug into the function are $10-10\sqrt{5}, 10-10\sqrt{3}, 0, 20, 10+10\sqrt{3}, 10+10\sqrt{5}$. 
Plugging in these values finds $f(x) = 20, 20\sqrt{2}, 20, 20, 20\sqrt{2}, 20$, respectively. The minimum of these is $20$, the maximum is $20\sqrt{2}$. This means the range of the function is $[20, 20\sqrt{2}]$. Since $20\sqrt{2}$ ~ $28.28$, there are $9$ integers in the range.
