Question:medium

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: Jul 20, 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

The Correct Option is A

Solution and Explanation

Step 1: Label the matrix entries.
Let $A(0,0)=A(0,1)=A(1,0)=A(1,1)=1$ be the first image and $B(0,0)=B(0,1)=B(1,0)=B(1,1)=1$ be the second image, both zero outside these indices.

Step 2: Write the general convolution sum for a 3x3 output.
With zero padding, the output index $(m,n)$ ranges over $m,n=0,1,2$, and $$ C(m,n) = \sum_{i=0}^{1}\sum_{j=0}^{1} A(i,j)\,B(m-i,\,n-j) $$ where any $B$ index outside $\{0,1\}$ contributes 0.

Step 3: Evaluate each of the 9 output entries explicitly.
$C(0,0)=1$ (only one valid term). $C(0,1)=B(0,1)+B(0,0)=1+1=2$. $C(0,2)=1$ (one valid term). $C(1,0)=B(1,0)+B(0,0)=2$. $C(1,1)=B(1,1)+B(1,0)+B(0,1)+B(0,0)=4$. $C(1,2)=B(1,0)+B(0,0)=2$. $C(2,0)=1$. $C(2,1)=B(1,1)+B(1,0)=2$. $C(2,2)=1$.

Step 4: Assemble the 3x3 output matrix.
$$ C = \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix} $$ This term-by-term evaluation confirms the same triangular result as the overlap-counting shortcut.

Step 5: Reject the distractor patterns.
Option (B) would result only if every position, including the edges, had exactly 1 overlapping cell, which is false since edge positions genuinely have 2 valid terms as shown above. Option (C) has its corner and edge values interchanged relative to the correct computation. Option (D) does not arise from any correct convolution of two all-ones $2\times2$ matrices. \[ \boxed{C = \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix}} \]
Was this answer helpful?
0