How To Multiply Matrices?

Ensure the number of columns in the first matrix equals the number of rows in the second matrix

Let matrix (A) be (m times n) and matrix (B) be (n times p)

Compute the product matrix (C = AB), which will be (m times p)

For each position ((i, j)) in (C), compute

(C_{ij} = sum_{k=1}^{n} A_{ik} cdot B_{kj})

Repeat the computation for all (i = 1, dots, m) and (j = 1, dots, p)

Check dimensions to confirm the result is (m times p)

Note that matrix multiplication is generally not commutative ((AB neq BA))

Suggested for You

Trending Today