Matrix calculator: inverse, determinant, multiply and more

Add, subtract and multiply matrices, or find a determinant, inverse, rank, RREF or power, up to 6 × 6, in exact fractions with the row operations shown. Runs on your device.

How it works

  1. Type matrix A, one row per line, with spaces or commas between entries
  2. Pick an operation, and type matrix B for add, subtract or multiply
  3. Read the exact result and open the steps for determinants, inverses, rank and RREF

What the matrix calculator does

A matrix calculator adds, subtracts and multiplies matrices, and finds the determinant, inverse, rank, row-reduced form (RREF), transpose and powers of a matrix, here up to 6 × 6. The page opens on A = [[4, 7], [2, 6]] with the inverse selected. The determinant is 4 × 6 − 7 × 2 = 10, so the inverse exists and equals (1 ÷ 10) × [[6, −7], [−2, 4]] = [[3/5, −7/10], [−1/5, 2/5]]. The steps box shows the row operations that produce it. Type each row on its own line, with spaces, commas or tabs between entries. Pasted forms like [[1, 2], [3, 4]] and 1 2; 3 4 are read too.

Exact fractions, not rounded decimals

Every entry is kept as a fraction in exact whole-number arithmetic. 1/3 stays 1/3, and 0.1 is read as 1/10, not as the nearest binary number. That is why the Hilbert matrix with entries 1/(i + j − 1) has an exact determinant here: for the 3 × 3 case it is 1/2160, and its inverse is [[9, −36, 30], [−36, 192, −180], [30, −180, 180]]. A floating-point tool shows noise in digits like that. Switch Show numbers as to Decimals for readable output; the fractions stay exact underneath and only the display is rounded. Results stop with a message if a number grows beyond 200 digits.

Determinant, inverse, rank and RREF by row operations

The determinant is found by row-reducing to upper triangular form: subtracting a multiple of one row from another changes nothing, each swap of two rows flips the sign, and the determinant is the product of the diagonal times that sign. The inverse is found by Gauss-Jordan: write A beside the identity matrix and row-reduce until the left half is the identity; the right half is the inverse. If a column has no pivot, the determinant is 0 and there is no inverse, as for [[1, 2], [2, 4]]. RREF makes every pivot 1 and clears its column, and the rank is the number of pivots. [[1, 2, 3], [4, 5, 6], [7, 8, 9]] has RREF [[1, 0, −1], [0, 1, 2], [0, 0, 0]], so its rank is 2 and its determinant is 0.

Multiplying, powers and the shapes that work

Multiplication needs the columns of A to equal the rows of B, and the result has the rows of A and the columns of B. [[1, 2], [3, 4]] × [[5, 6], [7, 8]] is [[19, 22], [43, 50]]: for the top-left entry, 1 × 5 + 2 × 7 = 19. The steps list every entry that way. Order matters, so A × B and B × A usually differ. Add and subtract need two matrices of the same size. Power takes a whole number from −20 to 20: [[1, 1], [1, 0]] to the power 10 is [[89, 55], [55, 34]], the Fibonacci numbers, and a negative power uses the inverse. Determinant, inverse and power need a square matrix; rank, RREF and transpose do not.

Limits

The size is limited to 6 × 6 and 5,000 characters per matrix. Entries can be whole numbers, decimals such as 0.5, fractions such as 1/2 or numbers with an exponent such as 1e-3. A decimal comma is not read. Complex numbers and symbols are not supported, and neither are eigenvalues, LU decomposition or solving linear systems. For long step lists, such as a 6 × 6 with long fractions, the steps are cut after 20,000 characters with a note; the result is always complete. The steps show the row operations the page used, which may differ from the order you would choose by hand.

Frequently asked questions

How do I find the inverse of a 2 × 2 matrix?

Swap the diagonal entries, change the signs of the other two, and divide by the determinant: for [[a, b], [c, d]] the inverse is (1 ÷ (ad − bc)) × [[d, −b], [−c, a]]. For [[4, 7], [2, 6]] the determinant is 10 and the inverse is [[3/5, −7/10], [−1/5, 2/5]].

Why does the calculator say there is no inverse?

A matrix has an inverse only if its determinant is not 0. [[1, 2], [2, 4]] has determinant 1 × 4 − 2 × 2 = 0 because its second row is twice the first. The steps show where a pivot is missing, and the rank, which is 1 here, is less than the 2 rows.

How do I multiply two matrices?

Each entry of the result is a row of A times a column of B: add up the products of matching entries. A must have as many columns as B has rows. A 2 × 3 matrix times a 3 × 2 matrix gives a 2 × 2 matrix: [[1, 2, 3], [4, 5, 6]] × [[7, 8], [9, 10], [11, 12]] = [[58, 64], [139, 154]].

What is the rank of a matrix and how is it found?

The rank is the number of pivots after row reduction to RREF, which equals the number of independent rows. [[1, 2, 3], [4, 5, 6], [7, 8, 9]] has rank 2, because the third row equals twice the second row minus the first. Choose Rank and the steps show the pivots.

How do I enter a matrix?

One row per line, with spaces, commas or tabs between entries: 4 7 on the first line and 2 6 on the second. Rows separated by semicolons (4 7; 2 6) and bracket forms like [[4, 7], [2, 6]] also work, as do pasted spreadsheet cells. Every row needs the same number of entries, up to 6 rows and 6 columns.

Is my matrix uploaded?

No. The matrices are processed in your browser, in this tab, and no server receives them. Your choices of operation and display are saved in this browser, but the matrices are not, so closing the tab clears them. Google Analytics counts visits and copy presses, never the entries.