# Use Finite Difference Discretization to find approximate solution to the Poisson's equation

I've just been introduced to the Poisson's equation. I've never had the need to dealt with PDE, so I'm a bit lost.

Apparently we can compute an approximate solution of the Poisson's equation

$$\frac{\partial^2}{\partial x^2} + \frac{\partial^2}{\partial y^2} u(x, y) = f(x, y)$$

by discretizing the 2D Poisson's equation using finite differences. Here's a picture of that discretization taken from the website I've just linked you to:

According to that website, we have:

The above linear equation relating $$U(i,j)$$ and the value at its neighbors (indicated by the blue stencil) must hold for $$1 <= i,j <= n$$, giving us $$N=n^2$$ equations in $$N$$ unknowns.

where "by above linear equation" I guess they are referring to

$$−4u_{i,j}+u_{i+1,j}+u_{i−1,j}+u_{i,j+1}+u_{i,j−1} = b_{i,j}$$ $$1 \leq i, j \leq n$$

When $$(i,j)$$ is adjacent to a boundary ($$i=1$$ or $$j=1$$ or $$i=n$$ or $$j=n$$), one or more of the $$U(i+-1, j+-1)$$ values is on the boundary and therefore $$0$$. $$b(i,j) = -f(i*h,j*h)*h^2$$ the scaled value of the right-hand-side function $$f(x,y)$$ at the corresponding grid point $$(i,j)$$.

## Questions

1. Where does the $$-4$$ in front of $$u_{i,j}$$ in the equation above comes from?

2. What's $$b(i, j)$$? Why is it equal to $$−4u_{i,j}+u_{i+1,j}+u_{i−1,j}+u_{i,j+1}+u_{i,j−1}$$? I mean, I don't understand where does it come from. Usually $$b$$ refers to a right-hand side, but...

3. Why do we have $$b(i,j) = -f(i*h,j*h)*h^2$$?

https://people.eecs.berkeley.edu/~demmel/cs267/lecture17/lecture17.html

so this is only a short guide to what you should be looking for.

1. The derivatives have been discretized as

$\frac{\partial^2 u}{\partial x^2} = \frac{u(i+1,j) - 2u(i,j) + u(i-1, j)}{h^2}$

$\frac{\partial^2 u}{\partial y^2} = \frac{u(i,j+1) - 2u(i,j) + u(i, j-1)}{h^2}$

So, add the two together and you get

$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = \frac{u(i+1,j) - 2u(i,j) + u(i-1, j)}{h^2} + \frac{u(i,j+1) - 2u(i,j) + u(i, j-1)}{h^2}$

Rearrange

$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = \frac{u(i+1,j) + u(i-1, j) + u(i,j+1) + u(i, j-1) - 4u(i,j)}{h^2}$

This gives you the -4

2.

$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = f$

So

$\frac{u(i+1,j) + u(i-1, j) + u(i,j+1) + u(i, j-1) - 4u(i,j)}{h^2} = f$

Now just take the $h^2$ to the other side and you get b which is also your third question

• I don't think you'll get the why there. You'll only get the how. To get the why you'll have to start reading a numerical analysis book. If you only want a basic introduction, even Kreyszig should be enough. – Vikram Nov 17 '16 at 9:44