Matrix Calculator with Steps
Perform matrix addition, subtraction, multiplication, scalar multiplication, transpose, determinant, inverse, RREF, rank and trace. You can also solve Ax = b and review exact fraction steps without sending your entries to a calculation server.
Last Updated: July 26, 2026Online Matrix Calculator
Choose an operation, set the dimensions and enter every matrix value. Inputs accept integers, finite decimals, fractions and scientific notation.
Matrix Product
Enter the matrices, then select Multiply Matrices.
Exact result
| Result matrix will appear here. |
Decimal approximation
| Decimal values will appear here. |
Solution details
Calculation steps
- Choose an operation and enter the matrix values.
How to Use This Matrix Calculator
- Select the operation you need. The page will show Matrix B, a scalar field or a constant vector only when the chosen calculation needs it.
- Choose the row and column count for Matrix A. For a two-matrix operation, set the available dimensions for Matrix B.
- Enter one value in every cell. Valid forms include
4,-2.5,1/3and6e-2. - Select the decimal places used for approximations. Exact reduced fractions remain unchanged.
- Select the calculation button. Review the exact answer, decimal matrix, rank or solution classification, and the displayed steps.
Use the example button when you want a ready-made case for the selected operation. Changing a dimension preserves values that remain inside the resized matrix. Round only the final answer when possible, especially during inverse and row-reduction work.
What Is a Matrix Calculator?
A matrix calculator works with rectangular arrays of numbers arranged in rows and columns. The order of a matrix lists rows first and columns second. A matrix with two rows and three columns has order 2 by 3. Each number is an entry identified by its row and column position.
Matrices organize coefficients, data and transformations. A square matrix has the same number of rows and columns. An identity matrix has ones on the main diagonal and zeros elsewhere. A zero matrix contains only zeros. An augmented matrix places a constant column beside a coefficient matrix so row operations can solve a system of linear equations.
This online matrix calculator applies the required dimension rules before it performs arithmetic. It supports common classroom operations, preserves rational inputs as exact fractions and shows row operations for determinant, inverse, RREF, rank and Ax = b calculations.
Matrix Operations Supported
Addition and Subtraction
Addition and subtraction work entry by entry. Matrix A and Matrix B must have identical dimensions. The output keeps the same number of rows and columns.
Scalar and Matrix Multiplication
Scalar multiplication multiplies every entry of A by one number k. Matrix multiplication uses row-by-column dot products. If A has order m by n and B has order n by p, their product AB has order m by p. The inner dimensions must match.
Transpose, Trace, Determinant and Inverse
The transpose exchanges rows and columns, so an m by n matrix becomes n by m. Trace adds the entries on the main diagonal and therefore requires a square matrix. A determinant is one scalar associated with a square matrix. A nonzero determinant means an ordinary inverse exists. The inverse reverses the matrix under multiplication, producing the identity matrix when multiplied by the original.
RREF and Rank
Reduced row echelon form uses valid row swaps, row scaling and row replacement. Each pivot becomes 1 and is the only nonzero entry in its pivot column. Rank equals the number of pivots. These operations accept square, tall and wide matrices.
Solving Ax = b
The solver treats A as a coefficient matrix and B as the one-column constant vector b. It reduces the augmented matrix [A | b], then classifies the system as unique, inconsistent or dependent. A dependent system includes one or more free variables.
Matrix Formulas Explained
For addition or subtraction, each output entry comes from the matching positions:
c(i,j) = a(i,j) ± b(i,j)
For a scalar k, every entry is multiplied independently:
For matrix multiplication, use row i of A and column j of B. Sum the products across the shared inner dimension n:
AB is m by p
c(i,j) = Σ a(i,k)b(k,j), from k = 1 to n
The transpose reverses the entry indices:
For a 2 by 2 matrix A = [[a, b], [c, d]], the determinant and inverse are:
A−1 = (1 / (ad − bc)) [[d, −b], [−c, a]], when det(A) ≠ 0
For larger matrices, this tool uses exact elimination rather than cofactor expansion. Rank comes from the pivot count in RREF. A linear system is written as Ax = b and solved by reducing its augmented matrix.
Worked Matrix Examples
Matrix Multiplication Example
Let A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]. Each result entry uses one row of A and one column of B:
- c(1,1) = 1 × 5 + 2 × 7 = 19
- c(1,2) = 1 × 6 + 2 × 8 = 22
- c(2,1) = 3 × 5 + 4 × 7 = 43
- c(2,2) = 3 × 6 + 4 × 8 = 50
Therefore AB = [[19, 22], [43, 50]]. Reversing the order gives BA = [[23, 34], [31, 46]]. This shows why matrix multiplication is generally not commutative.
Determinant and Inverse Example
For A = [[1, 2], [3, 4]], det(A) = 1 × 4 − 2 × 3 = −2. The determinant is nonzero, so the inverse exists.
A−1 = [[−2, 1], [3/2, −1/2]]
Multiplying A by this inverse gives the identity matrix [[1, 0], [0, 1]]. The exact fraction form avoids changing 3/2 into a rounded intermediate value.
RREF Linear-System Example
Solve 2x + y = 5 and x − y = 1. The augmented matrix is [[2, 1 | 5], [1, −1 | 1]]. Row reduction produces [[1, 0 | 2], [0, 1 | 1]]. Therefore x = 2 and y = 1. Substitution verifies 2(2) + 1 = 5 and 2 − 1 = 1.
Matrix Dimension Rules and Common Errors
- Addition and subtraction require equal row and column counts.
- For AB, the number of columns in A must equal the number of rows in B.
- Determinant, inverse and trace require a square Matrix A.
- A square matrix with determinant zero is singular and has no inverse.
- RREF, rank and transpose work with rectangular matrices.
- For Ax = b, the constant vector must contain one entry for every row of A.
Every visible cell needs one valid number. A blank entry, a zero denominator, multiple fraction slashes, commas, variable letters or a typed expression triggers a location-specific error. The tool caps each dimension at 6 to keep exact calculations responsive in a browser. If exact numerators or denominators grow beyond the safety limit, the calculation stops instead of presenting an incomplete value.
Which Matrix Operation Should You Use?
| Goal | Operation | Requirement | Output |
|---|---|---|---|
| Combine matching datasets | Add or subtract | Same dimensions | Same-size matrix |
| Apply a uniform factor | Scalar multiplication | Any matrix | Same-size matrix |
| Compose transformations | Matrix multiplication | Inner dimensions match | m by p matrix |
| Swap rows and columns | Transpose | Any matrix | n by m matrix |
| Test invertibility | Determinant | Square matrix | One scalar |
| Reverse a transformation | Inverse | Square, nonsingular matrix | Same-size matrix |
| Find pivots and free variables | RREF and rank | Any matrix | Reduced matrix and integer rank |
| Solve simultaneous equations | Solve Ax = b | Compatible constant vector | Unique, infinite or no solution |
Practical Uses of Matrices
Matrices represent systems of linear equations, coordinate transformations, networks and structured datasets. Computer graphics uses matrices for rotation, scaling and projection. Engineering models use them to connect inputs, states and outputs. Statistics uses matrix notation for regression, covariance and multivariable calculations. Economics uses input-output matrices to describe relationships among sectors. Machine-learning systems organize data and model parameters in matrix form.
A small browser calculator is useful for learning, checking manual work and exploring examples. It does not replace numerical linear-algebra software for large, sparse, complex-valued or highly ill-conditioned problems. Match the method and precision to the purpose of your calculation.
Exact Inputs, Accuracy and Limits
This calculator converts integers, finite decimals, fractions and supported scientific notation into reduced rational numbers. For example, 0.125 becomes 1/8, while 1/3 stays 1/3 throughout elimination. Decimal places affect only the separate approximation.
Exact arithmetic removes ordinary binary floating-point drift for supported inputs, but it does not correct an imprecise model or rounded source data. Matrices are limited to 6 by 6, written scientific exponents must stay between −100 and 100, and oversized exact intermediate values are blocked. Round only after the final step and independently verify important engineering, research, financial or academic results.
Method and Review Basis
The dimension rules and core operations follow OpenStax matrix operations. Inverse and Ax = b explanations follow OpenStax systems with inverses. The elimination approach is also consistent with MIT OpenCourseWare on multiplication and inverse matrices.
The calculator uses a strict numeric parser and never executes entered text as code. Calculations and the temporary recent-history list run inside the current page. Reloading the page clears that history.
Related Calculators
Frequently Asked Questions
What is a matrix calculator?
A matrix calculator performs operations on arrays of numbers arranged in rows and columns. Depending on the selected mode, it can add, subtract, multiply, transpose, find determinants or inverses, calculate rank and RREF, or solve linear systems.
How do I enter a matrix?
Select its row and column count, then enter one value in each cell. A matrix with two rows and three columns has order 2 by 3. Use valid integers, decimals, fractions or scientific notation.
Can matrices of different sizes be added?
No. Addition and subtraction require both matrices to have the same number of rows and columns. A 2 by 3 matrix can be added to another 2 by 3 matrix, but not to a 3 by 2 matrix.
How do you multiply two matrices?
Matrix AB exists when the number of columns in A equals the number of rows in B. Multiply each row of A by each column of B using dot products. An m by n matrix multiplied by an n by p matrix produces an m by p matrix.
Is AB always equal to BA?
No. Matrix multiplication is generally not commutative, so AB and BA often produce different results. Sometimes one order is defined while the reverse order is not. A few special matrix pairs do commute.
When does a matrix have an inverse?
A matrix has an ordinary two-sided inverse only when it is square and its determinant is not zero. Such a matrix is nonsingular or invertible. A rectangular matrix has no ordinary two-sided inverse.
What does a determinant of zero mean?
A zero determinant means a square matrix is singular and has no inverse. Its rows or columns are linearly dependent. A related equation system can have no solution or infinitely many solutions, depending on its constants.
What is reduced row echelon form?
Reduced row echelon form, or RREF, is a unique simplified form produced through elementary row operations. Each pivot is 1 and is the only nonzero value in its column. RREF reveals rank, pivot variables, free variables and system solutions.
How does a matrix solve simultaneous equations?
Write the coefficients and constants as an augmented matrix, then use row operations to reach RREF. The result identifies variable values or shows an inconsistent row for no solution. Free variables indicate infinitely many solutions when the system is consistent.
Are decimal matrix results exact?
Finite decimals entered here are converted to exact fractions, while displayed decimal approximations are rounded. Keep exact fractions during intermediate steps, round only the final answer and verify sensitive matrices carefully.
Disclaimer: This calculator provides general mathematical results for learning and checking work. Verify dimensions, input data, model assumptions and required precision before using a result for academic, scientific, financial, engineering or other important decisions.