About the Matrix Calculator
Matrix Calculator does the common operations on matrices of up to 5 rows and 5 columns. Enter one or two matrices in the grids, choose an operation, and the result appears below. You can add, subtract and multiply two matrices, multiply a matrix by a number, transpose it, find its inverse, or get its determinant together with its trace and rank. The tool checks that the sizes match, and explains in plain words why an operation is not possible, for example that the number of columns of A must equal the number of rows of B to multiply, or that a matrix with a determinant of zero has no inverse. Empty cells count as zero, decimals and negatives are accepted, and the result can be copied as tab-separated text for a spreadsheet. It runs in your browser.
Updated September 2026
How to use the Matrix Calculator
- 1Choose the operation: A + B, A − B, A × B, k × A, determinant, inverse or transpose.
- 2Set the number of rows and columns for matrix A, and for B if the operation needs it.
- 3Type the numbers into the grid. Empty cells count as 0.
- 4Read the result below the grids.
- 5Copy the result as tab-separated text to paste it into a spreadsheet.
What matrices are used for
A matrix is a rectangular table of numbers. Matrices describe systems of equations, transformations in graphics such as rotation and scaling, networks, statistics and machine learning. Multiplying by a matrix can turn, stretch or move a whole set of points in one step, which is how images are transformed in computer graphics.
Students meet matrices in algebra and linear algebra courses, where they are used to solve equations with several unknowns, for example finding x and y from two equations by multiplying by the inverse of the coefficient matrix.
The operations
- Add and subtract: both matrices must have the same size, and the entries are added or subtracted in place.
- Multiply: rows of A times columns of B; the order matters, so A × B is not the same as B × A.
- Scalar multiplication: every entry is multiplied by the same number.
- Transpose: rows become columns, so a 2 × 3 matrix becomes 3 × 2.
- Determinant, trace and rank: single numbers that describe a square matrix.
- Inverse: undoes the matrix; only square matrices with a non-zero determinant have one.
Solving equations with the inverse
A system such as 2x + y = 5 and x + 3y = 10 can be written as A times a column of unknowns equals a column of results. If A is invertible, multiply the inverse of A by the results to get the unknowns. Enter A = [[2, 1], [1, 3]] and choose Inverse, then multiply that result by the column [[5], [10]] using A × B to get x = 1 and y = 3.
If the determinant is zero, the equations either have no solution or infinitely many, and the tool tells you that the matrix has no inverse.
Tips and limits
Use the size boxes first, because changing them keeps what you already typed where it fits. Numbers must be plain decimals, not fractions such as 1/2. For very large matrices or symbolic entries, a computer algebra system is a better choice. For a related everyday tool, Fraction Calculator works with fractions, and Quadratic Equation Solver handles equations with squares.
To check the maths of a two-by-two case by hand, use the formula for the determinant ad − bc. For statistics on a list of numbers, Standard Deviation Calculator and Average Calculator do the job.
Features
- Addition, subtraction and multiplication of matrices
- Scalar multiplication and transpose
- Determinant, trace and rank
- Inverse with a clear message when none exists
- Sizes from 1 × 1 up to 5 × 5
- Plain-language errors for size mismatches
- Copy the result for a spreadsheet
Frequently asked questions
How do you multiply two matrices?
Each entry of the result is the sum of the products of a row of the first matrix with a column of the second. For the entry in row i and column j, multiply the entries of row i of A with those of column j of B one by one and add them. The number of columns of A has to equal the number of rows of B, and the result has the rows of A and the columns of B.
Why can't I multiply my matrices?
Multiplication needs the number of columns in the first matrix to match the number of rows in the second. A 2 × 3 matrix can be multiplied by a 3 × 4 matrix, giving 2 × 4, but not by a 2 × 3 one. The tool tells you the two numbers that do not match.
What is the determinant?
The determinant is a single number that you can calculate for a square matrix. For a 2 × 2 matrix it is ad − bc. A determinant of zero means the matrix is singular: it has no inverse, and its rows (or columns) are not independent.
How do I find the inverse of a matrix?
The inverse of A is the matrix that gives the identity matrix when multiplied by A. It exists only for square matrices with a non-zero determinant. The tool finds it by Gauss-Jordan elimination with pivoting, and if you multiply A by the result you get the identity, apart from tiny rounding.
What are the trace and the rank?
The trace is the sum of the numbers on the main diagonal of a square matrix. The rank is the number of independent rows, which is also the number of independent columns. A square n × n matrix is invertible exactly when its rank is n.
Does the tool round my results?
It removes floating point dust so that 1.0000000000000002 shows as 1, and keeps up to 12 significant digits. Whole-number inputs for addition, subtraction, multiplication and small determinants give exact results.