Question:

Which one of the following is the CORRECT outcome of convolution with zero padding of the two images given below?
\[ \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix} * \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix} \]

Show Hint

Convolving a 2x2 all-ones image with a 2x2 all-ones kernel gives a 3x3 output equal to the number of overlapping cells at each shift, producing a triangular pattern.
Updated On: Aug 14, 2026
  • \[ \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix} \]
  • \[ \begin{bmatrix} 1 & 1 & 1 \\ 1 & 4 & 1 \\ 1 & 1 & 1 \end{bmatrix} \]
  • \[ \begin{bmatrix} 2 & 1 & 2 \\ 1 & 4 & 1 \\ 2 & 1 & 2 \end{bmatrix} \]
  • \[ \begin{bmatrix} 2 & 2 & 2 \\ 2 & 4 & 2 \\ 2 & 2 & 2 \end{bmatrix} \]
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Set up the convolution definition.
For two 2D discrete signals \(A\) and \(B\), the convolution with zero padding is \[ C(m,n) = \sum_{i}\sum_{j} A(i,j)\,B(m-i, n-j) \] where \(A\) and \(B\) are treated as zero outside their given \(2\times2\) extents. Since both \(A\) and \(B\) here are all-ones matrices, flipping \(B\) does not change it, because it is symmetric.

Step 2: Determine the output size.
Convolving an \(m_1 \times n_1\) matrix with an \(m_2 \times n_2\) matrix (with zero padding) gives an output of size \((m_1+m_2-1)\times(n_1+n_2-1)\). With both matrices \(2\times2\), the output is \(3\times3\).

Step 3: Compute each output entry by counting overlaps.
Because every entry of \(A\) and \(B\) equals 1, each output value \(C(m,n)\) equals the number of index pairs for which both \(A(i,j)\) and \(B(m-i,n-j)\) fall inside the valid \(2\times2\) region, i.e. the number of overlapping cells when one \(2\times2\) window is shifted relative to the other. Corners of the \(3\times3\) output have 1 overlapping cell, giving value 1. Edge-midpoints have 2 overlapping cells, giving value 2. The centre has all 4 cells overlapping, giving value 4.

Step 4: Assemble the result.
\[ C = \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix} \] This is the triangular/pyramid pattern produced whenever a \(2\times2\) box function is convolved with itself.

Step 5: Rule out the other options.
Option (B) wrongly keeps all edge values as 1 instead of 2, ignoring that edge positions have 2 overlapping cells. Option (C) swaps the corner and edge values compared to the correct pattern. Option (D) uses a constant value of 2 everywhere except the centre, which matches no consistent overlap count. \[ \boxed{C = \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix}} \]
Was this answer helpful?
0
0