A layer in a neural network multiplies a 3x2 matrix by a 2x4 matrix. What are the dimensions of the resulting matrix?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the trick with matrix multiplication: the two 'inner' numbers have to match, and they disappear, while the two 'outer' numbers stick around to form your answer's shape. You've got a 3x2 matrix times a 2x4 matrix — those inner 2's match (good, this multiplication is even legal), and the outer numbers, 3 and 4, become your result. So the answer is a 3x4 matrix, option A. A 2x2 result would come from multiplying a 2xN by an Nx2 matrix, not this pair. Keeping the first matrix's shape (3x2) as the answer ignores that multiplication actually transforms the shape. And 6x8 looks like someone just multiplied all four numbers together, which isn't how matrix multiplication dimensions work at all.
Full explanation below image
Full Explanation
For matrix multiplication A x B to be defined, the number of columns in A must equal the number of rows in B. Here, A is 3x2 (3 rows, 2 columns) and B is 2x4 (2 rows, 4 columns). The inner dimensions (2 and 2) match, so the multiplication is valid, and the resulting matrix takes the outer dimensions: the row count of A (3) and the column count of B (4), producing a 3x4 matrix. Each entry in the result is computed as the dot product of a row from A and a column from B, which is exactly why the inner dimensions must agree — you need equally-sized vectors to take a dot product.
The second option, 2x2, would only be correct if you were multiplying a matrix with 2 columns by a matrix with 2 rows and the outer dimensions also happened to both be 2 (for example, a 2x3 matrix times a 3x2 matrix). It does not match the given shapes.
The third option, 3x2, simply repeats the shape of the first input matrix. This misconception treats matrix multiplication as if it preserves the first operand's shape, ignoring that the operation produces a new shape determined jointly by both matrices' outer dimensions.
The fourth option, 6x8, appears to come from multiplying every dimension together (3x2 and 2x4 as if forming a 6 and an 8), which is not how matrix multiplication works; it may be confused with an unrelated operation like a Kronecker product, which does combine dimensions multiplicatively, but that is a distinct operation from standard matrix multiplication.
Memory aid: write the two shapes side by side, "(3x2)(2x4)" — cross out the matching inner numbers, and whatever's left over, in order, is your answer's shape: 3x4. This rule underlies why layer weight matrices in neural networks must be shaped precisely to match the incoming activation dimension.