# Matrix Calculator

URL: https://hifreetools.com/calculators/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.

## 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.

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

- Multiply two 2×2 matrices: A = [[1,2],[3,4]], B = [[5,6],[7,8]], A × B → [[19, 22], [43, 50]]
- Determinant of a 2×2: A = [[1,2],[3,4]], det(A) → -2
- Inverse of a 2×2: A = [[1,2],[3,4]], A⁻¹ → [[-2, 1], [1.5, -0.5]]

## FAQ

**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

- [Wikipedia — Matrix (mathematics)](https://en.wikipedia.org/wiki/Matrix_(mathematics))
- [Wikipedia — Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Matrix Calculator", https://hifreetools.com/calculators/matrix-calculator
