Condition Number - A Quick First Example
Thomas J. Kennedy
1 Overview
Let us start with a simple function…
$$ f(x) = \sqrt{x} $$
We will compute the condition number directly and then using the derivative of the natural log trick.
2 Approach 1
Let us start by computing the derivative.
$$ \begin{align} f^{\prime} &= \frac{d}{dx} \sqrt{x} \\ &= \frac{d}{dx} x^{\frac{1}{2}} \\ &= \frac{1}{2}x^{-\frac{1}{2}} \end{align} $$
Since we are interested in $x \neq 0$ and $f(x) \neq 0$… we can use the general form of the condition number.
$$ \begin{align} (\text{cond }f)(x) &= \left| \frac{x f^{\prime}(x)} {f(x)} \right|\\ &= \left| x f^{\prime}(x) \frac{1}{f(x)} \right|\\ &= \left| x \frac{1}{2}x^{-\frac{1}{2}} \frac{1}{x^{\frac{1}{2}} } \right|\\ &= \frac{1}{2} \left| x \frac{1}{x^{\frac{1}{2}} } \frac{1}{x^{\frac{1}{2}} } \right|\\ &= \frac{1}{2} \left| x \frac{1}{x} \right|\\ &= \frac{1}{2} < 1 \therefore \text{well conditioned} \end{align} $$
3 Method 2
The second approach is to take advantage of the following definition…
$$ \frac{d}{dx} \ln{f(x)} = \frac{f^{\prime}(x)}{f(x)} $$
This definition often allows us to sidestep some intermediary algebra. Using this trick we can rewrite the general form of the condition number as…
$$ \begin{align} (\text{cond }f)(x) &= \left| \frac{x f^{\prime}(x)} {f(x)} \right|\\ &= \left| x\frac{d}{dx}\ln{f(x)} \right| \end{align} $$
Let us evaluate the natural log of $f(x)$
$$ \begin{align} \frac{d}{dx}\left(\ln{f(x)}\right) &= \frac{d}{dx}\left(\ln{\sqrt{x}}\right) \\ &= \frac{d}{dx}\left(\ln{x^\frac{1}{2}}\right) \\ &= \frac{d}{dx}\left(\frac{1}{2}\ln{x}\right) \\ &= \frac{1}{2}\frac{d}{dx}\ln{x} \\ &= \frac{1}{2}\frac{\frac{d}{dx}x}{x} \\ &= \frac{1}{2}\frac{1}{x} \\ &= \frac{1}{2x} \\ \end{align} $$
The next step is to plug the result into our modified condition number formula.
$$ \begin{align} (\text{cond }f)(x) &= \left| \frac{x f^{\prime}(x)} {f(x)} \right|\\ &= \left| x\frac{d}{dx}\ln{f(x)} \right|\\ &= \left| x\frac{1}{2x} \right|\\ &= \frac{1}{2} < 1 \therefore \text{well conditioned} \end{align} $$
As expected… we end up with the same result as before.