debugMinor
Proof that (x-y)(x+y) is more accurate than x²-y²
Viewed 0 times
thanmoreaccuratethatproof
Problem
I was carrying on my reading of What Every Computer Scientist Should Know About Floating-Point Arithmetic but got stuck on the proof of Theorem 2 (page 34).
At some point it says:
\begin{align}
(x \otimes x) \ominus (y \otimes y) & = \leftx^2(1 + \delta_1) - y^2(1 + \delta_2)\right \\
& = \left(x^2 - y^2)(1 + \delta_1) + (\delta_1 - \delta_2)y^2\right \\
\end{align}
I'm ok with the rewriting, but I don't understand the argument that:
When $x$ and $y$ are nearby, the error term $(\delta_1 - \delta_2)y^2$ can
be as large as the result $x^2 - y^2$.
This doesn't make much sens to me right now. I understand that if both quantities are close to each other, then the relative error is close to $1$. But not why they should be close to each other.
At some point it says:
\begin{align}
(x \otimes x) \ominus (y \otimes y) & = \leftx^2(1 + \delta_1) - y^2(1 + \delta_2)\right \\
& = \left(x^2 - y^2)(1 + \delta_1) + (\delta_1 - \delta_2)y^2\right \\
\end{align}
I'm ok with the rewriting, but I don't understand the argument that:
When $x$ and $y$ are nearby, the error term $(\delta_1 - \delta_2)y^2$ can
be as large as the result $x^2 - y^2$.
This doesn't make much sens to me right now. I understand that if both quantities are close to each other, then the relative error is close to $1$. But not why they should be close to each other.
Solution
Suppose $y = x + \Delta$. Then $(x^2 - y^2) = x^2 - (x^2 + 2\Delta x + \Delta^2) = - (2\Delta x + \Delta^2)$ with leading term on the order of $2 \Delta x$. Multiply by $1 + \delta_1$ and that's still the leading term.
Compare to $(\delta_1 - \delta_2) y^2$ with leading term $(\delta_1 - \delta_2) x^2$.
Compare to $(\delta_1 - \delta_2) y^2$ with leading term $(\delta_1 - \delta_2) x^2$.
Context
StackExchange Computer Science Q#106314, answer score: 3
Revisions (0)
No revisions yet.