Home › Calculators › Matrix Calculator

Matrix Calculator

Enter one or two matrices up to 5 × 5 and pick an operation. Results use exact fractions, and determinants, inverses and row reductions come with every step.

Last updated:

Matrix A

×

Matrix B

×

Cells accept integers, decimals and fractions like -2/3. Empty cells count as 0.

Operation

Result
–

Advertisement
Advertisement

How to use the Matrix Calculator

  1. Set the size of matrix A and matrix B with the Rows and Cols menus.
  2. Type the entries – integers, decimals or fractions like 3/4. Use Random or Identity to fill quickly.
  3. Pick an operation such as A × B, det, Inverse or RREF, and choose whether it applies to A or B.
  4. Press Calculate to see the result and, for det, inverse, rank and RREF, every elimination step.
  5. Copy the result or press Use result as A to chain operations.

Matrix operations at a glance

OperationRuleSize requirement
A + B, A − BAdd or subtract matching entriesSame size
A × B(i, j) entry = row i of A · column j of BColumns of A = rows of B; result is rows(A) × cols(B)
k × AMultiply every entry by kAny
AᵀSwap rows and columnsAny; m × n becomes n × m
det(A)Product of the pivots after elimination, with a sign flip per row swapSquare
A⁻¹Row reduce [A | I] to [I | A⁻¹]Square with det ≠ 0
RREF, rankGauss–Jordan elimination; rank = number of pivotsAny
tr(A)Sum of the main diagonalSquare

Matrix multiplication is not commutative: A × B is usually different from B × A, and one may be defined when the other is not.

Worked example: inverse of a 2 × 2 matrix

For A = [[4, 7], [2, 6]], det(A) = 4·6 − 7·2 = 10. The shortcut for 2 × 2 matrices is A⁻¹ = (1/det) × [[d, −b], [−c, a]] = (1/10) × [[6, −7], [−2, 4]] = [[3/5, −7/10], [−1/5, 2/5]]. The calculator gets the same answer by reducing [A | I], and keeps the entries as exact fractions.

Reduced row echelon form and rank

A matrix is in reduced row echelon form (RREF) when every non-zero row starts with a leading 1 (the pivot), each pivot is to the right of the one above it, every other entry in a pivot column is 0, and zero rows are at the bottom. The rank is the number of pivots. It tells you how many rows (or columns) are linearly independent: a square n × n matrix is invertible exactly when its rank is n and its determinant is non-zero.

Determinant properties worth knowing

  • Swapping two rows changes the sign of the determinant.
  • Adding a multiple of one row to another leaves it unchanged – that is why elimination works.
  • det(A × B) = det(A) × det(B), and det(Aᵀ) = det(A).
  • det(kA) = kⁿ det(A) for an n × n matrix.

Frequently asked questions

How do you find the inverse of a matrix?

Write the matrix next to the identity matrix, [A | I], and use row operations until the left side becomes the identity. The right side is then A⁻¹. If a zero pivot appears and cannot be swapped away, the matrix has no inverse.

When does a matrix have no inverse?

A square matrix is not invertible (singular) when its determinant is 0, which happens when its rows or columns are linearly dependent, so its rank is less than its size. Non-square matrices never have a regular inverse.

How is the determinant calculated?

The calculator uses Gaussian elimination: it turns the matrix into upper triangular form, multiplies the diagonal entries, and flips the sign once for every row swap. This is much faster than cofactor expansion for larger matrices and gives the same result.

Why can't I multiply these two matrices?

A × B is only defined when the number of columns in A equals the number of rows in B. A 2 × 3 matrix can multiply a 3 × 4 matrix (giving 2 × 4), but not a 2 × 3 matrix.

What does RREF tell me?

The reduced row echelon form shows the rank, which columns are independent (pivot columns), and the solution of a linear system when the matrix is augmented with the right-hand side.

Does the calculator round results?

No. All arithmetic is done with exact fractions using big integers, so there is no rounding error. Tick Show decimals to see decimal approximations instead.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Scientific CalculatorTrig, logs, powers and more in your browser.Fraction CalculatorAdd, subtract, multiply and divide fractions with steps.Quadratic Equation SolverSolve ax² + bx + c = 0 with exact roots, steps, vertex and a parabola graph.Graphing CalculatorPlot multiple functions with zoom, pan, intersections and a value table.Complex Number CalculatorAdd, subtract, multiply, divide complex numbers; polar form, modulus, argument, powers and roots.CSV TransposeSwap rows and columns of CSV, TSV or pasted spreadsheet data, with delimiter auto-detect.Cubic Equation SolverSolve ax³ + bx² + cx + d = 0 for real and complex roots with steps and a graph.Laplace Transform CalculatorLaplace transform of f(t) with the table rule used for each term and the region of convergence.Exponent CalculatorRaise any number to a power, including negative and fractional exponents.Logarithm CalculatorCalculate log in any base, ln, log10, log2 and antilog with change-of-base steps.Prime Number CheckerCheck if a number is prime, factor it with a factor tree and list primes in a range.GCF and LCM CalculatorFind the GCF and LCM of two or more numbers with Euclid steps and prime factorization.Cubic Yard CalculatorConvert length, width and depth in any unit to cubic yards, cubic feet, m³ and material weight.Factorial CalculatorExact n! up to 5000! with digit count, trailing zeros and double factorial.Prime Factorization CalculatorFind prime factors in exponent form with a factor tree, divisor count and divisors list.Modulo CalculatorCalculate a mod n and the quotient, with floored, truncated and Euclidean rules.Exponential Growth CalculatorExponential growth and decay: final amount, rate or time, discrete or continuous.Linear Regression CalculatorLeast-squares line of best fit: slope, intercept, r, r², predictions and a scatter plot.Summation CalculatorEvaluate sigma notation: sum any expression in n from a to b with partial sums and a chart.Arithmetic Sequence CalculatorFind the n-th term, sum and full list of an arithmetic sequence, or d from two terms.Geometric Sequence CalculatorFind the n-th term, sum and infinite sum of a geometric sequence, or r from two terms.Fibonacci CalculatorExact n-th Fibonacci number (BigInt), sequence lists, Fibonacci check and golden ratio.Factors CalculatorAll factors and factor pairs of a number, prime factors, divisor count and perfect check.Depth of Field CalculatorNear and far focus limits, depth of field and hyperfocal distance for any camera or lens.Crop Factor CalculatorCrop factor, full-frame equivalent focal length and aperture, and field of view for any sensor.Completing the Square CalculatorRewrite ax² + bx + c in vertex form a(x − h)² + k step by step and solve it.Derivative CalculatorSymbolic derivative of any f(x) up to 5th order, with steps, slope at a point and a graph.Exposure Value CalculatorEV from aperture, shutter and ISO, or solve any missing setting with sunny 16 presets.Factoring Trinomials CalculatorFactor trinomials and polynomials: GCF, ac method, difference of squares, cubes, with steps.Integral CalculatorDefinite integral of f(x) from a to b with adaptive Simpson, area graph and antiderivative.Least Common Denominator CalculatorFind the LCD of two or more fractions and rewrite them as equivalent fractions, with steps.Limiting Reactant CalculatorFind the limiting reactant, theoretical yield and leftover excess from an equation.Parabola CalculatorVertex, focus, directrix, axis, intercepts and graph of a parabola from its equation.Polynomial Root FinderFind all real and complex roots of a polynomial up to degree 10, with the factored form.Prime Number List GeneratorList all primes in a range or the first N primes with a fast sieve; copy or download the list.Quadratic Regression CalculatorFit y = ax² + bx + c (or up to degree 6) to x, y data with R², predictions and a graph.Scatter Plot MakerPaste X,Y pairs for a scatter plot with trendline, equation, r and R². Download PNG.Synthetic Division CalculatorDivide polynomials by x − c (synthetic table) or any polynomial (long division) with steps.Set CalculatorUnion, intersection, difference and complement of up to 4 sets, with a Venn diagram and counts.Table of Values CalculatorMake an x/y table for any function with a start, end and step, then plot it or copy CSV.3D Graphing CalculatorPlot z = f(x, y) surfaces and 3D parametric curves; rotate, zoom, add contours, save PNG.Algebra CalculatorSimplify, expand and factor algebraic expressions with exact answers and step-by-step working.Determinant CalculatorDeterminant of a 2×2 to 8×8 matrix with exact fractions and cofactor or row-reduction steps.Differential Equation SolverSolve first- and second-order ODEs step by step, with initial conditions, an RK4 check and a graph.Domain and Range CalculatorFind the domain and range of a function in interval notation, with steps and a graph.Eigenvalue and Eigenvector CalculatorEigenvalues (real or complex), eigenvectors and the characteristic polynomial of a square matrix.Equation SolverSolve any equation for x: exact roots, complex roots, numeric answers, steps and a graph.Inequality CalculatorSolve linear, quadratic, rational and absolute value inequalities with steps and a number line.Inverse Function CalculatorFind the inverse f⁻¹(x) of a function with steps, domain restrictions and a graph.Limit CalculatorEvaluate limits at a point or at infinity, one-sided or two-sided, with steps, table and graph.Linear Interpolation CalculatorInterpolate or extrapolate y for any x from two points or a data table, with steps and a plot.Matrix Inverse CalculatorFind the inverse of a 2×2 to 8×8 matrix in exact fractions with Gauss–Jordan or adjugate steps.Partial Derivative CalculatorPartial derivatives ∂/∂x, ∂/∂y, second and mixed orders with steps, gradient and Hessian.RREF CalculatorRow reduce any matrix to RREF with exact fractions, every row operation, pivots and rank.Stem and Leaf Plot MakerMake stem-and-leaf plots (standard, split stems or back-to-back) with a key; copy or save PNG.Taylor Series CalculatorTaylor and Maclaurin polynomials of any f(x) to order n, with exact coefficients and a graph.Antilog CalculatorInverse logarithm (antilog) in base 10, e, 2 or any base, with steps and scientific notation.Asymptote CalculatorFind vertical, horizontal and slant asymptotes and holes of a function, with graph and reasoning.Cramer's Rule CalculatorSolve 2x2 and 3x3 linear systems by Cramer's rule with every determinant shown step by step.Dot Plot MakerMake a dot plot or line plot from data or a frequency table; download PNG or SVG.Exponential Regression CalculatorFit y = a·bˣ or y = a·e^(kx) to data with r², predictions, residuals and a plot.Extended Euclidean Algorithm CalculatorFind gcd(a, b) and Bézout coefficients x, y with the full step-by-step division table.Factor Tree GeneratorDraw the prime factor tree of any number as a printable diagram, with exponent form and steps.Function Composition CalculatorFind f(g(x)), g(f(x)), f + g, f · g and f / g with values at a point and domains.X and Y Intercept CalculatorFind the x- and y-intercepts of lines, curves and functions with steps and a graph.Line Intersection CalculatorFind where two lines cross from equations, points or slopes, with parallel checks and a graph.Linear Programming SolverSolve max/min linear programs with the simplex method: tableau steps and a 2-variable graph.Modular Exponentiation CalculatorCompute a^b mod m for huge numbers with square-and-multiply steps (BigInt).
See all 74 Algebra & Calculus Calculators →