Skip to content

Matrix Calculator

Multiply, add, invert and transpose matrices.

Inputs

Loading calculator…
Calculating…

Use this calculator on your own site

Free embed

  • Two lines of HTML, unlimited views
  • Shows a small CalculateEveryday bar, with a credit link under the calculator

Formula

(A × B)ᵢⱼ = Σₖ Aᵢₖ·Bₖⱼ — row i of A times column j of B. Inverse: row-reduce [A | I] until the left side is I; the right side is A⁻¹

Addition and subtraction work entry by entry and need matrices of the same size. Multiplication pairs each row of A with each column of B, so A must have as many columns as B has rows. The inverse is found by writing A beside the identity matrix and row-reducing; if a pivot turns out to be zero the determinant is zero and no inverse exists.

Worked example

For A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], the top-left entry is 1×5 + 2×7 = 19 and the top-right is 1×6 + 2×8 = 22. The bottom row gives 43 and 50, so A × B = [[19, 22], [43, 50]].

Where this can give the wrong answer

  • Order matters: A × B is generally not B × A. With the example matrices, B × A is [[23, 34], [31, 46]].
  • Only square matrices have a determinant or an inverse, and only those with a non-zero determinant have an inverse.
  • Inverses are computed in floating point and shown to four decimals. An entry such as 1/3 appears as 0.3333, and a nearly singular matrix can produce large, unreliable entries.
  • Matrices up to 6 × 6 are accepted. Every row needs the same number of entries or the page says which matrix is ragged.

FAQ

Entries separated by spaces or commas, rows separated by semicolons. 1 2 3; 4 5 6 is a matrix with 2 rows and 3 columns.

Need this calculator, but different?

MakeACalc turns a plain-English description into an embeddable calculator — formula and worked example included. Launching soon.