# Relative error; absolute error divided by real value or approx value?

I have the following function; $$f(x) = -\frac{x}{2x + 4}\cdot v_r \Rightarrow \hat{f}(x) = -\frac{x}{4}\cdot v_r$$

Because $x$ is very small we can approximate $f(x)$ to $\hat{f}(x)$.

Now the relative error is computed. From my numerical methods course I know the relative error is defined as the real value minus the approximate value, the absolute error, divided by the real value. This is also stated on wikipedia;

$$\eta_1 = \left|\frac{f(x) - \hat{f}(x)}{f(x)}\right|$$

However in the course I follow they say it is defined as;

$$\eta_2 = \left|\frac{f(x) - \hat{f}(x)}{\hat{f}(x)}\right|$$

Now when I calculate $\eta_1$ and $\eta_2$ I get;

$$\eta_1 = \left|\frac{x}{2}\right|$$

$$\eta_2 = \left|\frac{x}{x + 2}\right|$$

Now my question is is that I don't really understand what the difference is between $\eta_1$ and $\eta_2$.

ps. if anyone can come up with a better topic title, or tags feel free.

-

Let's assume (as in your example) that you are using a linear approximation for a function $f$ near $x_0 = 0$ and that $f(x_0) =0$. Look at the ratio of the two forms for the relative error, at a point $x$. If the function $f$ has a continuous second derivative, it is $$\frac{\eta_2}{\eta_1} = \frac{f(x)}{\hat f(x)} \approx \frac{0 + f'(0) x + f''(z) x^2 / 2}{0 + f'(0) x} = 1 + \frac{f''(z)}{2f'(0)} x$$ where $z$ is between $0$ and $x$. Therefore, for small $x$ the two errors are numerically very close. How small / how close depends on the ratio of $f''$ and $f'$ near $x = 0$.