Matrix A (Rows × Cols):
2
×
3
Matrix B (Rows × Cols):
3
×
2
Matrix A
×
Matrix B
Advertisement Slot

How Matrix Multiplication Works

Unlike simple numbers, matrix multiplication is not entry-by-entry multiplication. Instead, it is defined through the dot product between the row vectors of the first matrix and the column vectors of the second matrix.

The Compatibility Rule & Dot Product Formula:

\((A)_{m \times k} \times (B)_{k \times n} = (C)_{m \times n}, \quad \text{where } C_{ij} = \sum_{r=1}^{k} A_{ir} B_{rj}\)

The inner dimensions must match (\(k = k\)). The outer dimensions determine the result size (\(m \times n\)).

Why is Matrix Multiplication Non-Commutative?

In algebra, \(5 \times 3 = 3 \times 5\). In linear algebra, however:

\(A B \ne B A\)

Each matrix represents a linear transformation (such as a rotation, scaling, or shearing). Performing transformation \(B\) first followed by \(A\) usually yields a completely different spatial result than performing \(A\) first followed by \(B\).

Solved Examples with Complete Step-by-Step Dot Products

Example 1: Multiplying (2×3) by (3×2) Matrices

Given matrices \(A\) and \(B\):

\(A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}, \quad B = \begin{bmatrix} 7 & 8 \\ 9 & 1 \\ 2 & 3 \end{bmatrix}\)

Step 1: Verify Dimensions:

\(A\) is \((2 \times 3)\) and \(B\) is \((3 \times 2)\). Inner dimension \(3 = 3\), so multiplication is valid. Resulting matrix \(C\) will be \((2 \times 2)\).

Step 2: Calculate each entry as a dot product:

  • \(C_{11} = \text{Row } 1 \cdot \text{Col } 1 = (1)(7) + (2)(9) + (3)(2) = 7 + 18 + 6 = 31\)
  • \(C_{12} = \text{Row } 1 \cdot \text{Col } 2 = (1)(8) + (2)(1) + (3)(3) = 8 + 2 + 9 = 19\)
  • \(C_{21} = \text{Row } 2 \cdot \text{Col } 1 = (4)(7) + (5)(9) + (6)(2) = 28 + 45 + 12 = 85\)
  • \(C_{22} = \text{Row } 2 \cdot \text{Col } 2 = (4)(8) + (5)(1) + (6)(3) = 32 + 5 + 18 = 55\)

Step 3: Assemble Product Matrix \(C\):

\(C = AB = \begin{bmatrix} 31 & 19 \\ 85 & 55 \end{bmatrix}\)

Example 2: 2×2 Multiplication with Negative Numbers and Fractions

Compute \(P \times Q\):

\(P = \begin{bmatrix} 2 & -1 \\ 3 & 4 \end{bmatrix}, \quad Q = \begin{bmatrix} \frac{1}{2} & 0 \\ -2 & 3 \end{bmatrix}\)

Dot products:

  • \(C_{11} = (2)\left(\frac{1}{2}\right) + (-1)(-2) = 1 + 2 = 3\)
  • \(C_{12} = (2)(0) + (-1)(3) = 0 - 3 = -3\)
  • \(C_{21} = (3)\left(\frac{1}{2}\right) + (4)(-2) = \frac{3}{2} - 8 = -\frac{13}{2}\)
  • \(C_{22} = (3)(0) + (4)(3) = 0 + 12 = 12\)

\(PQ = \begin{bmatrix} 3 & -3 \\ -\frac{13}{2} & 12 \end{bmatrix}\)

Master Matrix Multiplication

Learn row-column rules, geometric composition of linear transformations, and tricks for multiplying matrices quickly.

Read our student tutorial: How to Multiply Matrices Step-by-Step →
Advertisement Slot

Frequently Asked Questions

Two matrices A and B can be multiplied (A x B) if and only if the number of columns in matrix A equals the number of rows in matrix B. If A is m x k and B is k x n, the product matrix C has dimension m x n.
No. In general, matrix multiplication is non-commutative: AB != BA. In fact, if A and B are rectangular, the reverse product BA may not even be defined.
Entry Cij in the product matrix is the dot product of Row i of matrix A with Column j of matrix B: Cij = Sum(Aik * Bkj) for k from 1 to the inner dimension.
No. The identity matrix I acts as the multiplicative identity: AI = IA = A for any compatible square or rectangular matrix.