Matrix Multiplication Calculator

This calculator multiplies two matrices of any compatible size. Enter the dimensions and values for each matrix, then click "Multiply Matrices" to compute the product \( A \times B \).

Important: For matrix multiplication to be defined, the number of columns in Matrix A must equal the number of rows in Matrix B.

How Matrix Multiplication Works:

  1. Compatibility Check: If Matrix A is \( m \times n \) and Matrix B is \( p \times q \), multiplication is only possible if \( n = p \).
  2. Result Dimensions: The resulting matrix will have dimensions \( m \times q \).
  3. Element Calculation: The element at position \((i, j)\) in the result is the dot product of row \(i\) from Matrix A and column \(j\) from Matrix B: \[ (AB)_{ij} = \sum_{k=1}^{n} a_{ik} \times b_{kj} \]
  4. Example: If \( A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \) and \( B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} \), then: \[ AB = \begin{bmatrix} 1\times5 + 2\times7 & 1\times6 + 2\times8 \\ 3\times5 + 4\times7 & 3\times6 + 4\times8 \end{bmatrix} = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix} \]
Matrix A
Matrix A
Matrix B
Matrix B

Multiplication Result

Note: Matrix multiplication is not commutative in general. That is, \( A \times B \neq B \times A \) in most cases.