# Local truncation error / Taylor expansion

Work out the LTE for the following approximations of the heat equation $u_t=u_{xx}$

$U_{j}^{n+1} = U^{n-1}_{j} + 2r(U_{j-1}^{n}-2u_{j}^{n} + u^{n}_{j+1})$

When working out the LTE, how do I know how many terms to go up to?

for this question, I would have expanded up to the 4th term. However I then getting a different LTE, So I am not sure how many terms I need to up to.

Since you are interested in approximating the PDE $u_t = u_{xx}$, it is reasonable to stop the expansion once you have one meaningful term after the one that appears in the PDE. In this case the first non-zero term in the expansion that shows up after $u_t$ is $\frac{1}{3!}u_{ttt}\Delta t^2$.
What you do with this term depends on what you need the LTE for. For example, if consistency is all you care about then you can just throw it away and have $$\frac{u_j^{n + 1} - u_j^{n-1}}{2\Delta t} \sim u_t + \mathcal{O}(\Delta t^2).$$ On the other hand, if you need/want a more precise analysis you can keep it and write $$\frac{u_j^{n + 1} - u_j^{n-1}}{2\Delta t} \sim u_t + \frac{1}{3!}u_{ttt}\Delta t^2 + \mathcal{O}(\Delta t^3).$$
At this point one would of course notice that actually $\mathcal{O}(\Delta t^3)$ can be replaced by $\mathcal{O}(\Delta t^4)$ for free since the time stencil is symmetric and hence kills every even power in the Taylor expansion.