# Why this finite difference method is stable for $r\leq1/2$

I was recently looking at this Wikipedia page, and specifically the section explicit method for the heat equation. To summarise, it says we can use the numerical scheme below.

We have the differential equation $$U_t=U_{xx}$$ We want to numerically approximate the points at $(x_j,t_n)$ by $u_j^n$. By expressing the derivatives as $$U_t\approx\frac{u_j^{n+1}-u_j^n}{k}\text{ and }U_{xx}\approx\frac{u_{j+1}^n-2u_j^n+u_{j-1}^n}{h^2},$$ we can rearrange to get $$u_j^{n+1}=(1-2r)u_j^n+r u_{j-1}^n+r u_{j+1}^n$$ where $r=k/h^2$

What I don't understand is why this is stable for $r\leq 1/2$ and why it would be unstable if $r>1/2$ - what causes this instability? Is it something to do with the $1-2r$ term, which we need to keep $\leq0$? If so, why?

• You may want to look at Von Neumann stability analysis.
– Eff
Apr 28 '17 at 15:01
• @Eff I just read that page, and it says: For linear differential equations with periodic boundary condition, the spatial variation of error may be expanded in a finite Fourier series $$\epsilon(x)=\sum_{m=1}^M A_m(t) e^{ik_mx}.$$ I can follow all the method after this, but why is this Fourier series justified? Apr 28 '17 at 15:13
• The expansion is a complete set and so functions can be written as a linear combination of them. Apr 28 '17 at 15:20

As Eff pointed out, Von Neumann analysis is the way to go. Suppose $u_j^n = z^n e^{i j \xi}$. Plugging this into the equation $$z = (1-2r) + r( e^{-i \xi} + e^{i \xi}) = (1-2r) + 2r \cos \xi.$$ The stability is only if $|z| < 1$ which implies $$-1 < r (\cos \xi - 1) < 0.$$ Note here, that $\cos \xi - 1 \le 0$ and so $$\frac{1}{1 - \cos \xi} > r > 0.$$ Finally, we want stability for all $\xi$ and so we take the minimum for the LHS which gives $$\frac{1}{2} > r > 0.$$
• You used $e^{ij\xi}$ terms, whereas the Wikipedia page used $e^{\frac{i\pi j\xi}{L}}$ - I think I am missing some understanding as to why either of these can be used? Apr 28 '17 at 15:34
• Also, this answer doesn't say anything about the case $r=1/2$, which is stable Apr 28 '17 at 15:36
• Technically it is better practice to use the form from wiki. I was just showing the process. The result should be the same. You can also see this by noting that changing $\xi \to c \xi$ gives the same result. Additionally, stability is actually given if $|z| \le 1$. Would you like me to edit or do you understand enough to take care of it? Apr 29 '17 at 19:08