Matrix Calculator
Do matrix addition, subtraction, multiplication, scalar multiply, transpose, determinant, inverse, RREF, and solve A·x = b with exact fractions and optional step-by-step.
This Matrix Calculator performs common matrix operations (A±B, A·B, Aᵀ, det(A), A⁻¹, RREF, and Ax=b) using exact fractions when possible and shows optional Gaussian elimination steps.
Supported Matrix Operations
- Addition & subtraction (same dimensions)
- Multiplication (columns(A) = rows(B))
- Scalar multiplication (c·A)
- Transpose (Aᵀ)
- Determinant and inverse (square matrices only)
- RREF and solving linear systems (Ax = b)
Background
A matrix is a rectangular grid of numbers. Matrix operations follow strict rules: A + B requires matching dimensions, A·B requires inner dimensions match, and an inverse A−1 exists only if det(A) ≠ 0.
Matrix multiplication combines rows of A with columns of B and is defined only when the number of columns in A equals the number of rows in B.
How to use this calculator
- Choose an operation (A+B, A·B, det(A), etc.).
- Paste or type Matrix A (and Matrix B / vector b if needed).
- Turn on Prefer exact fractions to keep results exact.
- Click Calculate to get the result + optional steps and mini visual.
How this calculator works
- Addition/Subtraction: element-by-element (same dimensions).
- Multiplication: row-by-column dot products.
- RREF/Solve/Inverse: Gaussian elimination with exact fractions.
- Determinant: elimination-based pivot tracking (exact).
Formula & Equation Used
Addition/Subtraction (same size matrices): C[i,j] = A[i,j] ± B[i,j]
Multiplication (A is m×n, B is n×p): C[i,j] = Σk=1..n A[i,k] · B[k,j]
Solving A·x = b: build the augmented matrix [A | b], then use row operations to reach RREF and read x.
Inverse: build [A | I], row-reduce until the left side is I. The right side becomes A−1.
Example Problems & Step-by-Step Solutions
Example 1: Add two 2×2 matrices
Let A = [ [1, 2], [3, 4] ] and B = [ [5, 6], [7, 8] ]. Compute A + B.
- Add entry-by-entry: C[1,1] = 1+5 = 6, C[1,2] = 2+6 = 8.
- Second row: C[2,1] = 3+7 = 10, C[2,2] = 4+8 = 12.
- Result: A+B = [ [6, 8], [10, 12] ].
Example 2: Multiply a 2×3 matrix by a 3×2 matrix
Let A = [ [1,2,3], [4,5,6] ] and B = [ [7,8], [9,10], [11,12] ]. Compute A·B.
- C[1,1] = 1·7 + 2·9 + 3·11 = 58
- C[1,2] = 1·8 + 2·10 + 3·12 = 64
- C[2,1] = 4·7 + 5·9 + 6·11 = 139
- C[2,2] = 4·8 + 5·10 + 6·12 = 154
- Result: A·B = [ [58,64], [139,154] ].
Example 3: Solve A·x = b (2×2)
Let A = [ [2,1], [5,3] ], b = [ [1], [0] ]. Solve for x.
- Write the augmented matrix [A | b] = [ [2,1 | 1], [5,3 | 0] ].
- Eliminate the first column in row 2 (one valid move): R2 = R2 − (5/2)·R1.
- Row-reduce to RREF; the last column becomes the solution vector x.
- This calculator performs those row operations exactly (fractions), then prints x.
Tip: If you want to see the exact row operations, keep Show step-by-step enabled.
Frequently Asked Questions
Q: What formats can I paste?
Spaces or commas for entries; new lines or semicolons for rows. Fractions like 3/5 work too.
Q: Why does A·B sometimes error?
The number of columns in A must equal the number of rows in B.
Q: When does an inverse exist?
Only for square matrices with det(A) ≠ 0.
Q: What is RREF used for?
RREF (row-reduced echelon form) is used to solve linear systems, find matrix rank, and determine whether a system has a unique, infinite, or no solution.