<s>[INST] Find the number of real roots for $x+\sqrt{a^2-x^2}=b$, $a>0$, $b>0$, as a function of $a$ and $b$ 
Given: (1) $x+\sqrt{a^2-x^2}=b$, $(a,b,x)\subset \mathbb R$, $a>0$, $b>0$.
Find: number of roots for (1), given possible values for $a$ and $b$.

This is a question from a book for the preparation for math contests.
It states as final answer: (a) 1 root if $b<a$; and (b) 2 roots if $a<b<a\sqrt{2}$.
I'm having difficulties on finding this answer. I don't know whether it is correct or perhaps I'm not finding the right approach.
I started moving $x$ in (1) to the left, to get
$$\sqrt{a^2-x^2}=b-x$$
Before proceeding with squaring both sides, I saved 2 needed conditions for checking the final solution (c1) $a^2-x^2\ge 0$ and (c2) $b-x\ge 0$. Then squaring both sides, we get:
$$a^2-x^2=b^2+x^2-2bx\Leftrightarrow 2x^2-2bx+(b^2-a^2)=0$$
with discriminant $\triangle$ defined by:
$$\triangle=4(2a^2-b^2)$$
From this it is easy to see that a condition for 2 roots is (c3) $\sqrt{2}a>b,$ and for 1 root is (c4) $\sqrt{2}a=b,$ as $a>0$ and $b>0$. Then I find the roots as $$x=\frac{2b\pm \sqrt{\triangle}}{4}=\frac{b\pm \sqrt{2a^2-b^2}}{2}$$
From this point, I can't see a way to reach the stated answer, if it is right.
Full solutions or helpful hints are welcome. Sorry if it is a duplicate.
 [/INST] As you wrote, we have 
$$2x^2-2bx+b^2-a^2=0$$
with$$a^2-x^2\ge 0\quad\text{and}\quad b-x\ge 0,$$
i.e.
$$-a\le x\le a\quad\text{and}\quad x\le b\tag1$$
Here, let us separate it into cases :


*

*Case 1 : If $(a\sqrt 2\gt)\ a\gt b$, then $(1)\iff -a\le x\le b$. We have $\frac{b+\sqrt{2a^2-b^2}}{2}\gt \frac{b+\sqrt{2b^2-b^2}}{2}=b$ and $b\gt 0\gt \frac{b-\sqrt{2a^2-b^2}}{2}\gt \frac{b-2a}{2}=\frac b2-a\gt -a$. So, in this case, 1 root.

*Case 2 : If $a\le b\lt a\sqrt 2$, then $(1)\iff -a\le x\le a$, and $$\small\frac{b+\sqrt{2a^2-b^2}}{2}\le a\iff \sqrt{2a^2-b^2}\le 2a-b\iff 2a^2-b^2\le (2a-b)^2\iff (a-b)^2\ge 0$$which indeed holds, and $$a\gt \frac{b+\sqrt{2a^2-b^2}}{2}\gt\frac{b-\sqrt{2a^2-b^2}}{2}\gt \frac{b-\sqrt{2b^2-b^2}}{2}=0$$So, in this case, 2 roots.

*Case 3 : If $b=a\sqrt 2$, then $(1)\iff -a\le x\le a$, and $x=\frac{a}{\sqrt 2}$ satisfies this. So, in this case, 1 root.

*Case 4 : If $b\gt a\sqrt 2$, the equation has no real solutions. 
Therefore, 
1 root if $a\gt b$ or $b=a\sqrt 2$
2 roots if $a\le b\lt a\sqrt 2$
0 root if $b\gt a\sqrt 2$
</s>