Algebra & Calculus

Matrix Calculator

Enter matrices as rows separated by semicolons, for example 1 2; 3 4. Add, subtract, multiply, transpose, or find a determinant or inverse up to 4×4. Results are exact fractions, not rounded decimals.

Rows separated by ; entries by spaces. Fractions such as 1/2 work.
Try an example:
Answer
A⁻¹:
[   −2     1 ]
[  3/2  −1/2 ]
  • det(A) = −2
Step-by-step working 8 steps
  1. 1
    The matrices
    A (2×2):
    [ 1  2 ]
    [ 3  4 ]
  2. 2
    Check that an inverse exists

    A matrix has an inverse exactly when its determinant is not 0.

  3. 3
    2×2 determinant: ad − bc
    (1)(4) − (2)(3) = −2
  4. 4
    Augment with the identity matrix
    [ 1  2 | 1  0 ]
    [ 3  4 | 0  1 ]

    Row-reduce the left side to the identity; the right side then becomes the inverse.

  5. 5
    Clear column 1
    R2 −= (3) × R1
    [ 1  2 | 1  0 ]
    [ 0  −2 | −3  1 ]
  6. 6
    Clear column 2
    R2 ÷ −2,  R1 −= (2) × R2
    [ 1  0 | −2  1 ]
    [ 0  1 | 3/2  −1/2 ]
  7. 7
    The inverse
    A⁻¹:
    [   −2     1 ]
    [  3/2  −1/2 ]
  8. 8
    Check: A × A⁻¹
    [ 1  0 ]
    [ 0  1 ]

    The product is the identity matrix, so the inverse is correct.

How to use the matrix calculator

  1. Choose the operation.
  2. Type matrix A (and B if needed) with ; between rows.
  3. Press Solve and read each row operation or dot product.
  4. Check the verification step at the end.

Matrix rules

(A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ
(AB)ᵢⱼ = Σₖ Aᵢₖ·Bₖⱼ  (columns of A = rows of B)
det [[a,b],[c,d]] = ad − bc
A⁻¹ exists exactly when det A ≠ 0
A·A⁻¹ = I

Inverses are found by Gauss-Jordan elimination on [A | I] and verified by multiplying back to the identity.

Worked examples

Each example below is generated by the same calculator you used above, so the working always matches the answer.

Inverse of [[1,2],[3,4]]
Answer
A⁻¹:
[   −2     1 ]
[  3/2  −1/2 ]
  • det(A) = −2
Step-by-step working 8 steps
  1. 1
    The matrices
    A (2×2):
    [ 1  2 ]
    [ 3  4 ]
  2. 2
    Check that an inverse exists

    A matrix has an inverse exactly when its determinant is not 0.

  3. 3
    2×2 determinant: ad − bc
    (1)(4) − (2)(3) = −2
  4. 4
    Augment with the identity matrix
    [ 1  2 | 1  0 ]
    [ 3  4 | 0  1 ]

    Row-reduce the left side to the identity; the right side then becomes the inverse.

  5. 5
    Clear column 1
    R2 −= (3) × R1
    [ 1  2 | 1  0 ]
    [ 0  −2 | −3  1 ]
  6. 6
    Clear column 2
    R2 ÷ −2,  R1 −= (2) × R2
    [ 1  0 | −2  1 ]
    [ 0  1 | 3/2  −1/2 ]
  7. 7
    The inverse
    A⁻¹:
    [   −2     1 ]
    [  3/2  −1/2 ]
  8. 8
    Check: A × A⁻¹
    [ 1  0 ]
    [ 0  1 ]

    The product is the identity matrix, so the inverse is correct.

Multiply two 2×2
Answer
A × B (2×2):
[ 19  22 ]
[ 43  50 ]
Step-by-step working 3 steps
  1. 1
    The matrices
    A (2×2):
    [ 1  2 ]
    [ 3  4 ]
    
    B (2×2):
    [ 5  6 ]
    [ 7  8 ]
  2. 2
    Row of A times column of B
    entry (1,1) = (1)(5) + (2)(7) = 19
    entry (1,2) = (1)(6) + (2)(8) = 22
    entry (2,1) = (3)(5) + (4)(7) = 43
    entry (2,2) = (3)(6) + (4)(8) = 50

    Each entry of the product is the dot product of a row of A with a column of B: multiply the pairs, then add.

  3. 3
    Result (2×2)
    [ 19  22 ]
    [ 43  50 ]

    Matrix multiplication is not commutative: A × B is usually different from B × A.

3×3 determinant
Answer det(A) = −306
  • The determinant is non-zero, so A is invertible.
Step-by-step working 2 steps
  1. 1
    The matrices
    A (3×3):
    [  6   1   1 ]
    [  4  −2   5 ]
    [  2   8   7 ]
  2. 2
    Cofactor expansion along the first row
    + 6 × (−2·7 − 5·8) = + 6 × −54 = −324
    − 1 × (4·7 − 5·2) = − 1 × 18 = −18
    + 1 × (4·8 − −2·2) = + 1 × 36 = 36
    det = −306

    Each entry of row 1 is multiplied by the determinant of the 2×2 matrix left after deleting its row and column, with alternating signs + − +.

Add matrices
Answer
A + B (2×2):
[  6   8 ]
[ 10  12 ]
Step-by-step working 3 steps
  1. 1
    The matrices
    A (2×2):
    [ 1  2 ]
    [ 3  4 ]
    
    B (2×2):
    [ 5  6 ]
    [ 7  8 ]
  2. 2
    Add matching entries
    entry (1,1): 1 + 5 = 6
    entry (1,2): 2 + 6 = 8
    entry (2,1): 3 + 7 = 10
    entry (2,2): 4 + 8 = 12

    Matrices are added or subtracted entry by entry, so they must be the same size.

  3. 3
    Result
    [  6   8 ]
    [ 10  12 ]
Transpose a 2×3
Answer
Aᵀ (3×2):
[ 1  4 ]
[ 2  5 ]
[ 3  6 ]
Step-by-step working 3 steps
  1. 1
    The matrices
    A (2×3):
    [ 1  2  3 ]
    [ 4  5  6 ]
  2. 2
    Swap rows and columns

    The first row of A becomes the first column of Aᵀ, and so on.

  3. 3
    Aᵀ (3×2)
    [ 1  4 ]
    [ 2  5 ]
    [ 3  6 ]
Singular matrix
Answer No inverse (det = 0)
  • A is singular.
Step-by-step working 3 steps
  1. 1
    The matrices
    A (2×2):
    [ 1  2 ]
    [ 2  4 ]
  2. 2
    Check that an inverse exists

    A matrix has an inverse exactly when its determinant is not 0.

  3. 3
    2×2 determinant: ad − bc
    (1)(4) − (2)(2) = 0

Where you will use this

  • Linear-algebra and Algebra 2 matrix homework
  • Solving systems of equations with inverses
  • Computer-graphics ideas such as transformations

Common mistakes to avoid

Multiplying matrices entry by entry

Matrix multiplication is row-times-column, not entry-times-entry. Only addition and subtraction work entry by entry.

Assuming A × B = B × A

Matrix multiplication is not commutative; the order changes the answer, and sometimes one order is not even defined.

Inverting a matrix with determinant 0

A singular matrix has no inverse. Check the determinant first.

Frequently asked questions

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

Swap a and d, negate b and c, and divide everything by the determinant ad − bc. For [[1,2],[3,4]] the determinant is −2.

What size matrices does it support?

Up to 4 × 4 for the determinant and inverse, and any sizes up to 4 × 4 for add, subtract, multiply and transpose.

Why does it show fractions?

It uses exact rational arithmetic, so an inverse such as 3/2 is exactly 3/2, not 1.5000001.

Related calculators

Browse everything in Algebra & Calculus or the full calculator list.