Skip to content

Matrix Calculator: Determinant, Inverse, Rank and Products

Determinant, inverse with exact fractions, transpose, rank and A + B, A − B, A × B for matrices up to 4 × 4.

Your details

Rows separated by “;”, entries by spaces or commas. Fractions and decimals allowed: 1/2 -3 0.25; 4 5 6

Results update as you type

Determinant

49

Determinant (decimal)
49
Rank of A
3
Trace of A
7

Step-by-step solution
  1. Cofactor expansion along the first row:
  2. det A = 2 × 4 − (−3) × 11 + 1 × 8 = 49

A matrix is a rectangular table of numbers, and it is the working tool of linear algebra: it encodes a system of linear equations, a geometric transformation or a network of relations in a compact form. This matrix calculator performs the operations you meet in a first course — determinant, inverse, transpose, rank, sum, difference, product and multiplication by a scalar — on matrices of up to 4 rows and 4 columns.

All arithmetic is exact. Entries may be integers, decimals or fractions, and the calculator works with fractions internally, so the inverse of an integer matrix comes out as clean fractions such as 35\frac{3}{5} rather than 0.6000000001. A decimal version is shown next to it for convenience.

Each result comes with the method: the ad−bcad - bc rule for a 2 × 2 determinant, cofactor expansion for a 3 × 3, Gaussian elimination for larger matrices, and the adjugate formula or Gauss–Jordan elimination for the inverse. Errors are explained in plain words: a singular matrix has no inverse, and a product needs matching inner dimensions.

How to use this calculator

  1. Choose the operation: determinant, inverse, transpose, rank, A + B, A − B, A × B or k × A.
  2. Type matrix A on one line. Separate the rows with a semicolon and the entries with spaces (or commas): 1 2; 3 4 is the 2 × 2 matrix with rows (1, 2) and (3, 4). Brackets are optional.
  3. Entries can be negative, decimal or fractional: 1/2 -3 0.25; 4 5 6.
  4. For a sum, difference or product, type matrix B the same way; for k × A, type the scalar k.
  5. Read the result in exact form, its decimal form, and the table. The result line uses the same format as the input, so you can copy it back into A to chain operations.

The formula

For a 2 × 2 matrix, the determinant and the inverse are

det⁡(abcd)=ad−bc,A−1=1ad−bc(d−b−ca).\det\begin{pmatrix} a & b \\ c & d \end{pmatrix} = ad - bc, \qquad A^{-1} = \frac{1}{ad - bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}.

For a 3 × 3 matrix, expand along the first row: det⁡A=a11(a22a33−a23a32)−a12(a21a33−a23a31)+a13(a21a32−a22a31)\det A = a_{11}(a_{22}a_{33} - a_{23}a_{32}) - a_{12}(a_{21}a_{33} - a_{23}a_{31}) + a_{13}(a_{21}a_{32} - a_{22}a_{31}).

In general the calculator uses Gaussian elimination: it reduces A to triangular form with row operations. The determinant is the product of the pivots, with a sign change for each row swap; the rank is the number of pivots; and the same elimination applied to [A∣I][A \mid I] (Gauss–Jordan) produces [I∣A−1][I \mid A^{-1}]. A square matrix is invertible exactly when det⁡A≠0\det A \neq 0, that is when its rank equals its size.

The product is defined when A is m×nm \times n and B is n×pn \times p: (AB)ij=∑k=1naikbkj(AB)_{ij} = \sum_{k=1}^{n} a_{ik} b_{kj}. Sums and differences work entry by entry on matrices of the same size, and the transpose swaps rows and columns, (AT)ij=aji(A^{\mathsf T})_{ij} = a_{ji}.

Worked example

Inverse of a 2 × 2 matrix. For A=(4726)A = \begin{pmatrix} 4 & 7 \\ 2 & 6 \end{pmatrix}, det⁡A=4×6−7×2=10\det A = 4 \times 6 - 7 \times 2 = 10, so

A−1=110(6−7−24)=(35−710−1525).A^{-1} = \frac{1}{10}\begin{pmatrix} 6 & -7 \\ -2 & 4 \end{pmatrix} = \begin{pmatrix} \frac{3}{5} & -\frac{7}{10} \\ -\frac{1}{5} & \frac{2}{5} \end{pmatrix}.

The top-left entry is 3/5 = 0.6. Multiplying A×A−1A \times A^{-1} gives the identity matrix.

Determinant of a 3 × 3 matrix. For the default matrix (2−3120−1145)\begin{pmatrix} 2 & -3 & 1 \\ 2 & 0 & -1 \\ 1 & 4 & 5 \end{pmatrix}, cofactor expansion gives 2(0⋅5−(−1)⋅4)+3(2⋅5−(−1)⋅1)+1(2⋅4−0⋅1)=8+33+8=492(0 \cdot 5 - (-1) \cdot 4) + 3(2 \cdot 5 - (-1) \cdot 1) + 1(2 \cdot 4 - 0 \cdot 1) = 8 + 33 + 8 = 49.

Order matters. With A=(1234)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} and B=(0110)B = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, AB=(2143)AB = \begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix} (columns swapped) but BA=(3412)BA = \begin{pmatrix} 3 & 4 \\ 1 & 2 \end{pmatrix} (rows swapped).

The determinant of a matrix: what it tells you

The determinant is a single number attached to a square matrix. Geometrically, its absolute value is the factor by which the matrix scales areas (in 2D) or volumes (in 3D), and its sign says whether the orientation is preserved. A determinant of 0 means the transformation flattens space onto a line or a plane: the matrix is singular, its rows are linearly dependent, and a linear system with that matrix has either no solution or infinitely many.

Useful properties: swapping two rows changes the sign; multiplying a row by kk multiplies the determinant by kk; det⁡(AB)=det⁡A⋅det⁡B\det(AB) = \det A \cdot \det B; det⁡AT=det⁡A\det A^{\mathsf T} = \det A; and det⁡A−1=1/det⁡A\det A^{-1} = 1/\det A.

Inverse of a matrix and linear systems

The inverse A−1A^{-1} is the matrix that undoes A: AA−1=A−1A=IA A^{-1} = A^{-1} A = I. It exists only for square matrices with a non-zero determinant. Its main use is solving the system AX=BAX = B: when A is invertible, the unique solution is X=A−1BX = A^{-1}B. In practice elimination is faster than computing the inverse, but for small systems and for exercises the inverse makes the structure clear.

Exact fractions matter here: the inverse of an integer matrix is 1det⁡A\frac{1}{\det A} times an integer matrix (the adjugate), so its entries are fractions with the determinant as common denominator, as in the fraction calculator.

Frequently asked questions

How do I enter a 3 × 3 matrix?

Type the three rows separated by semicolons, with spaces between the entries: 2 -3 1; 2 0 -1; 1 4 5. Commas between entries also work, and so do fractions like 1/3 and decimals like 0.5.

Why does my matrix have no inverse?

A matrix is invertible only if it is square and its determinant is not zero. A zero determinant means one row is a combination of the others (for example, a row that is twice another), so information is lost and cannot be recovered.

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

Yes. The number of columns of A (3) matches the number of rows of B (3), and the result is 2 × 2. In the other order, B × A is also defined but gives a 3 × 3 matrix — another reason why A × B ≠ B × A.

What is the rank of a matrix?

The rank is the number of linearly independent rows (equivalently, columns). It equals the number of pivots after Gaussian elimination. A square n × n matrix is invertible exactly when its rank is n.

Why are some results shown as fractions?

The calculator uses exact rational arithmetic, so no rounding error builds up. An entry such as 1/3 would otherwise appear as 0.3333333333. The decimal form is shown underneath when it differs.

Sources

Last updated:

More Math calculators

People also use