Guided Starter Example
Z[3,2] — row 3, column 2 — equals the dot product of row 3 of Aᵀ with column 2 of W. If row 3 of Aᵀ = [0.1, 0.2] and column 2 of W = [5, 6], then Z[3,2] = 0.1×5 + 0.2×6 = 0.5 + 1.2 = 1.7.
The general formula for AᵀW — computing every element systematically from rows and columns.
The general rule: element Z[i,j] = dot(row i of Aᵀ, column j of W). This is all you need to compute any element of a matrix product.
Worked example: A is (2×3), W is (2×4):
Colour intuition: each row of Aᵀ (one colour) influences an entire row of Z. Each column of W (another colour) influences an entire column of Z. The intersection element at (row i, col j) comes from row i of Aᵀ and column j of W.
Why this matters for neural networks: A_in has shape (batch, n_in). W has shape (n_in, n_units). Z = A_in × W gives (batch, n_units) — all pre-activations for all examples at once. The rule above explains every element of that output.
Matching dimensions as taking dot products: the inner dimension (n_in) is the length of both vectors being dot-producted. That's why dimensions must match — you can't dot-product vectors of different lengths.
Source-backed reinforcement: these points add detail beyond short-duration UI hints and emphasize production tradeoffs.
First-time learner note: Read each model as a dataflow system: inputs become representations, representations become scores, and scores become decisions through a chosen loss and thresholding policy.
Production note: Track three things relentlessly in ML systems: data shape contracts, evaluation methodology, and the operational meaning of the model's errors. Most expensive failures come from one of those three.
Shape-checking is a first-class engineering skill. The matrix-multiplication rules are not just exam material; they are your quickest defense against silent modeling mistakes. If you can derive the expected output shape before running the code, you catch a whole class of bugs early.
Practical checklist: identify the batch axis, identify the feature axis, confirm the inner dimensions match for every matmul, and only then inspect the numerical values. Correct math starts with correct shapes.
Exhaustive coverage points to ensure complete topic understanding without missing core concepts.
Z[3,2] — row 3, column 2 — equals the dot product of row 3 of Aᵀ with column 2 of W. If row 3 of Aᵀ = [0.1, 0.2] and column 2 of W = [5, 6], then Z[3,2] = 0.1×5 + 0.2×6 = 0.5 + 1.2 = 1.7.
Guided Starter Example
Z[3,2] — row 3, column 2 — equals the dot product of row 3 of Aᵀ with column 2 of W. If row 3 of Aᵀ = [0.1, 0.2] and column 2 of W = [5, 6], then Z[3,2] = 0.1×5 + 0.2×6 = 0.5 + 1.2 = 1.7.
Source-grounded Practical Scenario
The general formula for AᵀW — computing every element systematically from rows and columns.
Source-grounded Practical Scenario
Here's the matrix A, which is a 2 by 3 matrix because it has two rows and three columns.
Concept-to-code walkthrough checklist for this topic.
Questions an interviewer is likely to ask about this topic. Think through your answer before reading the senior angle.
Test yourself before moving on. Flip each card to check your understanding — great for quick revision before an interview.
Drag to reorder the architecture flow for Matrix Multiplication Rules. This is designed as an interview rehearsal for explaining end-to-end execution.
Drag to reorder the architecture flow for Matrix Multiplication Rules. This is designed as an interview rehearsal for explaining end-to-end execution.
Start flipping cards to track your progress
What is the formula for element Z[i,j] in Z = A×B?
tap to reveal →Z[i,j] = dot(row i of A, column j of B). A single dot product between two vectors of matching length.