Matrix Calculator
Add, subtract, multiply, transpose, invert and find the determinant, rank and trace of matrices online
Choose an operation
Matrix A
Matrix B
Result
Choose an operation, enter your values and click Calculate to see the result here.
About this tool
This matrix calculator performs the core operations of linear algebra entirely in your browser. You can add and subtract matrices of the same size, multiply two matrices, multiply a matrix by a scalar, transpose a matrix, and for square matrices compute the determinant, the inverse, the rank and the trace. Determinants use Gaussian elimination with partial pivoting and inverses use Gauss-Jordan elimination, so the results stay numerically stable even for larger matrices up to 6x6. Integer results are shown cleanly and fractions are rounded to remove floating-point noise. Nothing is sent to a server, which makes it fast and private for homework, exam prep and quick checks.
How to use
- 1 Pick the operation you want, such as A x B, the inverse or the determinant.
- 2 Set the number of rows and columns for matrix A (and matrix B for two-matrix operations).
- 3 Type a number into every cell; blank cells are treated as zero.
- 4 Click Calculate to see the resulting matrix or scalar, then copy it if you need it.
How it works
Matrix addition and subtraction work entry by entry on matrices of identical size. Matrix multiplication takes the dot product of each row of A with each column of B, so it is only defined when the number of columns of A equals the number of rows of B. The determinant is computed by reducing the matrix to upper-triangular form with Gaussian elimination and multiplying the pivots, tracking a sign change for each row swap. The inverse is found by Gauss-Jordan elimination on the augmented matrix [A | I]: when the left side becomes the identity, the right side is A inverse. If a pivot collapses to zero the matrix is singular and no inverse exists. The rank is the number of non-zero pivot rows after row reduction, and the trace is the sum of the diagonal entries.
Frequently asked questions
What sizes of matrices are supported?
You can use any matrix from 1x1 up to 6x6. Addition and subtraction need both matrices to be the same size, multiplication needs the columns of A to match the rows of B, and the determinant, inverse, rank and trace require a square matrix.
How is the inverse calculated?
The inverse is computed with Gauss-Jordan elimination on the augmented matrix [A | I] using partial pivoting for stability. When the left half is reduced to the identity matrix, the right half is the inverse. If the matrix is singular (determinant 0) it has no inverse and the tool reports this.
Why is my determinant or inverse showing tiny decimals?
Floating-point arithmetic can introduce very small rounding errors. This calculator cleans up that noise: values within a tiny tolerance of an integer snap to that integer, and near-zero values become exactly zero, so results stay readable.
What does the rank of a matrix tell me?
The rank is the number of linearly independent rows (or columns), found here by row-reducing the matrix and counting non-zero pivot rows. A square matrix is invertible exactly when its rank equals its size, so the rank quickly tells you whether a system has a unique solution.
Is my data sent anywhere?
No. Every calculation runs locally in your browser using plain JavaScript arithmetic, so your matrices are never uploaded. The tool also keeps working offline once the page has loaded.
Related tools and uses
Matrices show up across math and science: solving systems of linear equations, computer graphics transformations, statistics and machine learning. Pair this with the equation solver for linear systems, the graphing calculator for visualizing transformations, and the scientific notation tool when results get very large or very small.