# How can I show that the equation holds?

Suppose we have the following data:

1. $$r=\frac{vk}{h^2}$$

2. $$u[i,j]$$ is a function of two variables with $$i,j$$ integers.

3. $$\frac{u[i,j+1]-u[i,j]}{k}=v\frac{u[i+1,j]-2u[i,j]+u[i-1,j]}{h^2}$$

Then I would like to show using Mathematica that the following equation is true:

$$u[i,j+1]=(1-2r)u[i,j]+r(u[i+1,j]+u[i-1,j])$$

This is trivial to do by hand but when it comes to prove it with Reduce, it get nowhere...more precisly I give the following commands:

r=v k/h^2;

u[i_,j_];

(u[i,j+1]-u[i,j])/k==v (u[i+1,j]-2 u[i,j]+u[i-1,j])/h^2;

Reduce[u[i,j+1]=(1-2 r) u[i,j]+r (u[i+1,j]+u[i-1,j])]


And what I get are strange messages....Can someone tell me what I am doing wrong or propose a better way to do that? Thanks.

## 1 Answer

Perhaps,

ClearAll[r, i, j, u, v, k, h]
Simplify[u[i, j + 1] == (1 - 2 r) u[i, j] + r (u[i + 1, j] + u[i - 1, j]),
{r == v k/h^2, (u[i, j + 1] - u[i, j])/k == v (u[i + 1, j] - 2 u[i, j] + u[i - 1, j])/h^2}
]


True

• Thanks for the answer, but it does not seem to work in the notebook I open in the Wolfram Cloud... I get as a result:u[i,1+j]==(1-2 r) u[i,j]+r (u[-1+i,j]+u[1+i,j]) – dmtri Jan 25 '20 at 10:27