Matrix Calculator

Matrix operations: add, subtract, multiply, scalar multiply, determinant, transpose, and inverse. Enter matrices up to 4×4 size — results display in a grid.

Matrix A Input

row
2
×
column
2
[]
[]
×

Matrix B Input

row
2
×
column
2
[]
[]

Operations on A and B

Guides & Reference

How It Works

Matrix addition and subtractionLinear algebra, data science, combining transformations.

Enter matrices A and B of identical dimensions. Press Add or Subtract. Each element: (A±B)ᵢⱼ = Aᵢⱼ ± Bᵢⱼ. Matrices must be the same size — a 2×3 cannot add to a 3×2. Result is the same size as the inputs. Resize matrices using the row/column controls above each grid.

Addition: (A+B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ (same dimensions required)A=[[1,2],[3,4]] + B=[[5,6],[7,8]] = [[6,8],[10,12]]
Matrix multiplicationComputer graphics, neural networks, solving systems of equations.

Enter A (m×n) and B (n×p). Press Multiply. Result C(m×p): Cᵢⱼ = Σₖ Aᵢₖ × Bₖⱼ (dot product of row i and column j). A 2×3 times a 3×2 gives a 2×2. Order matters: A×B ≠ B×A. If dimensions mismatch, an error displays.

Cᵢⱼ = Σₖ Aᵢₖ Bₖⱼ | A(m×n) × B(n×p) → C(m×p)A[[1,2],[3,4]] × B[[5,6],[7,8]] = [[19,22],[43,50]]
DeterminantChecking invertibility, solving linear systems, computing area/volume of transformations.

Select matrix A and press Determinant. For 2×2: ad−bc. For 3×3: cofactor expansion. For 4×4: recursive cofactor expansion. Result is a single scalar. det=0: singular matrix, no inverse, dependent rows. det≠0: invertible. Geometric meaning: |det| is the area scaling factor of the linear transformation.

det[[a,b],[c,d]] = ad−bc | det = 0 → singulardet[[1,2],[3,4]] = 4−6 = −2 | det[[1,0],[0,1]] = 1
Inverse matrixSolving matrix equations (AX=B → X=A⁻¹B), undoing transformations.

Select matrix A and press Inverse. The calculator uses Gauss-Jordan elimination: augment [A|I], row-reduce to [I|A⁻¹]. If det=0, the inverse does not exist — the calculator displays an error. For 2×2: A⁻¹ = (1/det)×[[d,−b],[−c,a]]. Verify: multiply A × A⁻¹ and check the result is the identity.

A⁻¹ = (1/det) × adj(A) | requires det ≠ 0A=[[1,2],[3,4]] → A⁻¹=[[-2,1],[1.5,-0.5]], det=-2
Transpose and scalar multiplyMachine learning (weight matrices), physics (tensor operations), statistics (covariance).

Transpose swaps Aᵀ: row i becomes column i. A(m×n) transposed is Aᵀ(n×m). Scalar multiply: each element Aᵢⱼ × k. Enter the scalar value in the field above matrix A and press Scalar×A. Properties: (AB)ᵀ = BᵀAᵀ (order reverses). det(Aᵀ) = det(A). A symmetric matrix satisfies Aᵀ = A.

Transpose: (Aᵀ)ᵢⱼ = Aⱼᵢ | Scalar: kA has entries k×AᵢⱼA=[[1,2,3],[4,5,6]] → Aᵀ=[[1,4],[2,5],[3,6]]

Quick Reference

Verify these in the calculator above.

Determinant

det [[1,2],[3,4]]

-2

Identity det

det [[1,0],[0,1]]

1

Add

[[1,2],[3,4]] + [[1,1],[1,1]]

[[2,3],[4,5]]

Multiply I

[[1,2],[3,4]] × [[1,0],[0,1]]

[[1,2],[3,4]]

Transpose

Transpose [[1,2],[3,4]]

[[1,3],[2,4]]

Scalar

3 × [[1,2],[3,4]]

[[3,6],[9,12]]

Inverse

Inverse [[2,0],[0,4]]

[[0.5,0],[0,0.25]]

Dimensions

2×3 × 3×2 result size

2×2 matrix

Tips & Shortcuts

Use the row/column controls to resize each matrix independently — A can be 2×3 while B is 3×4 for a valid multiplication.

To verify multiplication: compute A×B, then check that A×B×B⁻¹ = A (if B is square and invertible).

For a 2×2 inverse, use the formula: swap diagonal, negate off-diagonal, divide by determinant — faster than running the full calculator.

The identity matrix button resets a matrix to I (1s on diagonal, 0s elsewhere) — useful as a starting point for testing operations.

Matrix multiplication is not commutative: always check dimension compatibility and remember A×B ≠ B×A.

Common Mistakes

Multiplying matrices with incompatible dimensions

A(m×n) × B(p×q) requires n=p. A 2×3 cannot multiply a 2×3 (3≠2). It can multiply a 3×4 (3=3), giving 2×4. The error message states the required dimensions.

Expecting matrix multiplication to be commutative

A×B ≠ B×A in general. Even when both products exist and have the same size, the results differ. Exception: diagonal matrices and the identity matrix commute with any matrix.

Computing inverse of a singular matrix

If det(A)=0, the matrix has no inverse. The calculator shows an error. Check for linearly dependent rows (one row is a multiple of another) — this always gives det=0.

Confusing transpose with inverse

Aᵀ swaps rows and columns. A⁻¹ is the matrix that undoes multiplication by A. For orthogonal matrices (rotation matrices), Aᵀ = A⁻¹ — but this is a special case, not the general rule.

Adding matrices of different sizes

Matrix addition requires identical dimensions. A 2×3 matrix cannot add to a 3×2 — even though both have 6 elements. Resize using the dimension controls so both matrices match.

Frequently Asked Questions

Matrix multiplication A×B requires A columns = B rows. Result entry (i,j) = dot product of row i of A with column j of B. For 2×2: [a,b;c,d]×[e,f;g,h] = [ae+bg, af+bh; ce+dg, cf+dh]. Enter both matrices and press Multiply.

The determinant of a square matrix is a scalar value. For 2×2: det[[a,b],[c,d]] = ad − bc. For 3×3: expansion along any row or column using minors. Determinant = 0 means the matrix is singular (no inverse). Non-zero determinant means the matrix is invertible.

A⁻¹ exists only if det(A) ≠ 0. For 2×2: A⁻¹ = (1/det)×[[d,−b],[−c,a]]. For larger matrices, use row reduction (Gauss-Jordan elimination). The calculator computes the inverse using this method. Verify: A×A⁻¹ = I (identity matrix).

Transpose swaps rows and columns: (Aᵀ)ᵢⱼ = Aⱼᵢ. A 2×3 matrix transposed gives a 3×2 matrix. The diagonal elements stay fixed. Properties: (Aᵀ)ᵀ = A, det(Aᵀ) = det(A).

Only if the number of columns in A equals the number of rows in B. A(m×n) × B(n×p) = C(m×p). A 2×3 matrix can multiply a 3×4 matrix (giving 2×4). A 2×3 cannot multiply a 2×3 (3 ≠ 2). Matrix multiplication is not commutative: A×B ≠ B×A in general.

Scalar multiplication multiplies every element of the matrix by the scalar k. If k=3 and A=[[1,2],[3,4]], then 3A=[[3,6],[9,12]]. det(kA) = k^n × det(A) for an n×n matrix.

The identity matrix I has 1s on the diagonal and 0s elsewhere. For 2×2: [[1,0],[0,1]]. A×I = I×A = A for any compatible A. The inverse satisfies A×A⁻¹ = I. The identity matrix acts like the number 1 for matrix multiplication.

Related Calculators