# 2D convolution: Flipping the kernel?

Why do we need to flip the kernel in 2D convolution in the first place? What's the benefit of this? So, why can't we leave it unflipped? http://www.songho.ca/dsp/convolution/convolution2d_example.html

input

kernel

output

"First, flip the kernel, which is the shaded box, in both horizontal and vertical direction"

For a more technical explanation we need to go into the frequency domain. The main theorem of convolutions states that the Fourier tansform of the convolution $f*g$ of two functions $f$ and $g$ is equal (up to a constant depending on the transformation) to the product of the Fourier transforms of the two functions. In symbols
$${\mathcal {F}}\{f*g\}=k\cdot {\mathcal {F}}\{f\}\cdot {\mathcal {F}}\{g\}$$
where $\mathcal {F}$ is the Fourier transform. In the case of correlation, you would get multiplication by the complex conjugate, that is less nice, and in particular not associative.