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.
 A: As $a>0$, posing $x=as$ and $b=\beta a$, the problem is equivalent to discuss the real roots of
$$s+\sqrt{1-s^2}=\beta$$ with $\beta>0$. The function has real values for $\left| s\right|<1$. Moreover, $f(s)=s+\sqrt{1-s^2}$ has a single maximum at $s=1/\sqrt{2}$ with $f(1/\sqrt{2})=\sqrt{2}$, $f(0)=f(1)=1$ and finally $f(-1)<0$. Thus, there are no real root for $\beta>\sqrt{2}$, 2 real roots for $1<\beta<\sqrt{2}$, a single real root for $0<\beta<1$ and a double root at $\beta=\sqrt{2}$.
A: You just forgot to check those conditions you mentioned. Indeed, you should check that for what values of $a$ and $b$ the conditions $-a\le x\le a$ and $b-x \ge 0$ are satisfied. The difficulty is to consider a few if then conditions.
If $b=\sqrt{2}a$ then $x=\frac{b}{2}$ is a potential solution. We should make sure that this solution satisfies our inequalities, that is, we should have $-a\le\frac{b}{2}\le a$ and $b-\frac{b}{2}\ge0$ which is equivalent to $b\le 2a$. But $b=\sqrt{2}a$ so this leads to $\sqrt{2}\le 2$ which is identically true. So if $b=\sqrt{2}a$ then the only answer is $x=\frac{b}{2}=\frac{\sqrt{2}}{2}a$.
If $b\gt\sqrt{2}a$ then $\Delta:=\sqrt{2a^2-b^2}<0$ and there is not real solution.
If $b\lt\sqrt{2}a$ then two potential answers will be $x_1=\frac{b}{2}+\frac{\sqrt{2a^2-b^2}}{2}$ and $x_2=\frac{b}{2}-\frac{\sqrt{2a^2-b^2}}{2}$. I  guess you can see what to do from here. Just put $x_1$ and $x_2$ into the inqualities and see what restrictions will be obtained on $a$ and $b$. Then check these restrictions with the condition $b\lt\sqrt{2}a$ to see under what conditions $x_1$ and $x_2$ can be a solution.
Below, you can see a plot of the function $f(x)=x+\sqrt{a^2-x^2}$ with $a=1$. You can see easily that for what values of $b$ the equation $f(x)=b$ has a solution and indeed exactly how many solutions.

A: It is fairly easy when done graphically. Roots must suffice the equation $\sqrt{a^2-x^2} = x - b$ 
Notice that $$
y=\sqrt{a^2-x^2}$$ is equation of upper half of the circle of radius $a$ (square it remebering $y\geq0$). On the right hand side $$y=b-x$$ is then just a line intersecting vertical axis at $y$ descending with slope equal to $-1$. Here's an example plotted with WolframAlpha

It then breaks down to discussion on number of intersections of these two graphs:
They intersect once when distance from line to $(0,0)$ is equal to radius a $a$. Then we have $b^2 = 2a^2$ from Pythagorean theorem, so $b=a\sqrt{2}$ guarantee existance of exactly one real root. 
For $b>a\sqrt{2}$ there are clearly no intersections. 
Proceeding with $b<a\sqrt{2}$ graphs start to have twice common points, but only to the point when $b=a$ (the intersections are then exactly at $(a,0)$ and $(0,a)$).
For $b<a$ we again have one intersection in the upper left quarter. We would have $0$ roots for $b<-a$ also, however we restrict $b$ to be greater than $0$, so that fully solves the problem. Concluding:


*

*$0$ for $b>a\sqrt{2}$

*$1$ for $b \in \{b>0:b=a\sqrt{2} \lor b< a\}$ or

*$2$ for $a\leq b<a\sqrt{2}$


Plus with this approach you avoid as much algebra as possible. In exchange it may be not so versatile, but still it's always worth to give it a try with similar problems.
A: You want to study the function
$$
f(x)=x+\sqrt{a^2-x^2}
$$
defined over $[-a,a]$. We have $f(-a)=-a$, $f(a)=a$; moreover
$$
f'(x)=1-\frac{x}{\sqrt{a^2-x^2}}
$$
for $x\in(-a,a)$. The derivative can only vanish where
$$
x=\sqrt{a^2-x^2}
$$
so $x\ge0$ and $x^2=a^2-x^2$, that is, $x=a/\sqrt{2}$. Note that
$$
f(a/\sqrt{2})=\frac{a}{\sqrt{2}}+\frac{a}{\sqrt{2}}=a\sqrt{2}
$$
and that $a/\sqrt{2}$ is a point of absolute maximum for $f$.
Therefore the equation $x+\sqrt{a^2-x^2}=b$ has


*

*no solution for $b<-a$

*one solution for $-a\le b\le a$

*two solutions for $a<b<a\sqrt{2}$

*one solution for $b=a\sqrt{2}$

*no solutions for $b>a\sqrt{2}$



An algebraic solution.
The equation $\sqrt{a^2-x^2}=b-x$ has solutions only for $x\le b$. Then you can square: $a^2-x^2=b^2-2bx+x^2$ or $2x^2-2bx+b^2-a^2$. The roots of this equation are
$$
\frac{b-\sqrt{2a^2-b^2}}{2}
\qquad\text{and}\qquad
\frac{b+\sqrt{2a^2-b^2}}{2}
$$
There is no solution for $2a^2-b^2<0$, that is, $b>a\sqrt{2}$.
There will be two solutions when $b<a\sqrt{2}$ and
$$
\frac{b+\sqrt{2a^2-b^2}}{2}\le b
$$
that is, 
$$
\sqrt{2a^2-b^2}\le b
$$
or $b\ge a$. Hence, $a\le b<a\sqrt{2}$.
There will be one solution when the largest root is greater than $b$, that is $b<a$, but also the smallest root is $\le b$, that is
$$
\frac{b-\sqrt{2a^2-b^2}}{2}\le b
$$
which is always satisfied when $b>0$.
When the discriminant is $0$, then there is a single solution.
A: 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$
A: it must be $$a\geq |x|$$ and $$b\geq x$$
after squaring we get the equation
$$0=2x^2-2bx+b^2-a^2=0$$
solving this equation we get
$$x_1=\frac{b}{2}+\frac{1}{2}\sqrt{2a^2-b^2}$$
$$x_2=\frac{b}{2}-\frac{1}{2}\sqrt{2a^2-b^2}$$
so we get the following solution set
$$x=b$$ and $a=b$
$$x=\frac{1}{2}(b\pm i\sqrt{b^2-2a^2}$$ and $$0<a<\frac{b}{\sqrt{2}}$$
$$x=\frac{b}{2}$$ and $$a=\frac{b}{\sqrt{2}}$$
$$x=\frac{1}{2}(b\pm \sqrt{2a^2-b^2})$$ and $$\frac{b}{\sqrt{2}}<a<b$$
$$x=\frac{1}{2}(b-\sqrt{2a^2-b^2})$$ and $$a\geq b$$
Observe that i need time nto type all these formulas
