Matrix Calculator
Calculate with small matrices using exact rational arithmetic. Multiply compatible rectangular matrices, inspect the row and column behind any product entry, add or subtract matching grids, and transpose rows into columns. For square matrices, inspect a determinant or inverse with cofactor contributions and an exact identity check. Paste spreadsheet cells, preserve fractions and export the calculation.
See how every matrix entry is made
Multiply, add, subtract, transpose, or inspect a determinant and inverse. Keep exact fractions and follow the arithmetic behind a selected cell.
Try an example
Columns in A must equal rows in B. The result has A’s row count and B’s column count.
Enter integers, decimals or fractions such as −3/4 using a minus sign (-). Blank entries are missing values, not zero. Results are exact for the numbers entered.
Matrix A
| Row | Col 1 | Col 2 | Col 3 |
|---|---|---|---|
| 1 | |||
| 2 |
Paste matrix A
One row per line (or semicolon). Separate entries with tabs, commas or spaces. Use 1/2 without spaces inside a fraction. Pasting replaces the visible dimensions and clears this matrix’s hidden cells.
Matrix B
| Row | Col 1 | Col 2 |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 |
Paste matrix B
One row per line (or semicolon). Separate entries with tabs, commas or spaces. Use 1/2 without spaces inside a fraction. Pasting replaces the visible dimensions and clears this matrix’s hidden cells.
Resizing preserves hidden entries. New cells start blank; enter 0 explicitly. Dimensions are limited to 1–4 rows and 1–4 columns.
Methods, limits and sources
Multiplication uses a row of A and a column of B: C(i,j) = Σ A(i,k)B(k,j). Matrix multiplication is generally not commutative. Addition and subtraction work entry by entry; a transpose exchanges row and column indices.
Determinants use first-row cofactor expansion. Inverses use the transposed cofactor matrix divided by the determinant; this exact method is practical here because the matrix has at most four rows. A zero determinant means there is no inverse. The identity check uses the same exact rational arithmetic.
Use at most 48 characters per entry, 12 decimal places and scientific exponents from −12 to 12. Each entered value has magnitude at most 10¹², with reduced numerator and denominator at most 10²⁴. Fraction components also have numerator/denominator limits of 10²⁴. Outputs may exceed the input limits. No complex numbers, symbolic variables, thousands separators, or expressions such as √2. Paste is limited to 4096 characters. Large exact fractions remain fractions; there is no floating-point tolerance or rounding in the algebra.
Primary references: OpenStax: matrix operations, OpenStax: inverses, and MIT: determinants and inverses. For equations with unknowns, use the system of equations calculator.
How to use this calculator
- Choose multiplication, addition, subtraction, transpose, determinant or inverse. Read the dimension rule beneath the operation selector.
- Set 1–4 rows and columns for each active matrix. Enter every cell, using 0 explicitly for a zero value; fractions such as -3/4 and finite decimals are accepted.
- To use spreadsheet data, expand Paste matrix A or B. Use a newline or semicolon per row and tabs, commas or spaces between entries, then apply the matrix.
- Select a result cell to inspect its exact calculation. In a product, the matching input row and column are highlighted and each term is listed.
- For determinants and inverses, inspect the signed first-row cofactor contributions. An inverse also includes an exact A × A⁻¹ identity check; a singular matrix clearly reports that no inverse exists.
- Copy the result as tab-separated text or download the inputs, results and explanations as CSV. Import fraction cells as text to avoid spreadsheet date conversion.
The Formula
The mathematical logic powering this calculation is:
A(m × n) × B(n × p) = C(m × p), where C(i,j) = Σ A(i,k)B(k,j).
(A ± B)(i,j) = A(i,j) ± B(i,j), requiring equal dimensions.
Aᵀ(i,j) = A(j,i).
det(A) = Σ A(1,j) × cofactor(1,j).
A⁻¹ = cofactor(A)ᵀ / det(A), when A is square and det(A) ≠ 0.Worked Example
If you input:
- Operation: A × B
- Matrix A: 1 2 3; 4 5 6
- Matrix B: 7 8; 9 10; 11 12
Result:
A × B = [[58, 64], [139, 154]]. For row 1, column 1: 1 × 7 + 2 × 9 + 3 × 11 = 58. The inner dimensions are both 3, so the 2 × 3 and 3 × 2 matrices produce a 2 × 2 result.
Frequently Asked Questions
When can two matrices be multiplied together?
A × B is defined when A’s column count equals B’s row count. An m × n matrix multiplied by an n × p matrix produces an m × p matrix. This calculator checks those dimensions before calculating. Each output entry is a row-column dot product, not simply a product of entries in matching positions.
Why can A × B differ from B × A?
Matrix multiplication generally depends on order. Swapping A and B changes which rows and columns meet, and may change the result’s dimensions. Sometimes one order is defined and the other is not. The Swap A and B control preserves both entered grids and lets you inspect the changed operation.
Are fractions and decimal entries calculated exactly?
Yes. Finite decimals and accepted scientific notation are converted to reduced rational numbers before calculation. For example, 0.1 is treated as exactly 1/10. No floating-point tolerance is used to classify a determinant as zero. Exactness is for the entered numbers; it cannot remove uncertainty from measured or rounded source data.
Why does a matrix sometimes have no inverse?
A standard two-sided inverse requires a square matrix with a nonzero determinant. A zero determinant means the rows or columns are linearly dependent, and the matrix is singular. The calculator reports this as a mathematical result instead of dividing by zero. Rectangular matrices are not given a pseudoinverse by this tool.
How are determinants and inverse entries explained?
The determinant is expanded along the first row. Each minor deletes that row and the selected column; alternating signs turn minors into cofactors. An inverse entry at row i, column j is the cofactor at row j, column i divided by the determinant. The transposition matters. The tool also multiplies A by the computed inverse to display the identity matrix.
What happens to entries when I resize a matrix or change operations?
Shrinking a grid hides its unused entries without erasing them. Expanding it restores those entries; previously unused cells are blank and must be completed. Unary operations use only A and preserve the hidden B draft. Applying a pasted matrix replaces that matrix and clears its hidden cells. Reset restores the rectangular multiplication example.
What input limits and paste formats are supported?
Matrices have 1–4 rows and 1–4 columns. Each entry permits up to 48 characters, 12 decimal places and an exponent between -12 and 12. Its absolute value cannot exceed 10¹²; reduced numerator and denominator cannot exceed 10²⁴. Fraction components also have numerator/denominator limits of 10²⁴. Paste supports at most 4096 characters of unquoted numeric cells separated by tabs, commas or spaces, with newlines or semicolons between rows. Complex values, symbols and expressions are unsupported. Exact outputs may exceed the input limits.
Is this the same as solving a system of equations?
No. This workspace performs operations on entered matrices. It does not interpret coefficients as equations or find unknown variables. Use the related System of Equations Calculator for simultaneous linear equations, solution classifications and elimination steps. Matrix multiplication and inverse checks here can help verify small calculations from that work.
Similar Calculators
Vector Calculator
Explore 2D and 3D vectors: dot and cross products, angles, addition, projections and area, with interactive geometry, exact arithmetic and CSV.
System of Equations Calculator
Solve 2–4 simultaneous linear equations with exact fractions, elimination steps, a two-variable graph, and checks for unique, infinite or no solutions.
Fraction Calculator
Add, subtract, multiply, and divide fractions with step-by-step simplified results.
Online Calculator
Use this Online Calculator as a fully interactive scientific calculator with memory, trigonometry, powers, roots, and advanced math operations.
Linear Programming Calculator
Maximize or minimize a linear objective with variable bounds and constraints. Inspect simplex steps, exact certificates and equally good plans.
