ZestCalc

Matrix Multiplication Calculator

Multiply two to four matrices with exact fractions, see how every entry is computed, and move data in and out as Python lists.

Matrices

Each tab is one matrix. The product multiplies them in tab order, so A·B·C means (A·B)·C.

Up to 12 rows and 12 columns.

Use integers, decimals, or fractions such as 1/3. Paste rows from a spreadsheet or a Python list into any cell.

Inputs

A=[123456]A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}
B=[789101112]B = \begin{bmatrix} 7 & 8 \\ 9 & 10 \\ 11 & 12 \end{bmatrix}

Product

Updates as you type.

A⋅B=A \cdot B =

(2×3)(3×2)→2×2(2\times3)(3\times2) \to 2\times2

How an entry is computed

Select any entry of the product to see the row-times-column sum behind it.

Entry (1, 1) multiplies row 1 of A by column 1 of B, pairing values in order and adding the products.

(AB)11=1⋅7+2⋅9+3⋅11=7+18+33=58(AB)_{11} = 1 \cdot 7 + 2 \cdot 9 + 3 \cdot 11 = 7 + 18 + 33 = 58

How matrix multiplication works

You can multiply AA by BB only when AA has as many columns as BB has rows. If AA is m×nm \times n and BB is n×pn \times p, the product ABAB is m×pm \times p.

Each entry of the product is a row of AA multiplied by a column of BB: pair the values in order, multiply each pair, and add the results.

(AB)ij=∑k=1naik bkj(AB)_{ij} = \sum_{k=1}^{n} a_{ik}\, b_{kj}

For example, the top-left entry below is 1⋅5+2⋅7=191 \cdot 5 + 2 \cdot 7 = 19:

[1234][5678]=[19224350]\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}

Order matters

ABAB and BABA are usually different, and BABA may not even be defined. With three or more matrices, grouping does not change the answer, (AB)C=A(BC)(AB)C = A(BC), but the order of the matrices does. This calculator always multiplies the tabs from left to right.

Tips for using the calculator

  • Enter integers, decimals, or fractions such as 1/3. Results are exact; switch to Decimals for a rounded view.
  • Paste a block copied from a spreadsheet, or a Python or NumPy list such as [[1, 2], [3, 4]], into any cell to fill the grid at once.
  • Copy list gives you a Python list that works directly with numpy.array(...).
  • Use the dashed zones at the right and bottom edges of the grid to add a column or a row.
  • Select any entry of the product to see the sum behind it.

To solve Ax=bAx = b instead of multiplying, try the System of Linear Equations Calculator.