Key facts
- For a 2 × 2 matrix [[a, b], [c, d]], the determinant is ad − bc and the inverse is (1 ÷ (ad − bc)) × [[d, −b], [−c, a]].
- det([[1, 2], [3, 4]]) = 1 × 4 − 2 × 3 = −2.
- A matrix has an inverse only if it is square and its determinant is not zero.
- A × B is defined only when A has as many columns as B has rows, and in general A × B ≠ B × A.
- This calculator uses exact rational arithmetic, so the inverse of [[1, 2], [3, 4]] shows 3/2 and −1/2 instead of rounded decimals.
How to enter a matrix
Type one row per line, with the numbers separated by spaces or commas: ``` 2 1 3 0 -1 4 1 2 0 ``` Fractions like 1/2 and decimals like 0.25 are fine. All rows must have the same number of entries. For operations on two matrices, fill in matrix B as well.
What each operation does
| Operation | Needs | Result |
|---|---|---|
| Determinant | Square matrix | A single number |
| Inverse | Square, determinant ≠ 0 | A⁻¹ with A × A⁻¹ = I |
| Transpose | Any matrix | Rows and columns swapped |
| Rank | Any matrix | Number of independent rows, with the reduced row echelon form |
| A + B, A − B | Same size | Entry-by-entry sum or difference |
| A × B | Columns of A = rows of B | Row-by-column products |
| Aⁿ | Square matrix | A multiplied by itself n times |
Determinant
For 2 × 2: det = ad − bc. For 3 × 3, expand along the first row:
det = a(ei − fh) − b(di − fg) + c(dh − eg)For larger matrices, the calculator uses row reduction: the determinant is the product of the pivots, with a sign change for every row swap.
Example: for the 3 × 3 matrix above, det = 2((−1)(0) − 4 × 2) − 1(0 × 0 − 4 × 1) + 3(0 × 2 − (−1) × 1) = −16 + 4 + 3 = −9.
Inverse
For 2 × 2:
A⁻¹ = (1 ÷ (ad − bc)) × [[d, −b], [−c, a]]For [[1, 2], [3, 4]]: det = −2, so A⁻¹ = −1/2 × [[4, −2], [−3, 1]] = [[−2, 1], [3/2, −1/2]].
For larger matrices the calculator uses Gauss-Jordan elimination: write [A | I], row-reduce until the left side is I, and the right side becomes A⁻¹.
Matrix multiplication
Each entry of A × B is the dot product of a row of A with a column of B:
(AB)ᵢⱼ = Σ Aᵢₖ × Bₖⱼ[[1, 2], [3, 4]] × [[5, 6], [7, 8]] = [[1·5 + 2·7, 1·6 + 2·8], [3·5 + 4·7, 3·6 + 4·8]] = [[19, 22], [43, 50]].
Multiplying in the other order gives [[23, 34], [31, 46]], a different result.
Rank and row echelon form
The rank is the number of non-zero rows after row reduction. It tells you how many rows (or columns) are linearly independent. The matrix [[1, 2, 3], [2, 4, 6], [1, 0, 1]] has rank 2 because the second row is twice the first. A square matrix is invertible exactly when its rank equals its size.
Where matrices are used
- Solving systems of linear equations (see the system of equations calculator).
- 2D and 3D graphics: rotations, scaling and projections.
- Statistics and machine learning: regression, covariance and neural networks.
- Economics (input-output models), physics (quantum states) and engineering (circuits, structures).
Pitfalls with matrices
- Multiplying matrices entry by entry instead of row by column.
- Assuming A × B = B × A.
- Trying to invert a singular matrix (determinant 0).
- Mixing up rows and columns when typing the matrix.
Matrices from ancient China to Google
Matrix methods are older than the word. Chapter 8 of the Chinese classic *The Nine Chapters on the Mathematical Art*, compiled by about the 1st century CE, solves systems of equations by arranging coefficients in a grid on a counting board and eliminating them column by column, essentially what we now call Gaussian elimination. The term matrix was coined in 1850 by James Joseph Sylvester, and Arthur Cayley set out matrix algebra in his *Memoir on the Theory of Matrices* in 1858.
Matrices now run much of the modern world. Wassily Leontief won the 1973 Nobel Memorial Prize in Economic Sciences for input–output analysis, which models an economy as a large matrix of industries buying from each other. Google’s original PageRank algorithm, described by Larry Page and Sergey Brin in 1998, ranks pages using the leading eigenvector of a huge link matrix. Computer graphics use 4 × 4 matrices to rotate, scale and project every 3D scene, and neural networks are built from layers of matrix multiplications, which is why graphics processors became the hardware of AI. In US high schools, Common Core standards N-VM.C.6 to C.12 cover matrices as an advanced topic. For one operation at a time, use the determinant calculator, the inverse matrix calculator or the matrix multiplication calculator; for equations, the system of equations calculator.
How this calculator works
- Enter rows on separate lines with numbers separated by spaces or commas; matrices up to 8 × 8 are supported.
- All arithmetic is exact: fractions stay as fractions (for example 1/3), so there is no rounding error.
- Operations: determinant, inverse (with Gauss–Jordan steps and a check that A × A⁻¹ = I), multiplication (with the reverse product BA for comparison), powers up to 20, rank (with the reduced row echelon form), transpose, addition and subtraction.
- Size mismatches, such as multiplying a 2 × 3 by a 2 × 3, are explained rather than ignored.
Frequently asked questions
How do you find the determinant of a 2 × 2 matrix?
Multiply the diagonal entries and subtract the product of the other two: for [[a, b], [c, d]], det = ad − bc.
How do you find the inverse of a matrix?
For 2 × 2, swap a and d, change the signs of b and c, and divide by the determinant. For larger matrices, row-reduce [A | I] until the left side is the identity.
When does a matrix not have an inverse?
When it is not square or its determinant is zero. Such a matrix is called singular.
Can you multiply a 2 × 3 matrix by a 3 × 2 matrix?
Yes. The inner sizes match (3 and 3), and the result is a 2 × 2 matrix.
Is matrix multiplication commutative?
No. In general A × B and B × A are different, and one may be defined when the other is not.
What is the transpose of a matrix?
The matrix you get by turning rows into columns. Entry (i, j) of the transpose is entry (j, i) of the original.
What does the rank of a matrix mean?
The number of linearly independent rows or columns. It equals the number of non-zero rows in the row echelon form.
What size matrices does this calculator support?
Up to 8 rows and 8 columns, with exact fractions.