# Compute the Second Order Derivative of Digital Image with Finite Differences

I was looking for how to compute second order derivative of an image and came across the question kernels to Compute Second Order Derivative of Digital Image. In the top voted answer, it gives an example to get $$3\times 3$$ kernel $$I_{xx}$$ and $$I_{xy}$$. The 1st order derivative filter is defined as $$\left( \begin{array}{cc} -1 & 1 \\ -1 & 1 \\ \end{array} \right)$$

Then

$$I_{xx} = I_x \cdot I_x = \left( \begin{array}{cc} -1 & 1 \\ -1 & 1 \\ \end{array} \right)\cdot\left( \begin{array}{cc} -1 & 1 \\ -1 & 1 \\ \end{array} \right)=\left( \begin{array}{ccc} 1 & -2 & 1 \\ 2 & -4 & 2 \\ 1 & -2 & 1 \\ \end{array} \right)$$

and

$$I_{xy} = I_y \cdot I_x = \left( \begin{array}{cc} -1 & -1 \\ 1 & 1 \\ \end{array} \right)\cdot\left( \begin{array}{cc} -1 & 1 \\ -1 & 1 \\ \end{array} \right)=\left( \begin{array}{ccc} 1 & 0 & -1 \\ 0 & 0 & 0 \\ -1 & 0 & 1 \\ \end{array} \right)$$

The computation of $$I_{xx}$$ makes sense to me, however, for $$I_{xy}$$, shouldn't it be defined as below?

$$I_{xy} = I_x \cdot I_y = \left( \begin{array}{cc} -1 & 1 \\ -1 & 1 \\ \end{array} \right)\cdot\left( \begin{array}{cc} -1 & -1 \\ 1 & 1 \\ \end{array} \right)=\left( \begin{array}{ccc} -1 & 0 & 1 \\ 0 & 0 & 0 \\ 1 & 0 & -1 \\ \end{array} \right)$$

Pay attention that convolution mean flipping the kernel both on the x and y axis.
Hence the first element is a multiplication of $$-1 \cdot -1$$ which yields $$1$$ as in the answer in the original post.