Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can someone tell me how to count Condition number of $a^2-b^2$ or recommend a site where I can read about this. I know how to count Condition number of a matrix, but here I'm confused

share|cite|improve this question
Does this answer satisfy you? – Rustyn Feb 1 '13 at 23:39
up vote 4 down vote accepted


Example: Suppose we want to evaluate the expression $z = a^2 - b^2$. With $(a,b)=(10^8,10^8)$ we get $z=0$..., but with $a = 10^8+.01$, $b=10^8$ we get $z \approx 2\times 10^6 $. So we would probably say that this expression is ill-conditioned when evaluated for $(a,b)$ near $(10^8,10^8)$.

On the other hand, if we use, $a = 1.01 \text{ and } b = 1$, and we get $z=.0201$. We would say this it is well-conditioned for $(a,b)$ near $(1,1)$.


The condition number of a function with respect to an argument measures the asymptotically worst case of how much the function can change in proportion to small changes in the argument. The "function" is the solution of a problem and the "arguments" are the data in the problem.

Let $$f(x) = a^2 - b^2$$ Where $$x = \begin{bmatrix} a \\ b\end{bmatrix} $$
The condition number of $f$ at a point $x$ (specifically, its relative condition number) is then defined to be the maximum ratio of the fractional change in $f(x)$ to any fractional change in $x$, in the limit where the change $\delta x$ in $x$ becomes infinitesimally small: $$ \lim_{ \varepsilon \to 0^+ } \sup_{ \Vert \delta x \Vert \leq \varepsilon } \left[ \frac{ \left\Vert f(x + \delta x) - f(x)\right\Vert }{ \Vert f(x) \Vert } / \frac{ \Vert \delta x \Vert }{ \Vert x \Vert } \right], $$ where $\Vert \cdots \Vert$ is a norm on the domain/codomain of $f(x)$.

If $f$ is differentiable, this is equivalent to:

$$ \frac{\Vert J \Vert}{ \Vert f(x) \Vert / \Vert x \Vert},$$

where $J$ denotes the Jacobian matrix of partial derivatives of $f$ and $\Vert J \Vert$ is the induced norm on the matrix.
Using the one norm I get: $$ \frac{\Vert J \Vert}{ \Vert f(x) \Vert / \Vert x \Vert} = \frac{\left\Vert \begin{bmatrix} 2a \\ -2b \end{bmatrix} \right\Vert_{1} }{\Vert a^2 - b^2 \Vert_{1}/\Vert [a, b]^{T} \Vert_1} = \frac{2|a| + 2|b|}{|a^2 - b^2|/(|a|+|b|)} = \frac{2(|a|+|b|)^2}{|a^2-b^2|} $$ Which has the nice form: $$ \frac{2(|a|+|b|)}{|a-b|} $$ Assuming $a,b>0$.

As a motivating example, with $a=3,b=2.999$ $$ \kappa \approx 12,000 $$ Which is consistent as: $$f\left(\begin{bmatrix} 3 \\ 2.999 \end{bmatrix}\right)= 0.005999 \approx 0 $$ Yet $$f\left(\begin{bmatrix} 3 + .1 \\ 2.999 - .1\end{bmatrix}\right)= 1.2058$$ Yet the magnitude of their difference vector is: $$ \text{norm}\left(\left(\begin{bmatrix} 3 \\ 2.999 \end{bmatrix}\right) - \left(\begin{bmatrix} 3 + .1 \\ 2.999 - .1\end{bmatrix}\right)\right)_{2} = \sqrt{\left(\frac{1}{50}\right)} \approx 0.1414213562373095048801688724209698078569671875376948 $$

Source: link

share|cite|improve this answer
### Let me know if there is a mistake in the calculations. – Rustyn Jan 31 '13 at 2:42
Thanks for explanation, I have read that on wikipedia, but i wasn't sure it is what I am looking for. Can I use the same method to calculate condition number of calculating roots of quadratic function? – SugerBoy Jan 31 '13 at 10:25
@Ziva Here is a cool link. I've got to go to school, but i'll talk to you soon. – Rustyn Jan 31 '13 at 16:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.