Propagation of Error in Evaluating Functions

# Propagation of Error in Evaluating Functions

Let $y = f(x)$ be a single variable function, and suppose that we wanted to evaluate $f$ at $x_A$ instead of $x_T$ possibly because: evaluating $f(x_T)$ could be difficult; we may not actually know $x_T$ but rather know that $x_A$ is close to $x_T$ with some error; or evaluating $f(x_A)$ may be more practical. We will now examine the error and relative error of using $f(x_A)$ to approximate $f(x_T)$.

Suppose that $f$ is differentiable for $x \in [a, b]$ and suppose that $x_A, x_T \in [a, b]$. Then for some $\xi$ between $x_T$ and $x_A$ we have that:

(1)
\begin{align} \frac{f(x_T) - f(x_A)}{x_T - x_A} = f'(\xi) \end{align}

Multiplying both sides of the equation by $x_T - x_A$ and we get that:

(2)
\begin{align} f(x_T) - f(x_A) = f'(\xi) (x_T - x_A) \end{align}

If $x_T \approx x_A$ ($x_T$ is very close to $x_A$) then we have that $\xi$ will be very close to both $x_T$ and $x_A$ (since $\xi$ is between $x_T$ and $x_A$ by the Mean Value Theorem), and so:

(3)

Thus we have the following approximations for the error between $f(x_A)$ and $f(x_T)$.

(4)
\begin{align} \quad \mathrm{Error} (f(x_A)) = f(x_T) - f(x_A) = f'(\xi) (x_T - x_A) \approx f'(x_T) (x_T - x_A) \approx f'(x_A) (x_T - x_A) \end{align}

We can also derive a formula to approximate the relative error between $f(x_A)$ and $f(x_T)$. Noting that $\mathrm{Error} (f(x_A)) \approx f'(x_T) (x_T - x_A)$, then we have that:

(5)
\begin{align} \quad \mathrm{Rel} (f(x_A)) = \frac{f(x_T) - f(x_A)}{f(x_T)} = \frac{f'(\xi) (x_T - x_A)}{f(x_T)} \approx \frac{f'(x_T) (x_T - x_A)}{f(x_T)} = \frac{f'(x_T)}{f(x_T)} x_T \mathrm{Rel} (x_A) \end{align}

Let's look at some examples of applying the formulas above.

## Example 1

Let $f(x) = 2\sqrt{x} + x^2$. Let $x_A = 2.995$ and $x_T = 3$. Approximate the error of using $f(2.995)$ to approximate $f(3)$.

If we differentiate $f(x)$ we get that $f'(x) = \frac{1}{\sqrt{x}} + 2x$. Applying the first error formula by letting $\xi = x_T$ and we get that:

(6)
\begin{align} \quad \mathrm{Error} (f(2.995)) \approx f'(3)(3 - 2.995) \\ \quad \mathrm{Error} (f(2.995)) \approx 6.5774 (0.005) = 3.2887 \cdot 10^{-2} \end{align}

Applying the second error formula by letting $\xi = x_A$ and we get that:

(7)
\begin{align} \quad \mathrm{Error} (f(2.995)) \approx f'(2.995)(3 - 2.995) \\ \quad \mathrm{Error} (f(2.995)) \approx 6.5678 (0.005) = 3.2839 \cdot 10^{-2} \end{align}

The values above tell us the approximate errors associated with using $f(x_A)$ to approximate $f(x_T)$ with $\xi = x_T$ and $\xi = x_A$ respectively.