Find a stable algorithm for the computation of the roots of the equation $x^2-2ax+b=0$ if $a,~b>0$ and $a^2>>b$.
Attempt. The roots are $x_1=a-\sqrt{a^2-b}$ and $x_2=a+\sqrt{a^2-b}$, where we have a cancelation error for the computation of $x_1$, since $a^2-b\cong a^2$. So we compute $\displaystyle x_1=\frac{b}{a+\sqrt{a^2-b}}$ (stable algorithm).
My question: is it correct to say that $\displaystyle \frac{b}{2a}$ is a "good" approximation for $x_1$? Or should we remain on the algorithm $\displaystyle x_1=\frac{b}{a+\sqrt{a^2-b}}$?
Thanks in advance!
About one part of your question, no purely mathematical answer can be given because $\displaystyle x_1=\frac{b}{a+\sqrt{a^2-b}}$ is strictly the same as $a-\sqrt{a^2-b}.$ It is a floating point issue.
About the other part, yes, $\frac{b}{2a}$ is a good approximation.
This can be attested by applying Taylor expansion :
$$\sqrt{1-x}=1-\frac{1}{2}x-\frac{1}{8}x^2-\cdots$$
in the following way:
$$x_1=a-\sqrt{a^2-b}=a-a\sqrt{1-\frac{b}{a^2}}=a-a\left(1-\frac{1}{2}\frac{b}{a^2}-\frac{1}{8}\frac{b^2}{a^4}- \cdots\right)$$
Giving :
$$x_1 \ \approx \ \frac{b}{2a}+\frac{b^2}{8a^3}$$