Matrix Calculator
Add, subtract, multiply, transpose, and find the determinant or inverse of 2×2 and 3×3 matrices — with exact fraction (rational) results or decimals rounded to 6 places.
Input
Fractions stay exact; decimals are rounded to 6 places.
Enter whole numbers, decimals (e.g. 0.5), or fractions (e.g. 1/2) in each cell. Empty cells count as 0.
Matrix A
Matrix B
Output
| No data yet |
Guides
The Matrix Calculator performs the core operations of linear algebra on 2×2 and
3×3 matrices: addition, subtraction, multiplication, transpose, determinant, and
inverse. Every result is computed with exact rational arithmetic, so answers
that are fractions stay fractions — 1/3 never silently becomes 0.333333
unless you ask for it.
How to use it
- Pick a matrix size — 2 × 2 or 3 × 3. The grid of cells resizes to match.
- Choose an operation. Binary operations (add, subtract, multiply) reveal a second matrix, B; transpose, determinant, and inverse work on matrix A alone, so B is hidden for them.
- Fill in the cells. You can type whole numbers, decimals like
0.5, or exact fractions like1/2or-2/5. Empty cells are treated as0. - Select the output format — Fraction (exact) keeps every value as a reduced fraction, while Decimal rounds to six places.
The result appears as a grid. For the determinant and inverse, a step-by-step working panel shows exactly how the answer was reached.
What each operation does
- Add / Subtract combine two same-size matrices element by element.
- Multiply is true matrix multiplication — each result cell is the dot product of a row of A with a column of B, not an element-wise product.
- Transpose flips A across its main diagonal, turning rows into columns.
- Determinant uses
ad − bcfor a 2×2 matrix and full cofactor expansion for a 3×3. - Inverse is computed from the adjugate (the transpose of the cofactor matrix) divided by the determinant.
Why exact fractions matter
Inverting an integer matrix almost always produces fractions. The inverse of
[[2, 1], [0, 3]], for example, is [[1/2, -1/6], [0, 1/3]]. Because the
calculator keeps a numerator and denominator as integers and reduces them with
the greatest common divisor, these values are printed exactly rather than as
lossy decimals. Switch to decimal mode only when you want a rounded, at-a-glance
figure.
What happens with a singular matrix?
A matrix whose determinant is 0 has no inverse. Rather than dividing by zero,
the calculator detects this and returns a clear message explaining that the
matrix is singular.
Is my data sent anywhere?
No. All calculations run entirely in your browser — the matrices you enter never leave your device.
Which sizes are supported?
Square matrices of size 2 × 2 and 3 × 3. These cover the overwhelming majority of hand-worked linear-algebra problems, homework, and quick checks.
Use it from code
From 3 credits per callREST API
curl -X POST https://api.iotools.cloud/v1/tool/matrix-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"matrixSize": "2",
"operation": "add",
"outputFormat": "fraction",
"A11": "2",
"A12": "1",
"A21": "0",
"A22": "3",
"B11": "1",
"B12": "2",
"B21": "3",
"B22": "4"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `matrix-calculator` tool (Matrix Calculator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.