Skip to content

Matrix Calculator

Enter a matrix up to 6 × 6 — whole numbers, decimals or fractions — and choose an operation: inverse, determinant, row reduction, rank, transpose, sum, difference, product, scalar multiple, power or trace. Every answer is exact, and the row operations or entry-by-entry working are written out underneath. Free, no sign-up, and nothing leaves your browser.

Matrix A

Whole numbers, decimals or fractions such as 3/4.

Results

Inverse A⁻¹

001
−213
3−1−5

3 × 3 matrix

Check: A × A⁻¹ equals the identity matrix.

The working

Write A next to the identity matrix and row-reduce the left half to I. The same operations turn the right half into A⁻¹.

Row operations (9 steps)
  1. Starting matrix

    211100
    132010
    100001
  2. Step 1: R1 → (1/2) × R1

    11/21/21/200
    132010
    100001
  3. Step 2: R2 → R2 − R1

    11/21/21/200
    05/23/2−1/210
    100001
  4. Step 3: R3 → R3 − R1

    11/21/21/200
    05/23/2−1/210
    0−1/2−1/2−1/201
  5. Step 4: R2 → (2/5) × R2

    11/21/21/200
    013/5−1/52/50
    0−1/2−1/2−1/201
  6. Step 5: R1 → R1 − (1/2) × R2

    101/53/5−1/50
    013/5−1/52/50
    0−1/2−1/2−1/201
  7. Step 6: R3 → R3 + (1/2) × R2

    101/53/5−1/50
    013/5−1/52/50
    00−1/5−3/51/51
  8. Step 7: R3 → (−5) × R3

    101/53/5−1/50
    013/5−1/52/50
    0013−1−5
  9. Step 8: R1 → R1 − (1/5) × R3

    100001
    013/5−1/52/50
    0013−1−5
  10. Step 9: R2 → R2 − (3/5) × R3

    100001
    010−213
    0013−1−5

How to Use the Matrix Calculator

  1. 1. Pick the operation. Inverse, determinant, RREF and rank use one matrix. Add, subtract and multiply also show a matrix B; for a product you choose how many columns B has, and its rows follow the columns of A.
  2. 2. Set the size and fill in the entries. Use the rows and columns menus, then type each entry. Fractions such as 3/4 stay exact. If you type a decimal, the answer is written in decimals wherever they terminate.
  3. 3. Read the answer. The result matrix appears first, with a button to copy it as tab-separated text that pastes straight into a spreadsheet.
  4. 4. Follow the working. Row operations are numbered, and the pivot of each one is shaded. Products, sums and scalar multiples list how every entry was built.

Matrix Operations in Brief

OperationRuleRequires
A + B, A − BAdd or subtract entries in the same positionSame size
A × BEntry (i, j) is row i of A dotted with column j of BColumns of A = rows of B
k × AMultiply every entry by kAny size
AᵀRows become columnsAny size
det AA single number that is 0 exactly when A is singularSquare
A⁻¹The matrix with A × A⁻¹ = ISquare, det A ≠ 0
RankThe number of pivots in the RREFAny size

Matrix multiplication is not commutative: A × B and B × A are usually different, and one may exist when the other does not.

How the Inverse Is Found

The calculator uses Gauss–Jordan elimination. Write A beside the identity matrix to form the augmented matrix [A | I], then apply row operations — swap two rows, scale a row, add a multiple of one row to another — until the left half is the identity. The right half is then A⁻¹. If a column has no pivot, A is singular and has no inverse. For a 2 × 2 matrix there is also a closed form: the inverse of [a b; c d] is 1/(ad − bc) times [d −b; −c a].

Worked Example: Inverting a 3 × 3 Matrix

Take A with rows (2, 1, 1), (1, 3, 2) and (1, 0, 0), which is the calculator's starting matrix. Reducing [A | I] takes nine row operations:

  1. R1 → (1/2) × R1
  2. R2 → R2 − R1
  3. R3 → R3 − R1
  4. R2 → (2/5) × R2
  5. R1 → R1 − (1/2) × R2
  6. R3 → R3 + (1/2) × R2
  7. R3 → (−5) × R3
  8. R1 → R1 − (1/5) × R3
  9. R2 → R2 − (3/5) × R3

The right half now reads (0, 0, 1), (−2, 1, 3), (3, −1, −5), so A⁻¹ has those rows. Cofactor expansion along the first row confirms that the matrix is invertible: det A = 2 × (0) − 1 × (−2) + 1 × (−3) = −1. Because the determinant is −1, every entry of the inverse is a whole number.

Determinant, Rank and RREF

For a 3 × 3 matrix the calculator expands along the first row: each entry is multiplied by its sign (+, −, +) and by the determinant of the 2 × 2 minor left when its row and column are deleted. For 4 × 4 and larger it row-reduces to an upper-triangular matrix and multiplies the diagonal, flipping the sign once for every row swap. A multiple of one row added to another never changes the determinant.

The reduced row echelon form (RREF) has a leading 1 in each non-zero row, zeros above and below every leading 1, and the leading 1s stepping to the right. The number of leading 1s is the rank. The rows (1, 2, 3), (4, 5, 6), (7, 8, 9) reduce to (1, 0, −1), (0, 1, 2), (0, 0, 0): rank 2, nullity 1, and a null-space vector (1, −2, 1). That agrees with det = 0 — the third row is twice the second minus the first.

Multiplying the starting matrix A by the matrix B with rows (1, 0, 2), (0, 1, 1), (3, 0, 1) gives rows (5, 1, 6), (7, 3, 7), (1, 0, 2). Reversing the order, B × A, gives (4, 1, 1), (2, 3, 2), (7, 3, 3) — a different matrix.

Frequently Asked Questions

How do you find the inverse of a matrix?
Place the matrix next to the identity matrix and row-reduce until the left side becomes the identity; the right side is then the inverse. A square matrix has an inverse only if its determinant is not zero. For 2 × 2 matrices you can also use the formula with 1/(ad − bc).
What does a determinant of zero mean?
The matrix is singular: its rows (and columns) are linearly dependent, it has rank below n, and it has no inverse. Geometrically, the transformation it describes flattens space onto a lower dimension, so it cannot be undone.
Why can't I multiply these two matrices?
The product A × B exists only when the number of columns of A equals the number of rows of B. A 2 × 3 matrix can multiply a 3 × 4 matrix and gives a 2 × 4 result, but not a 2 × 4 matrix.
What is the rank of a matrix?
The rank is the number of linearly independent rows, which equals the number of independent columns and the number of pivots in the RREF. A full-rank square matrix is invertible. The nullity, columns minus rank, counts the free variables of Ax = 0.
Are the answers exact or rounded?
Exact. Entries are stored as fractions of arbitrarily large whole numbers, so 1/3 stays 1/3 and an inverse is never off by a rounding error. Decimals you type are converted to exact fractions first, and the answer is shown as a decimal only when it terminates.
What is the difference between RREF and row echelon form?
Row echelon form only requires zeros below each leading entry. Reduced row echelon form goes further: every leading entry is 1 and has zeros above it too. RREF is unique for a given matrix, which is why the calculator reports it.

Related Tools

More in Math Calculators

See all Math Calculators