Matrix Calculator
Enter two matrices (up to 5×5) and add, subtract, or multiply them, or find the determinant, inverse, and transpose of one — all worked out instantly in your browser.
FreeNo sign-upPrivate — runs in your browser, nothing is uploaded
Everything is computed in your browser. Determinant and inverse use Gaussian elimination with partial pivoting for numerical stability.
Quick answer
A matrix calculator performs matrix algebra: addition and subtraction (element-by-element, same size), multiplication (row-by-column, where the columns of A must equal the rows of B), and single-matrix operations like the transpose (flip rows and columns), determinant, and inverse. This tool handles matrices up to 5×5 and uses Gaussian elimination with partial pivoting for the determinant and inverse, so the results stay numerically stable.
Formula & method
Addition and subtraction act element by element and require both matrices to be the same size. For multiplication A×B, each result entry is the dot product of a row of A with a column of B, so the number of columns of A must equal the number of rows of B. The transpose swaps rows and columns. The determinant and inverse are computed by Gaussian / Gauss-Jordan elimination with partial pivoting; a matrix with determinant 0 is singular and has no inverse.
Examples
- Input
- A = [[1,2],[3,4]], B = [[5,6],[7,8]], A × B
- Result
- [[19, 22], [43, 50]]
- Why
- Top-left = 1·5 + 2·7 = 19; top-right = 1·6 + 2·8 = 22; and so on row by row.
- Input
- A = [[1,2],[3,4]], det(A)
- Result
- -2
- Why
- For a 2×2 matrix det = ad − bc = 1·4 − 2·3 = 4 − 6 = -2.
- Input
- A = [[1,2],[3,4]], A⁻¹
- Result
- [[-2, 1], [1.5, -0.5]]
- Why
- A⁻¹ = (1/det)·[[d,−b],[−c,a]] = (1/−2)·[[4,−2],[−3,1]] = [[-2,1],[1.5,-0.5]].
When to use this tool
- Solving systems of linear equations or transforming coordinates in graphics and engineering.
- Checking homework on determinants, inverses, and matrix products step by step.
- Quickly multiplying or transposing data matrices without a spreadsheet.
Common mistakes
- Assuming matrix multiplication is commutative — in general A×B ≠ B×A, and the order matters.
- Trying to add or subtract matrices of different sizes; those operations need identical dimensions.
- Expecting an inverse for a non-square or singular matrix — only square matrices with a non-zero determinant are invertible.
Frequently asked questions
What sizes of matrix can it handle?
Any size from 1×1 up to 5×5. Use the row and column selectors above each matrix to set its dimensions; the input grid resizes automatically.
When can two matrices be multiplied?
For A × B, the number of columns of A must equal the number of rows of B. The result then has the rows of A and the columns of B.
Why does my matrix have no inverse?
A matrix is invertible only if it is square and its determinant is not zero. If the determinant is 0 the matrix is singular and the tool reports that no inverse exists.
How is the determinant calculated?
By Gaussian elimination with partial pivoting: the matrix is reduced to upper-triangular form and the determinant is the product of the pivots, adjusted for any row swaps.
Is A × B the same as B × A?
Usually not. Matrix multiplication is not commutative, so swapping the order generally changes the result (and may not even be defined).
Are my numbers sent anywhere?
No. All matrix algebra runs entirely in your browser; nothing is uploaded.
Sources & references
External references open in a new tab. We are independent and not affiliated with these organizations.
- ✓ Free to use
- ✓ No sign-up required
- ✓ Runs entirely in your browser — nothing is uploaded.
- ✓ Formula and method shown above
Provided “as is” for general information only — results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.
Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards.
Related tools
- Scientific CalculatorScience & Engineering
- Quadratic Formula CalculatorCalculators
- Standard Deviation CalculatorCalculators
- Slope CalculatorCalculators
- Distance Between Two Points CalculatorCalculators
- LCM & GCD CalculatorCalculators
Embed this tool on your site
Free to embed, no sign-up. Paste this code where you want the matrix calculator to appear: