Matrix Calculator
Perform matrix operations including addition, multiplication, determinant, and inverse.
Multiply
Determinant
Inverse
Quick Examples
Matrix Operations
Determinant of 2×2 Matrix
Inverse of 2×2 Matrix
Matrix Multiplication
Multiply corresponding elements of rows from the first matrix with columns from the second matrix and sum.
Example
Matrix [[2,3],[1,4]]:
- Determinant: 2×4 − 3×1 = 5
- Inverse: (1/5) × [[4,-3],[-1,2]] = [[0.8,-0.6],[-0.2,0.4]]
What Is a Matrix?
A matrix is a rectangular grid of numbers arranged in rows and columns and written inside square brackets. A matrix with m rows and n columns is called an m × n matrix, and each entry is identified by its row-and-column position. Matrices are a compact language for handling many numbers at once: a spreadsheet table, a grayscale image (one number per pixel), or the coefficients of a system of linear equations can all be written as matrices.
Their power comes from matrix operations. Adding matrices combines two tables entry by entry; multiplying them composes transformations — this is how 3D video games rotate and move objects on screen. The determinant, a single number computed from a square matrix, reveals whether the matrix can be "undone" (inverted), a question that decides whether a system of equations has a unique solution.
Key Formulas
Matrix multiplication has a strict shape rule: an m × n matrix can only multiply an n × p matrix, producing an m × p result. The entry in row i, column j of the product is the dot product of row i of the first matrix with column j of the second. The identity matrix I has 1s on the diagonal and 0s elsewhere and behaves like the number 1: AI = IA = A.
Step-by-Step: Multiplying [[1, 2], [3, 4]] × [[5, 6], [7, 8]]
- Step 1 — Check the shapes: both are 2 × 2, so multiplication is allowed and the result is 2 × 2.
- Step 2 — Top-left entry: row 1 of A dotted with column 1 of B: 1·5 + 2·7 = 5 + 14 = 19.
- Step 3 — Top-right entry: row 1 of A dotted with column 2 of B: 1·6 + 2·8 = 6 + 16 = 22.
- Step 4 — Bottom row: 3·5 + 4·7 = 15 + 28 = 43, and 3·6 + 4·8 = 18 + 32 = 50.
- Step 5 — Assemble: the product is [[19, 22], [43, 50]].
Worked Examples
Example 1: Addition
[[1, 2], [3, 4]] + [[5, 6], [7, 8]]: add the matching entries to get [[1+5, 2+6], [3+7, 4+8]] = [[6, 8], [10, 12]].
Example 2: Determinant
For [[4, 7], [2, 6]]: det = 4·6 − 7·2 = 24 − 14 = 10. Because the determinant is non-zero, this matrix is invertible.
Example 3: Inverse
Inverse of [[4, 7], [2, 6]] = (1/10)·[[6, −7], [−2, 4]] = [[0.6, −0.7], [−0.2, 0.4]]. Check: multiplying the matrix by its inverse returns [[1, 0], [0, 1]], the identity.
Common Mistakes
- Assuming AB = BA: matrix multiplication is generally not commutative — order matters.
- Adding mismatched sizes: addition and subtraction require identical dimensions.
- Forgetting the 1/det factor: the inverse formula scales the swapped matrix by one over the determinant.
- Inverting a singular matrix: if det = 0, no inverse exists; the formula would divide by zero.
Frequently Asked Questions
When is a matrix invertible? Exactly when it is square and its determinant is non-zero.
What does the determinant measure? For 2 × 2 matrices, its absolute value is the area scaling factor of the transformation — how much the matrix stretches or shrinks the plane.
Why does multiplication order matter? Each matrix represents a transformation; "rotate then stretch" differs from "stretch then rotate," just as putting on socks and shoes in a different order gives a different result.
What is the identity matrix for? It is the multiplicative neutral element: multiplying any matrix by I leaves it unchanged, and it is the target result when verifying an inverse.
Operation Requirements: Quick Reference
| Operation | Requirement | Result Shape |
|---|---|---|
| Addition / subtraction | Identical dimensions | Same as the inputs |
| Scalar multiplication | None | Same as the input |
| Multiplication A×B | Columns of A = rows of B | m × p from m × n and n × p |
| Determinant | Square matrix | Single number |
| Inverse | Square, det ≠ 0 | Same as the input |
| Transpose | None | Dimensions swap (m × n → n × m) |
Solving a System with RREF: Step-by-Step
Reduced row echelon form turns a system of equations into its solution. Solve 2x + y = 5 and x − y = 1 by writing the augmented matrix [2 1 | 5; 1 −1 | 1]:
- Step 1 — Swap for a leading 1: swap the rows to get [1 −1 | 1; 2 1 | 5].
- Step 2 — Clear below: R2 − 2·R1 gives [1 −1 | 1; 0 3 | 3].
- Step 3 — Scale: R2 ÷ 3 gives [1 −1 | 1; 0 1 | 1].
- Step 4 — Clear above: R1 + R2 gives [1 0 | 2; 0 1 | 1].
- Step 5 — Read the answer: x = 2, y = 1.
Check by substitution: 2(2) + 1 = 5 ✓ and 2 − 1 = 1 ✓. When RREF yields a row like [0 0 | 1], the system has no solution; a row like [0 0 | 0] means infinitely many solutions.
Transpose and Identity
The transpose Aᵀ flips rows into columns: (Aᵀ)[i,j] = A[j,i]. A matrix equal to its own transpose is symmetric. The identity matrix I has 1s on the diagonal and 0s elsewhere and behaves like the number 1: AI = IA = A. It is also the target when verifying an inverse — if A·A⁻¹ ≠ I, the inverse is wrong.
Matrices in the Real World
- Computer graphics: rotation, scaling, and translation are matrix multiplications — every video game frame is thousands of them.
- Regression: fitting a line to data is the matrix equation (XᵀX)β = Xᵀy — the normal equations.
- Networks: adjacency matrices encode which nodes connect; powers of the matrix count multi-step paths.
- Engineering: systems of equilibrium equations in structures and circuits are solved by RREF or matrix inversion.
What is RREF used for? It is the standard row-reduction result: reading off solutions of linear systems, computing rank, finding inverses, and deciding whether a system is consistent.
What does "singular" mean? A singular matrix has determinant zero, so it has no inverse — it flattens space (for example, projecting the plane onto a line), which cannot be undone.
How do I check my own answers? Multiply the matrix by its inverse and confirm you get the identity; for RREF, substitute the solution back into the original equations.