Matrix Calculator: Inverse, Determinant, Transpose
Find the exact inverse, determinant or transpose of a matrix up to 10 × 10 with integers, decimals or fractions, shown as fractions or decimals. Also generates identity matrices, random integer matrices and random vectors. Nothing is uploaded.
Enter a matrix or generate one to see the result.
About the Matrix Calculator
The Matrix Calculator finds the inverse, transpose and determinant of a matrix you type, and generates identity matrices, random integer matrices and random vectors. Entries can be integers, decimals or fractions such as 3/4, and every entry is read as an exact fraction. The inverse and the determinant are therefore exact: the inverse of 4 7 / 2 6 is shown as 3/5 -7/10 / -1/5 2/5, not as a string of rounded decimals. Switch the output to Decimals when you want numbers you can paste into a spreadsheet. Everything runs in your browser; the matrices you type are never uploaded.
How to use it
Steps
- Choose an Operation. Inverse is selected to start.
- Type or paste the matrix, one row per line. Separate entries with spaces, commas, semicolons or tabs. Blank lines are ignored, so a block copied from a document usually works as it is.
- Pick Fractions or Decimals for the result. With decimals, set the number of decimal places, from 0 to 15; trailing zeros are dropped.
- Read the result, which updates as you type, and use Copy or Download to keep it.
- For the identity matrix, enter its size. For random matrices and vectors, set the size and the range, then press Generate.
Privacy
All arithmetic is done by code on this page, in your browser. Nothing is sent to our servers, and nothing is stored after you close the tab.
The operations
Inverse
The inverse of a square matrix A is the matrix A⁻¹ with A·A⁻¹ = I, the identity. The calculator finds it by Gauss–Jordan elimination: it writes the identity beside A and applies row operations until A becomes the identity, at which point the right-hand half is the inverse. A matrix whose determinant is 0 is singular and has no inverse; the page says so instead of printing huge or meaningless numbers.
Determinant
The determinant is computed by the same elimination, as the product of the pivots, with a change of sign for every row swap. For a 2 × 2 matrix this matches the familiar formula:
Because each entry is an exact fraction, the determinant of the 3 × 3 Hilbert matrix comes out as exactly 1/2160.
Transpose
The transpose swaps rows and columns, so entry (i, j) moves to (j, i). It works for any rectangular matrix: a 2 × 3 matrix becomes 3 × 2.
Identity and random matrices
The identity (unit) matrix has 1 on the main diagonal and 0 elsewhere. Random matrices are filled with whole numbers drawn uniformly from your range, and random vectors hold integers or decimals with the number of places you choose. The random values come from the browser's cryptographic random number generator.
Limits
Matrices are limited to 10 × 10 and random vectors to 1,000 entries. Fractions with very large numerators and denominators are kept exactly, which can make the fraction output long; switch to decimals to shorten it.
Related tools
To work with single fractions, use the Fraction Calculator. For lists of random numbers outside a matrix, use the Random Number Generator. To sum or average a list of values, use the Number List Calculator, and to change a number's base, use the Number Base Converter.
Open-source credits
- The calculator is implemented in-house and uses no third-party library. Exact arithmetic uses the browser's built-in
BigIntfrom ECMA-262, with every fraction kept in lowest terms by Euclid's algorithm. - The inverse and the determinant follow Gauss–Jordan and Gaussian elimination as described in Gilbert Strang's Introduction to Linear Algebra, chapters 2 (elimination and inverses) and 5 (determinants).
- The tests check the textbook determinant −306 of the matrix
6 1 1 / 4 −2 5 / 2 8 7, and the exact determinant and inverse of the 3 × 3 Hilbert matrix.
Frequently asked questions
Why does the inverse come out as fractions?
Every entry is read as an exact fraction and the elimination never rounds, so the inverse is exact. Many inverses have entries such as 1/3 that have no finite decimal form. Choose Decimals in the output format to see rounded values with the number of places you set.
What does it mean when a matrix is singular?
A singular matrix has a determinant of exactly 0. Its rows are linearly dependent, so some row can be built from the others, and no matrix multiplied by it gives the identity. Because the arithmetic is exact, the calculator detects this reliably instead of returning enormous rounded numbers.
Can I type decimals and fractions in the same matrix?
Yes. Integers such as 5, decimals such as -0.25 or .5, and fractions such as 3/4 or -7/8 can be mixed freely. A decimal is turned into the exact fraction it stands for, so 0.1 becomes 1/10 rather than the nearest binary floating-point value.
Why can't I find the determinant of a rectangular matrix?
The determinant and the inverse are defined only for square matrices, with as many rows as columns. A 2 × 3 matrix has a transpose, which this page computes, but asking for its determinant or inverse shows a message that the matrix must be square.
How random are the random matrices and vectors?
Each value is drawn from the browser's cryptographic random number generator, crypto.getRandomValues, and scaled uniformly into your range, so every whole number between the minimum and maximum is equally likely. Press Generate again for a fresh matrix or vector.