Context: I am solving a 2-dimensonal discrecte Poission equation ($\mathbf{\nabla}^2x = f$) by assembling a system of linear equations $A x = b$ and then solving it using numpy's integrated solver (np.linalg.solve). To assemble this system, I am currently using the well-known 5-point Laplace kernel:

5-point Laplacian Filter

I somehow felt that this is a very rough approximation for the divergence of $x$ and thought there should be better approximations. So I started researching and found the 9-point Laplace kernel:

9-point Laplacian Filter

My question: Besides the obvious increased computational requirements, is there any good reason as to why you should not use the 9-point over the 5-point Laplacian kernel? To me, it seems that it should be a better approximation in every way. Yet, most ressources you find online mention the 5-point kernel but very rarely talk about the 9-point kernel. Why is that?

  • 1
    $\begingroup$ The 9-point kernel you hear most about has eight 1 values and a -8 in the middle. I don’t think I’ve seen this variation before. $\endgroup$ Commented Oct 14, 2022 at 2:09
  • 2
    $\begingroup$ If rotation invariance is important, use Gaussian derivatives. $\endgroup$ Commented Oct 14, 2022 at 2:19
  • $\begingroup$ Could you please review my answer? $\endgroup$
    – Royi
    Commented Feb 25, 2023 at 8:38

1 Answer 1


Many times, in the context of solving linear system, the 5 points filter generates a banded matrix of 5 which is easier to solve.
Back in the days, when computation was much more limited, this was a big factor.

Yet probably the the 9 points filter will create a more stable system which even assist with convergence in iterative cases.

Remember both are discretization of infinitesimal operator, so in reality, while the operator works in 2D independently, in continuous space, due to the smoothness of the data, all directions have some influence. Hence, to some degree, the 9 points filter is a better approximation of the continuous operator.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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