No history yet

Dot Product Method

The Dot Product Method

Matrix multiplication hinges on a single, crucial rule: the number of columns in the first matrix must match the number of rows in the second. If you have an m×nm \times n matrix (A) and an n×pn \times p matrix (B), you can multiply them. The inner dimensions (nn) must be the same. The resulting matrix (C) will have the outer dimensions: m×pm \times p.

Think of it like a relay race. The first matrix's rows are the runners, and each runner must complete a number of legs equal to the number of columns. The second matrix's columns are the batons, and each baton must be passed by a number of runners equal to its number of rows. The dimensions must match for the handoff to work.

Each element in the product matrix is calculated using what's called a of a row from the first matrix and a column from the second. To find the element in row ii and column jj of the product matrix, you take row ii from matrix A and column jj from matrix B. You multiply their corresponding elements and then sum the results.

A Step-by-Step Example

Let's see this in action. We'll multiply a 2×32 \times 3 matrix A by a 3×23 \times 2 matrix B. The result, C, will be a 2×22 \times 2 matrix.

A=(123456),B=(789101112)A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}, \quad B = \begin{pmatrix} 7 & 8 \\ 9 & 10 \\ 11 & 12 \end{pmatrix}

First, we calculate the element in the first row, first column of C, which we call C11C_{11}. We take the first row of A and the first column of B.

C11=(1)(7)+(2)(9)+(3)(11)=7+18+33=58C_{11} = (1)(7) + (2)(9) + (3)(11) = 7 + 18 + 33 = 58

We follow the same pattern for the other three elements.

For C12C_{12}, we use row 1 of A and column 2 of B: (1)(8)+(2)(10)+(3)(12)=8+20+36=64(1)(8) + (2)(10) + (3)(12) = 8 + 20 + 36 = 64.

For C21C_{21}, we use row 2 of A and column 1 of B: (4)(7)+(5)(9)+(6)(11)=28+45+66=139(4)(7) + (5)(9) + (6)(11) = 28 + 45 + 66 = 139.

For C22C_{22}, we use row 2 of A and column 2 of B: (4)(8)+(5)(10)+(6)(12)=32+50+72=154(4)(8) + (5)(10) + (6)(12) = 32 + 50 + 72 = 154.

Assembling these values gives us our final product matrix, C.

C=(5864139154)C = \begin{pmatrix} 58 & 64 \\ 139 & 154 \end{pmatrix}

Formalising the Process

This row-by-column process can be described more formally using which is a compact way to represent the sum of many similar terms.

[C]ij=k=1nAikBkj[C]_{ij} = \sum_{k=1}^{n} A_{ik} B_{kj}

This might look intimidating, but it's just a formal way of stating the "multiply corresponding elements and add them up" rule we just practiced. Getting comfortable with this method is the key to mastering matrix multiplication.