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:

enter image description here

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)$.


  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$?

  • 1
    $\begingroup$ The link that you posted explicitly links to another lecture. people.eecs.berkeley.edu/~demmel/cs267/lecture17/lecture17.html All details of the discretization used in this particular case is there in that lecture. $\endgroup$ – Vikram Nov 16 '16 at 17:23
  • $\begingroup$ @Vikram Since I'm really new to these things, it's not easy to put all concepts together.. $\endgroup$ – nbro Nov 16 '16 at 17:45
  • 6
    $\begingroup$ @nbro -- maybe so, but at the same time you need to put in some effort in working these things through, reading through a book, etc. Your question here and in the other post are so basic -- essentially you're just trying to match symbols -- that answering your questions is tantamount to handholding while walking you through what would be covered in the first week of a semester. You need to show some more effort yourself. $\endgroup$ – Wolfgang Bangerth Nov 16 '16 at 17:58
  • $\begingroup$ @WolfgangBangerth If it's so basic why nobody exactly managed to answer to my question? I should show some effort. Do you think that losing 10 minutes writing the question above in Tex/Markdown is not putting an enough effort when I've a lot of things to do? Even if it's basic, does it mean it doesn't deserve to be answered and it's not a good question? This website is not just for professionals, i.e. professors, researchers, etc, in computational science, as far as I know. I'm matching symbols, is matching Chinese symbols easy? Please, don't be squared in a spherical world. $\endgroup$ – nbro Nov 17 '16 at 14:36
  • $\begingroup$ @nbro -- you seem to be under the impression that you deserve a question. But I think that's questionable: nobody here is paid to give you an answer. We're all volunteers offering our expertise and time to answer questions. You will find many good questions answered patiently that are not by "professors, researchers, etc." But we choose to spend our spare time and patience on those who have made an honest effort to look for literature, read it, and try to understand what it says. In my post above I tried to show you ways to make it more likely to get answers. You replied with insults. $\endgroup$ – Wolfgang Bangerth Nov 17 '16 at 20:32

The answers are all there in the link


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}$


$\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


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


$ \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

| cite | improve this answer | |
  • $\begingroup$ Actually in the meantime I had understood that we're discretising $\frac{\partial^2 u}{\partial x^2}$ as you're describing and therefore where the $-4$ comes from, but I don't know why. You said it's explained in the website I've linked to..I will try to have a look at it then. $\endgroup$ – nbro Nov 16 '16 at 18:19
  • 1
    $\begingroup$ 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. $\endgroup$ – Vikram Nov 17 '16 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.