Matrix Calculator - 2×2 and 3×3 Add, Multiply, Determinant, Inverse
Square 2×2 and 3×3 only. IEEE floating point, not a CAS. Default A = [[1, 2], [3, 4]] has det −2. Runs in your browser.
Matrices A and B
Only square 2×2 and 3×3. Multiplication is A×B of matching size, not rectangular. Inverse uses adjugate/det and rejects det = 0. Arithmetic is IEEE-754 float, not exact symbolic.
Result
What This Matrix Calculator Will and Will Not Do
A matrix is a rectangular array of numbers. This page is a 2×2 and 3×3 square calculator: addition, subtraction, multiplication A×B, scalar multiply, transpose, determinant, and inverse. It is not n×n, not rectangular (no 2×3 times 3×2), not a computer algebra system, and not exact rational arithmetic. Entries are IEEE-754 floating-point numbers, the same kind a scientific calculator uses. Tiny leftovers such as 1.000000000002 after an inverse can appear; they are float dust, not a theorem.
The default matrix is A = [[1, 2], [3, 4]]. Its determinant is ad − bc = 4 − 6 = −2. Because det ≠ 0 the inverse exists: (1/−2) × [[4, −2], [−3, 1]] = [[−2, 1], [1.5, −0.5]]. That pair is the sanity check for this page. Switch the operation to determinant if you only want −2; leave it on inverse to see the adjugate formula filled in.
Linear algebra in a first course lives in these two sizes: 2×2 for geometric shears and 2-unknown systems, 3×3 for planes and 3-unknown systems. Larger homework belongs in a CAS or a numerical library (Gaussian elimination with pivoting). Pair this tool with the quadratic formula calculator when a 2×2 characteristic polynomial appears, or the slope calculator when a 2×2 is secretly two points on a line.
How to Use This Free Online Matrix Calculator
Using this 2×2 / 3×3 matrix tool is straightforward:
- Pick 2×2 or 3×3. The grid resizes. Going from 2×2 to 3×3 pads with a 1 in the bottom-right so a block-diagonal extension is easy to edit.
- Fill A (and B when the operation needs a second matrix; or k when the operation is scalar multiply).
- Choose an operation and read the result panel. det(A) is always shown as a side value because inverse depends on it. Copy the matrix as tab-separated rows, or clear to restore the default [[1, 2], [3, 4]].
Note: last matrices are stored in localStorage for up to 30 days on this device only.
Determinant - 2×2 (ad − bc) and 3×3 Expansion
The 2×2 determinant is the signed area of the parallelogram spanned by the column vectors (a, c) and (b, d). A negative sign means the ordered basis is reflected. Zero means the columns are parallel: the parallelogram collapses and the matrix is singular.
The 3×3 rule this page uses is expansion along the first row:
det = a(ei − fh) − b(di − fg) + c(dh − eg)
for [[a, b, c], [d, e, f], [g, h, i]]
Each parenthesis is a 2×2 determinant (a minor). The signs alternate +, −, +. Sarrus’ rule is a mnemonic for the same 3×3 polynomial; it does not extend to 4×4, which is why this calculator stops at 3×3 rather than pretending Sarrus works in general.
Inverse via Adjugate / Determinant
If det(A) = 0 the inverse does not exist and this page says so instead of printing Infinity. Otherwise A−1 = (1/det A) × adj(A), where the adjugate is the transpose of the cofactor matrix.
For 2×2 the cofactor recipe collapses to swapping the main diagonal and negating the off-diagonal:
[[a, b], [c, d]]⁻¹ = (1/(ad−bc)) × [[d, −b], [−c, a]]
Plug in a=1, b=2, c=3, d=4: (1/−2) × [[4, −2], [−3, 1]] = [[−2, 1], [1.5, −0.5]]. Multiply A by that inverse in the A×B operation (paste the inverse into B) and you should see a matrix very close to the identity [[1, 0], [0, 1]]. Float error may leave 0.999999999999 or −0 instead of a clean 1 and 0.
For 3×3 the page builds all nine cofactors from 2×2 minors, transposes, and divides by det. There is no 4×4 inverse here.
Multiplication Order, Addition, and Transpose
A × B is defined only when the column count of A equals the row count of B. On this page both matrices are the same square size, so the product is defined and stays square. The (i, j) entry is the dot product of row i of A with column j of B. A × B is not B × A in general: try A = [[1, 2], [3, 4]] and B = [[0, 1], [1, 0]] and swap the grids. Rectangular products (2×3)(3×2) are useful in data science and are deliberately omitted so the UI cannot silently drop a dimension.
Addition and subtraction are elementwise and require equal size, which is automatic here. Scalar multiply scales every entry. Transpose swaps indices: Aᵀ[j, i] = A[i, j]. For a 2×2, [[1, 2], [3, 4]]ᵀ = [[1, 3], [2, 4]]. Transpose does not change the determinant.
Singular Matrices and Linear Systems
A square matrix is singular when det = 0. Rows (and columns) are linearly dependent. The homogeneous system Ax = 0 has a non-trivial solution; the inhomogeneous system Ax = b has either no solution or infinitely many. Invertible (non-singular) matrices have det ≠ 0, a unique inverse, and a unique solution x = A−1b for every b. This calculator will not invent a pseudoinverse; if you need least-squares for a singular or rectangular problem, that is a different tool.
Example of a singular 2×2: [[1, 2], [2, 4]] has det = 4 − 4 = 0. Inverse is refused. The second row is twice the first.
Where 2×2 and 3×3 Matrices Show Up
1. Two-unknown linear systems
ax + by = e, cx + dy = f is A[[x], [y]] = [[e], [f]] with A = [[a, b], [c, d]]. If det ≠ 0, multiply by the inverse this page prints. Cramer’s rule is the same determinant idea written per unknown.
2. Plane geometry and slopes
A 2×2 with columns equal to two direction vectors has determinant equal to signed area. A slope between two points is a 2×1 story; wrapping it as a 2×2 with a basis vector is how computer-graphics people rotate a segment. For the raw slope of two points, use the slope calculator.
3. Characteristic polynomials
det(A − λI) = 0 for a 2×2 is a quadratic. Compute A − λI by hand for a chosen λ, or expand the polynomial and finish with the quadratic formula calculator. This matrix page will not solve eigenvalues symbolically.
A Full 3×3 Determinant, an Identity Check, and Float Dust
Switch the size control to 3×3 and try [[1, 2, 3], [0, 1, 4], [5, 6, 0]]. First-row expansion:
- a = 1 times det[[1, 4], [6, 0]] = 1×(0 − 24) = −24
- minus b times the middle minor: −2 × det[[0, 4], [5, 0]] = −2×(0 − 20) = −2×(−20) = +40
- plus c = 3 times det[[0, 1], [5, 6]] = 3×(0 − 5) = −15
- total det = −24 + 40 − 15 = 1
Because 1 ≠ 0 the inverse exists. This page will print a 3×3 of IEEE floats, not a matrix of fractions with denominator 79. If you need exact 1/79 entries, a CAS is the right tool; we said so in the heading. Multiplying A by the printed inverse should land near the identity [[1, 0, 0], [0, 1, 0], [0, 0, 1]]. “Near” may mean 0.9999999998 or 1.2e-16 in an off-diagonal slot. That is rounding in binary, not a wrong cofactor.
The 2×2 identity check is easier to see by hand. With A = [[1, 2], [3, 4]] and A−1 = [[−2, 1], [1.5, −0.5]], the product A × A−1 has top-left 1·(−2)+2·1.5 = −2+3 = 1, top-right 1·1+2·(−0.5) = 1−1 = 0, bottom-left 3·(−2)+4·1.5 = −6+6 = 0, bottom-right 3·1+4·(−0.5) = 3−2 = 1. Paste the inverse into B, choose A×B, and you should see that identity (or float dust around it). A−1 × A is also I for an invertible square matrix; try swapping the grids to confirm both products.
Addition is less dramatic: [[1, 2], [3, 4]] + [[1, 0], [0, 1]] = [[2, 2], [3, 5]]. Scalar 2 × A = [[2, 4], [6, 8]], whose determinant is 4 times det(A) because a 2×2 determinant is homogeneous of degree 2: det(kA) = kn det(A) with n = 2 or 3. Check: det([[2, 4], [6, 8]]) = 16 − 24 = −8, and 2² × (−2) = −8. If a scalar multiply on this page disagrees with that identity, an entry was typed wrong.
Mistakes This 2×2 / 3×3 Tool Will Not Hide
Using ad − bc on a 3×3. There is no two-term 3×3 determinant. If you “cross multiply” three rows you have invented a fake formula. Use the expansion printed above.
Dividing matrices. There is no A ÷ B in general. People mean A × B−1 or B−1 × A, which are different. This page offers multiply and inverse separately so you choose the order.
Inverting a singular matrix by “adding a tiny epsilon.” That is a numerical hack for ill-conditioned systems, not a homework inverse. If det is 0 we refuse. If det is 1e-18 the inverse will be huge and noisy; believe the condition, not six digits of junk.
Treating a 2×2 of pixel sizes as a 3×3 without padding. Switching size to 3×3 on this page pads a 1 in the corner so the extra row/column starts as an identity block. Replace those pads if your actual 3×3 is different. Do not assume a graphics affine matrix (which is often 3×3 for 2-D and 4×4 for 3-D) fits this homework tool.
Eigenvalues, rank, row reduction, and n×n determinants are out of scope. Rank of a 2×2 is 2 when det ≠ 0 and less than 2 when det = 0; we will not print a rank number beyond that observation. For expressions that only need a scientific-calculator evaluation of a single entry, use the scientific calculator.
Cramer’s Rule Sketch and a 2×2 System You Can Finish
Cramer’s rule solves Ax = b for a square invertible A by replacing one column at a time and taking determinant ratios. For the 2×2 system x + 2y = 5, 3x + 4y = 6, the coefficient matrix is the default A with det −2. Replace the first column by (5, 6): det[[5, 2], [6, 4]] = 20 − 12 = 8, so x = 8/(−2) = −4. Replace the second column: det[[1, 5], [3, 6]] = 6 − 15 = −9, so y = −9/(−2) = 4.5. Check: −4 + 2×4.5 = 5, and 3×(−4)+4×4.5 = −12+18 = 6. You can get the same (x, y) by multiplying A−1 by the column (5, 6): [[−2, 1], [1.5, −0.5]] × [[5], [6]] = [[−10+6], [7.5−3]] = [[−4], [4.5]]. This page will not take a b-column as a dedicated input; it will invert A so you can finish the multiply by hand or in the A×B grid if you paste b as a 2×2 with a dummy second column - awkward, which is why Cramer’s rule is still taught as determinants rather than as a matrix-UI trick.
For 3×3 Cramer you need four determinants (the original plus one per unknown). That is four clicks of this calculator with edited columns, not one magic button. If det A is 0, Cramer refuses for the same reason inverse refuses. A consistent singular system still has solutions; Cramer simply will not find them. Row reduction would. We do not row-reduce here.
Transpose shows up when you change from row vectors to column vectors. (AB)^T = B^T A^T, order reversed. Check with A the default and B = [[0, 1], [1, 0]]: compute A×B, transpose that result, and compare with B^T × A^T (B is its own transpose). If those two 2×2 grids disagree, an entry was typed wrong. The identity (kA)^T = k A^T is even quicker: scalar 2, then transpose, versus transpose then scalar 2.
None of these identities require n larger than 3, which is why a 2×2/3×3 tool is enough for a first linear-algebra course. When a problem says 4×4, this page is the wrong tab.
Frequently Asked Questions (FAQ) - Matrices
How do I calculate the determinant of a 2×2 matrix?
For A=[[a, b], [c, d]], det(A)=ad−bc. The default example [[1, 2], [3, 4]] gives 1×4−2×3=4−6=−2. A 2×2 matrix is invertible exactly when this value is not zero.
How do I find the inverse of a matrix?
Compute the determinant. If it is 0, there is no inverse (the matrix is singular). Otherwise invert with (1/det)×adjugate. For 2×2, the inverse of [[a, b], [c, d]] is (1/(ad−bc))×[[d, −b], [−c, a]]. The default [[1, 2], [3, 4]] has inverse [[−2, 1], [1.5, −0.5]]. For 3×3 this page uses the cofactor (adjugate) formula. Arithmetic is IEEE floating point, not exact symbolic.
Does the order of matrix multiplication matter?
Yes. Matrix multiplication is not commutative: A×B and B×A are different in general, even when both products exist. This calculator multiplies A×B for two matrices of the same size (2×2 with 2×2, or 3×3 with 3×3). It does not multiply rectangular matrices.
What is a singular matrix?
A square matrix is singular when its determinant is 0. It has no inverse, its rows (and columns) are linearly dependent, and the linear system Ax=b either has no solution or infinitely many. This calculator refuses inverse when det=0 rather than printing infinities.
How do I calculate the determinant of a 3×3 matrix?
Expand along the first row: det=a(ei−fh)−b(di−fg)+c(dh−eg) for [[a,b,c],[d,e,f],[g,h,i]]. That is three 2×2 determinants with alternating signs. This page uses that expansion. It does not compute 4×4 or larger determinants.
Does this matrix calculator upload my numbers?
No. Every operation runs in your browser with JavaScript. Nothing is sent to a server. After the page loads, the tool still works if the network drops. The last matrices are stored only in localStorage on your device for up to 30 days.
Why Choose Our Matrix Calculator?
- Free, no account. Unlimited 2×2 and 3×3 operations.
- Private. Grids never leave the browser.
- Honest scope: square 2×2/3×3 only, IEEE floats, not a CAS.
- Inverse refuses det = 0 instead of printing Infinity.
- Default check: [[1, 2], [3, 4]] → det −2, inverse [[−2, 1], [1.5, −0.5]].
- Works offline after the first page load.
Related Tools
Discover more free developer tools that might interest you.
Area Calculator
Calculate area of squares, rectangles, triangles, circles, and more
Use ToolAverage Calculator
Calculate mean, median, mode, and range from a list of numbers
Use ToolBasic Calculator
Add, subtract, multiply, and divide with a free online calculator
Use ToolBig Number Calculator
Add, subtract, multiply, and divide integers too large for a standard calculator
Use ToolBinary Calculator
Add, subtract, and convert binary numbers to decimal and hex
Use ToolCircle Calculator
Find radius, diameter, circumference, area, arc length, and sector area
Use ToolRelated guides
Read the how-to, then come back to this tool when you are ready to run it locally.