# Derivation of forward/backward/central difference methods from taylor series

Theorically using the taylor series $u(x)=\sum_{n=0}^{\infty}\frac{(x-x_i)^n}{n!}(\frac{d^nu}{dx^n})_i$ you can get the forward/backward/central difference methods, which are:

forward: $(\frac{du}{dx})_i\approx\frac{u_{i+1}-u_i}{\Delta x}$

backward: $(\frac{du}{dx})_i\approx\frac{u_{i}-u_{i-1}}{\Delta x}$

central: $(\frac{du}{dx})_i\approx\frac{u_{i+1}-u_{i-1}}{2\Delta x}$

But I'm having a rough time trying to understand how the above taylor series is being expanded to obtain the difference methods. The fact of not having very clear how taylor works and that subindex notation is confusing me. In the lecture says that $u_i \approx\ {u(x_i)}$ and $x_i=i\Delta x$

Also, the lecture I'm following introduces FDM saying that:

$\frac{\delta u}{\delta x}(x)=\lim_{x\to 0} \frac{u(x+\Delta x) - u(x)}{\Delta x} = \lim_{x\to 0} \frac{u(x)-u(x-\Delta x)}{\Delta x} = \lim_{x\to 0} \frac{u(x+\Delta x)-u(x-\Delta x)}{2\Delta x}$

But how can i prove those equations are equals, any idea?

The index notation just means on the derivative just means evaluated at $x_i$,

$$u(x) = u(x_i) + \left.\frac{du}{dx}\right|_{x = x_i}(x - x_i) + \frac{1}{2!}\left.\frac{d^2u}{dx^2}\right|_{x = x_i}(x - x_i)^2 + \cdots$$

Forward

Take $x = x_{i + 1}$

$$u(x_{i +1}) \approx u(x_i) + \left.\frac{du}{dx}\right|_{x_i}(x_{i+1} - x_{i}) + \frac{1}{2}\left.\frac{d^2u}{dx^2}\right|_{x_i}(x_{i+1} - x_{i})^2 + \cdots \tag{1}$$

up to first order in $\Delta x = (x_{i+1}-x_i)$ this becomes

$$\left.\frac{du}{dx}\right|_{x_i} \approx \frac{u(x_{i +1}) - u(x_{i})}{\Delta x}$$

Backward

Same deal as before, just use the point $x_{i-1}$ instead

$$u(x_{i -1}) \approx u(x_i) + \left.\frac{du}{dx}\right|_{x_i}(x_{i-1} - x_{i}) + \frac{1}{2}\left.\frac{d^2u}{dx^2}\right|_{x_i}(x_{i-1} - x_{i})^2 + \cdots \tag{2}$$

truncating at first order and solving for the derivative:

$$\left.\frac{du}{dx}\right|_{x_i} \approx \frac{u(x_{i }) - u(x_{i-1})}{\Delta x}$$

Central

If you subtract Eq (2) from Eq (1) you get

$$\left.\frac{du}{dx}\right|_{x_i} \approx \frac{u(x_{i+ 1}) - u(x_{i-1})}{2\Delta x}$$

• Thank you very much! using that notation really helped , usually in all explanations i've seen from Taylor the notation used was $f(x) = \sum_{i=0}^{\infty}\frac{f^{(i)}(a)}{i!}(x-a)^{i}$ , but now i realize $a=x_i$ . Before validating your answer, do you have any explanation about the 2nd part of my question about proving those limits are equal ones? +1 in the meantime – BPL Oct 11 '17 at 22:38
• @BPL You can see from the three equations I posted that they are valid when $\Delta x \to 0$, and all of them approach the value of the first derivative – caverac Oct 11 '17 at 22:42
• Mmmm, I kind of understand what you're saying. But is that obvious? I mean... take a look to the first page of this lecture, over there is stating those 3 limits are strictly equal ones, so I'm wondering, is that true (formal proof)? For instance, let's say we got $f(x)=|x|$ . Instead using the taylor equivalences, can't be proved than those 3 limits are equal ones using other type of properties? – BPL Oct 11 '17 at 22:51
• @BPL You're right, but also remember that for these expressions to be true, you need the function to be $C^\infty$, and $|x|$ is not around 0. Also, note that that these equations can be written as $u(x) = a_0 + u'(x_i) \Delta x + a_2 \Delta^2 x + a_3 \Delta^3 x + \cdots$, so in the limit the high order terms vanish faster than the one with the first order derivative. Hope it makes more sense now – caverac Oct 11 '17 at 22:57
• Mmm, you're completely right, the counterexample wasn't valid because it wasn't infinitely differentiable. In any case, by saying in the limit the high order terms vanish faster than the one with first derivative? What do you mean mathematically speaking? Any property of limits you're omitting? – BPL Oct 11 '17 at 23:17