Matrix Calculator
Enter one or two matrices in this tab to add, subtract, or multiply them, or to find a determinant, inverse, or transpose. Exact fractions are shown when the entries are integers, decimals, or fractions. Singular matrices and size mismatches produce a clear error.
Choose an operation
Limits
- Each matrix can be at most 10×10.
- Each entry must be a finite decimal, an integer, or a fraction such as 3/4. Scientific notation is not accepted. Each entry can have at most 16 significant digits, and the reduced numerator and denominator can be at most 10^12.
- This page does not compute eigenvalues, decompositions, or a reduced row-echelon form, and it does not solve a general system AX = B except by offering the inverse when A is invertible.
Enter the matrix
How to use Matrix
- Choose an operationSelect addition, subtraction, or multiplication of two matrices, or the determinant, inverse, or transpose of one matrix. The default example multiplies two 2×2 matrices.
- Enter the entriesPut one row on each line, and separate entries with spaces or commas. Integers, finite decimals, and fractions such as 3/4 are accepted. Each matrix can be at most 10×10.
- Read the exact resultThe result is shown as exact rationals when possible, with a decimal approximation. If the sizes do not match, or a matrix that should be invertible is singular, the page explains the error instead of inventing a value.
Limits and how it works
- Each matrix can be at most 10×10.
- Each entry must be a finite decimal, an integer, or a fraction such as 3/4. Scientific notation is not accepted. Each entry can have at most 16 significant digits, and the reduced numerator and denominator can be at most 10^12.
- This page does not compute eigenvalues, decompositions, or a reduced row-echelon form, and it does not solve a general system AX = B except by offering the inverse when A is invertible.
How the matrix operations are calculated
Two matrices can be added or subtracted only when they have the same size; corresponding entries are added or subtracted. The product AB is defined when the number of columns of A equals the number of rows of B. The entry in row i and column j of AB is the sum over k of a_ik b_kj. The transpose A^T is the matrix with rows and columns swapped: (A^T)_ij = A_ji. These rules are as in OpenStax Precalculus 2e, Section 9.5, “Matrices and Matrix Operations,” at openstax.org/books/precalculus-2e/pages/9-5-matrices-and-matrix-operations (CC BY 4.0).
A square matrix has a multiplicative inverse A^{-1} satisfying A A^{-1} = A^{-1} A = I if and only if it is invertible, that is, if and only if its determinant is not 0. This page finds the inverse by Gauss–Jordan elimination: the augmentation [A | I] is row-reduced until it becomes [I | A^{-1}], as in OpenStax Precalculus 2e, Section 9.7, “Solving Systems with Inverses,” at openstax.org/books/precalculus-2e/pages/9-7-solving-systems-with-inverses. If a pivot is 0 and no nonzero pivot can be swapped in, the matrix is singular and has no inverse.
The determinant of a square matrix is computed by Gaussian elimination over the rationals: after partial pivoting, the determinant is the signed product of the diagonal pivots. For a 2×2 matrix [[a, b], [c, d]] this is ad − bc, as in OpenStax Precalculus 2e, Section 9.8, “Solving Systems with Cramer's Rule,” at openstax.org/books/precalculus-2e/pages/9-8-solving-systems-with-cramers-rule. Entries are parsed as exact rationals, so a determinant such as −2 or 1/60 is reported exactly. This site’s scientific calculator evaluates arithmetic but does not handle matrices.
Frequently asked questions
What happens if the matrices have the wrong size?
Addition and subtraction require the same number of rows and the same number of columns. Multiplication requires the number of columns of A to equal the number of rows of B. If the sizes do not match, the page reports the two sizes and does not invent a result.
When does a matrix have no inverse?
Only a square matrix can have an inverse, and only when its determinant is not 0. A square matrix with determinant 0 is singular: there is no matrix A^{-1} such that A A^{-1} = I. The page reports that case instead of a fake inverse.
Are the results exact?
Yes, when the entries are integers, finite decimals, or fractions such as 3/4. The calculator works with exact rationals, so the inverse of [[1, 2], [3, 4]] is reported as [[−2, 1], [3/2, −1/2]], not as rounded decimals. A decimal approximation is also shown.
Is this the same as the scientific calculator?
No. The scientific calculator’s limits say it does not handle matrices, complex numbers, or equation solving. This page is the matrix calculator.
Is anything uploaded?
No. The calculation runs in your browser. Nothing you type is sent to a server.
Related tools
All toolsScientific Calculator
Trigonometry, logs, factorials and expressions, in degrees or radians.
Quadratic Equation Calculator
Solve ax² + bx + c = 0, including complex roots and the a = 0 linear case.
Graphing Calculator
Plot a 2D function such as x^2 or sin(x) in your browser.
GCF and LCM Calculator
Find the greatest common factor and least common multiple of several integers.