Matrix Calculator

Type one or two matrices, pick an operation, and get the result as a table with the working: products, sums, determinants, inverses, transposes and rank.

Your results

–

Save this calculation and come back to it any time. Members only — $5 every 3 months, ad-free.

Become a member

How to use the matrix calculator

  1. Choose the operation: A + B, A − B, A × B, a number times A, or the transpose, determinant, inverse or rank of A.
  2. Type matrix A with one row per line and the numbers separated by spaces or commas. You can also put a whole matrix on one line with rows separated by semicolons, like 1 2; 3 4. Fractions such as 1/3 are fine.
  3. For sums, differences and products, type matrix B the same way. For a scalar multiple, enter the number k.
  4. The result appears as a table, with the matrices you entered shown underneath so you can check how they were read.

Matrices can be up to 6 rows by 6 columns.

How each operation works

(A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ same size only (A × B)ᵢⱼ = Aᵢ₁B₁ⱼ + Aᵢ₂B₂ⱼ + … + AᵢₙBₙⱼ columns of A = rows of B det [a b; c d] = ad − bc A⁻¹ = (1 / det A) × [d −b; −c a] for a 2 × 2 matrix

Addition and subtraction work entry by entry, so both matrices must be the same size. Multiplication takes each row of A and each column of B, multiplies matching entries and adds them up, so an m × n matrix times an n × p matrix gives an m × p result. The transpose turns rows into columns.

The determinant of a 2 × 2 matrix is ad − bc. For 3 × 3 the calculator expands along the first row, and for bigger matrices it row-reduces to a triangular matrix and multiplies the diagonal. The inverse exists only when the determinant is not 0; the calculator finds it by row-reducing [A | I] until the left half becomes the identity matrix, and shows it as fractions when A has whole-number entries. The rank is the number of nonzero rows left after row reduction: how many rows are truly independent.

Worked example

The calculator starts with A × B, where A = [1 2; 3 4] and B = [5 6; 7 8].

  1. Row 1 of A times column 1 of B: 1 × 5 + 2 × 7 = 19.
  2. Row 1 times column 2: 1 × 6 + 2 × 8 = 22.
  3. Row 2 times column 1: 3 × 5 + 4 × 7 = 43.
  4. Row 2 times column 2: 3 × 6 + 4 × 8 = 50.

So A × B = [19 22; 43 50], a 2 × 2 matrix. Switch to the determinant and you get det(A) = 1 × 4 − 2 × 3 = −2. Because that is not 0, A has an inverse: (1 / −2) × [4 −2; −3 1] = [−2 1; 1.5 −0.5], or [−2 1; 3/2 −1/2] as fractions.

Things that catch people out

  • Order matters in multiplication. B × A = [23 34; 31 46] for the same two matrices, which is different from A × B. To get B × A, swap what you type in the two boxes.
  • Sizes must match. A 2 × 3 matrix can multiply a 3 × 4 matrix, but not the other way round. The calculator says which sizes it found if they don't fit.
  • A zero determinant means no inverse. [1 2; 2 4] has det = 4 − 4 = 0, because the second row is twice the first. Such a matrix is called singular.
  • Rounding. Results are shown to 6 decimal places. A tiny value like 0.000001 in an inverse can be rounding from a nearly singular matrix, so check the determinant.

Frequently asked questions

Can I multiply matrices of different sizes?

Yes, as long as the number of columns in A equals the number of rows in B. A 2 × 3 matrix times a 3 × 2 matrix gives a 2 × 2 result. The sizes don't have to match for multiplication, only for addition and subtraction.

What does the determinant tell me?

It tells you whether the matrix can be inverted (any value except 0) and how the matrix scales area or volume. A 2 × 2 matrix with determinant 3 turns a unit square into a shape with area 3; a negative value means the shape is also flipped.

What is the rank of a matrix used for?

The rank tells you how many independent equations a system really has. If a 3 × 3 system has rank 2, one equation is a combination of the others, so there is either no solution or infinitely many. A square matrix has an inverse only when its rank equals its size.

How do I enter a matrix on one line?

Separate the rows with semicolons and the numbers with spaces or commas, for example 2 -1 0; 1 3 2; 0 1 4. Brackets are ignored, so you can paste [1, 2], [3, 4] style text as long as each row is on its own line or separated by semicolons.

Related calculators

  • Quadratic Formula Calculator — Solve ax² + bx + c = 0 with exact and decimal roots, the discriminant, vertex and factored form.
  • Scientific Calculator — Free online scientific calculator with trig in degrees or radians, logs, powers, roots, factorials, memory and history.
  • Fraction Calculator — Add, subtract, multiply and divide fractions and mixed numbers, simplify fractions and turn decimals into fractions.
  • Statistics Calculator — Descriptive statistics for a list: mean, median, mode, quartiles, IQR, outliers, variance, SD and skewness.

Results are calculated in your browser. Double-check anything important before you rely on it. See our disclaimer.