# Bounding Error in Evaluating Functions

Suppose that we have an approximate value $x_A$ of the true value $x_T$. We saw from the Propagation of Error in Evaluating Functions page that if $y = f(x)$ is a differentiable function for $x \in [a, b]$ and $x_A, x_T \in [a, b]$ then we can approximate the error of $f(x_A)$ to $f(x_T)$

(1)More generally, the true error of $f(x_A)$ to $f(x_T)$ by $\mathrm{Error} (f(x_A)) = f'(\xi) (x_T - x_A)$ where $\xi$ is between $x_T$ and $x_A$.

The following examples will show that we can bound the error between $f(x_A)$ and $f(x_T)$.

## Example 1

**Find bounds on both the error and relative error in $f(x_A)$ from $f(x_T)$ where $f(x) = \sqrt{x}$ and $x_A = 0.0425$ where $x_A$ is correctly rounded to the number of significant digits shown.**

We note that $x_A = 0.0425$ has three significant digits and so:

(2)Let $\epsilon = \frac{1}{2} 10^{-4} = 0.00005$. Then we have that $\mid x_T - 0.0425 \mid ≤ 0.00005$. If we expand the absolute value then we see that:

(3)Now note that for some $\xi$ between $x_A$ and $x_T$ we have that:

(4)Note that $f(x) = \sqrt{x}$ and so $f'(x) = -\frac{1}{2 \sqrt{x}}$ and $\mid f'(x) \mid = \frac{1}{2 \sqrt{x}}$. It's not hard to see that this is a continuous decreasing function on the interval $[x_A - \epsilon, x_A + \epsilon] = [0.04245, 0.04255]$ and thus the maximum is achieved at the left endpoint, $0.04245$, that is $\max_{0.04255 ≤ x ≤ 0.04255} \mid f'(x) \mid = \frac{1}{2 \sqrt{0.04255}} \approx 2.42393…$ and thus:

(5)## Example 2

**Find bounds on both the error in $f(x_A)$ from $f(x_T)$ where $f(x) = \sin (x)$ and $x_A = 0.04512$ where $x_A$ is correctly rounded to the number of significant digits shown.**

We note that $x_A = 0.04512$ has four significant digits, and thus:

(6)Let $\epsilon = 0.000005$. Expanding the absolute value above and we have that $0.04512 - 0.000005 ≤ x_T ≤ 0.04512 + 0.000005$. Now we note that since $f(x) = \sin x$ then the derivative of $f$ is $f'(x) = \cos x$. On the interval $[x_A - \epsilon, x_A + \epsilon] = [0.045115, 0.045125]$ the function $f'(x) = \cos x$ is a positive function, so $\mid f'(x) \mid = \mid \cos x \mid = \cos x$ on this interval. Furthermore, $f'(x)$ is continuous and decreasing on this interval and so the maximum is achieved at the left endpoint, so:

(7)Thus we have that:

(8)## Example 3

**Find bounds on the error in $f(x_A)$ from $f(x_T)$ where $f(x) = e^x$ and $x_A = 0.032$ where $x_A$ is correctly round to the number of significant digits shown.**

We note that $x_A = 0.032$ has two significant digits and thus:

(9)Let $\epsilon = 0.0005$. Expanding the absolute value above and we have that $0.032 - 0.0005 ≤ x_T ≤ 0.032 + 0.0005$ and so $0.0315 ≤ x_T ≤ 0.0325$. We note that since $f(x) = e^x$ then the derivative of $f$ is $f'(x) = e^x$. On the interval $[x_A - \epsilon, x_A + \epsilon] = [0.0315, 0.0325]$, we note that $f'(x) = e^x$ is a positive function so $\mid f'(x) \mid = f'(x)$ on this interval. Furthermore, $f'(x)$ is continuous and increasing on this interval and so the maximum is achieved at the right endpoint so:

(10)Thus we have that:

(11)