keencalculator
  1. Home
  2. Math
  3. Matrix Calculator

Matrix Calculator

Enter one or two matrices up to 3 × 3 to add, subtract or multiply them, or to find the determinant, inverse or transpose of A. Everything is worked out with exact fractions, so an inverse shows 3/2 rather than 1.4999999, and the working for the determinant or the first entry of a product is written out.

Quick examples

Rows separated by semicolons, numbers by spaces or commas: 1 2; 3 4. Fractions such as 1/2 are fine.

Your numbers stay in your browser. They are never uploaded.
Result[19, 22; 43, 50]
Result in decimals
[19, 22; 43, 50]
Size of the result
2 × 2
Determinant of A
-2
Working
Each entry is a row of A times a column of B: entry (1, 1) = 1 × 5 + 2 × 7 = 19

Result, row by row

RowColumn 1Column 2Column 3

Saved setups

Save a set of inputs you reuse — your usual rate, your loan, your room sizes — and load it back in one tap.

    Your recent calculations

    Results you calculate here are kept on this device so you can come back to them.

      Also free on iPhone and Mac

      Formula

      (A ± B) entry by entry: (A ± B)ᵢⱼ = Aᵢⱼ ± Bᵢⱼ, for matrices of the same size
      (A × B)ᵢⱼ = row i of A times column j of B = Aᵢ₁B₁ⱼ + Aᵢ₂B₂ⱼ + …
      det [a b; c d] = ad − bc
      det [a b c; d e f; g h i] = a(ei − fh) − b(di − fg) + c(dh − eg)
      A⁻¹ = adj(A) ÷ det(A); for a 2 × 2, [a b; c d]⁻¹ = [d −b; −c a] ÷ (ad − bc)
      Transpose: (Aᵀ)ᵢⱼ = Aⱼᵢ, so rows become columns

      How to use it

      1. Choose the operation.
      2. Type matrix A row by row with a semicolon between rows, such as 1 2; 3 4. Fractions and decimals are fine.
      3. For A + B, A − B or A × B, type matrix B the same way.
      4. Read the result in brackets, row by row, or in the table below.

      Worked examples

      [1 2; 3 4] × [5 6; 7 8]

      Result
      [19, 22; 43, 50]
      Size of the result
      2 × 2
      Determinant of A
      -2
      Working
      Each entry is a row of A times a column of B: entry (1, 1) = 1 × 5 + 2 × 7 = 19

      Inverse of [1 2; 3 4], as exact fractions

      Result
      [-2, 1; 3/2, -1/2]
      Result in decimals
      [-2, 1; 1.5, -0.5]

      Determinant of a 3 × 3 matrix by cofactor expansion

      Result
      -59
      Working
      2(4 × 0 − 1 × 2) − 1(0 × 0 − 1 × 5) + 3(0 × 2 − 4 × 5) = 2 × (-2) − 1 × (-5) + 3 × (-20) = -59

      Inverse of a 3 × 3 matrix with determinant 5

      Result
      [1/5, 3/5, -1/5; -1/5, 2/5, 1/5; 3/5, -6/5, 2/5]
      Determinant of A
      5

      Subtracting two 3 × 3 matrices

      Result
      [-8, -6, -4; -2, 0, 2; 4, 6, 8]
      Determinant of A
      0

      Transpose of a 2 × 3 matrix

      Result
      [1, 4; 2, 5; 3, 6]
      Size of the result
      3 × 2

      A matrix with no inverse

      Determinant of A
      0
      Working
      The determinant of A is 0, so A has no inverse

      Rules that trip people up

      Matrix multiplication is not commutative: A × B and B × A are usually different, and one of them may not exist at all. A × B needs the number of columns of A to equal the number of rows of B; a 2 × 3 matrix times a 3 × 2 matrix gives a 2 × 2.

      Only square matrices have determinants and inverses, and only those with a determinant other than 0 can be inverted. [1 2; 2 4] has determinant 1 × 4 − 2 × 2 = 0, because its second row is twice the first, so it has no inverse.

      Checking an inverse

      Multiply the matrix by its inverse and you should get the identity matrix, with 1s on the diagonal and 0s everywhere else. For [1 2; 3 4] and its inverse [−2 1; 3/2 −1/2], row 1 times column 1 is 1 × (−2) + 2 × 3/2 = 1, and row 1 times column 2 is 1 × 1 + 2 × (−1/2) = 0.

      Questions people ask

      What is the determinant of [1 2; 3 4]?

      −2. Multiply down each diagonal and subtract: 1 × 4 − 2 × 3 = 4 − 6 = −2.

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

      Swap a and d, change the signs of b and c, and divide everything by the determinant ad − bc. For [1 2; 3 4] that is [4 −2; −3 1] ÷ (−2) = [−2 1; 1.5 −0.5].

      Can you multiply a 2 × 3 matrix by a 3 × 2 matrix?

      Yes. The inner sizes match (3 and 3), and the answer takes the outer sizes, so it is 2 × 2.

      Why does my matrix have no inverse?

      Its determinant is 0, which happens when one row or column can be made from the others. Such a matrix is called singular.

      Related calculators