📐

Matrix Calculator

Matrix A
Matrix B
Matrix result

No sign-up required · Runs entirely in your browser · Your data is never stored

✓ Last reviewed: June 2026 · Methodology
Quick answer: Matrix multiplication: an m×n matrix times an n×p matrix gives m×p. NOT commutative: A×B ≠ B×A. Determinant of [a b; c d] = ad − bc. Addition requires identical dimensions.
Use this when: you need a fast, accurate matrix calculator with a worked example and formula explanation.

How do matrix operations work?

Matrix addition and subtraction

Matrices of the same dimensions are added or subtracted element by element. Add each element at position (i,j) of Matrix A to the element at position (i,j) of Matrix B. Both matrices must have identical dimensions — you cannot add a 2×2 to a 3×3. Example: A=[[1,2],[3,4]], B=[[5,6],[7,8]] → A+B=[[6,8],[10,12]]. Need to continue this calculation? Try the Scientific Calculator or the Quadratic Formula Calculator.

Matrix multiplication rules

Matrix multiplication (not element-wise) follows the dot product rule. For A×B: A must have the same number of columns as B has rows. Result dimensions = A's rows × B's columns. For two 2×2 matrices: the result is also 2×2. Result[0][0] = A[0][0]×B[0][0] + A[0][1]×B[1][0]. Note: A×B ≠ B×A in general — matrix multiplication is not commutative.

Determinant: 2×2 and 3×3

For a 2×2 matrix [[a,b],[c,d]]: det = ad − bc. For a 3×3 matrix, expand along the first row using cofactors. A determinant of 0 means the matrix is singular (no inverse exists). The absolute value of the determinant equals the scaling factor of areas (2D) or volumes (3D) under the linear transformation.

Applications of matrices in real life

FieldMatrix Application
Computer graphics3D rotation, scaling, and translation using transformation matrices
Machine learningNeural networks store weights as matrices; forward pass is matrix multiplication
Engineering (structures)Stiffness matrices for finite element analysis
Economics (input-output)Leontief input-output model uses matrix inversion
CryptographyHill cipher encrypts using matrix multiplication over modular arithmetic
Navigation (GPS)Kalman filter (GPS positioning) uses matrix algebra for state estimation
Last reviewed: June 2026 · By Mayra

Sources: WHO Expert Consultation 2004; ICMR Guidelines; standard mathematical references.

When can you multiply two matrices?

Matrix multiplication A × B is only defined when the number of columns in A equals the number of rows in B. Result size: if A is (m × n) and B is (n × p), the result is (m × p). Examples: (2×3) × (3×4) = valid, result is (2×4). (2×3) × (2×3) = invalid (3 cols ≠ 2 rows). Square matrices (same rows and columns) can always be multiplied with themselves.

Identity matrix and why it matters

The identity matrix (I) is the matrix equivalent of the number 1. It has 1s on the diagonal and 0s elsewhere. For 2×2: [[1,0],[0,1]]. For any matrix A: A × I = I × A = A. The identity matrix is used in inverse calculations: A × A⁻¹ = I. In machine learning, initialising neural network weight matrices as identity matrices helps with gradient flow in deep networks.

Matrix determinant and its geometric meaning

The determinant of a 2×2 matrix [[a,b],[c,d]] = ad − bc. Geometrically, the absolute value of the determinant equals how much the matrix scales areas. A matrix with det = 2 doubles areas. det = −1 reflects the coordinate system. det = 0 means the matrix collapses space (linear dependence between rows) — no inverse exists. In computer graphics, transformation matrices with det = 1 preserve area; det = −1 includes a reflection.

Sources: Gilbert Strang, Introduction to Linear Algebra (5th ed.); 3Blue1Brown, Essence of Linear Algebra (visual reference).

Step-by-step matrix examples

2×2 matrix multiplication: worked example

Multiply A = [[1,2],[3,4]] by B = [[5,6],[7,8]]:

2×2 determinant and inverse: worked example

For matrix A = [[4,7],[2,6]]:

3×3 matrix determinant using cofactor expansion

For matrix A = [[1,2,3],[4,5,6],[7,8,9]]:

Matrix operations rules and common errors

OperationDimension RuleCommon Error
Addition A + BA and B must have identical dimensionsAdding a 2×3 and a 3×2 matrix — fails
Multiplication A × BColumns of A must equal rows of BAssuming A×B = B×A — generally false
DeterminantOnly defined for square matricesTrying det of a 2×3 matrix — undefined
Inverse A⁻¹Only square matrices with det ≠ 0Inverting a singular matrix (det = 0)
Transpose AᵀAny matrix — rows become columnsConfusing transpose with inverse

Sources: Gilbert Strang, Introduction to Linear Algebra (5th ed, MIT); Khan Academy Linear Algebra series.

Frequently asked questions

What is a matrix in mathematics?

A matrix is a rectangular array of numbers arranged in rows and columns. A 2×3 matrix has 2 rows and 3 columns. Matrices are used in linear algebra, computer graphics, machine learning, physics, and engineering to represent and solve systems of linear equations.

How do you multiply two matrices?

Multiply matrices A (m×n) and B (n×p) by taking the dot product of each row of A with each column of B. The result is an m×p matrix. Matrix multiplication requires A's column count to equal B's row count. Note: A×B ≠ B×A in general.

What is the determinant of a matrix?

The determinant of a square matrix is a scalar value indicating whether the matrix is invertible. For 2×2 matrix [[a,b],[c,d]], det = ad−bc. A zero determinant means the matrix is singular and has no inverse. A non-zero determinant means the matrix is invertible.

When does a matrix have no inverse?

A matrix has no inverse when its determinant equals zero. This is called a singular matrix. Example: [[1,2],[2,4]] has det = (1×4)−(2×2) = 0 — singular. Only square matrices with non-zero determinants have inverses.

What are common uses of matrix operations?

Matrix multiplication is used in computer graphics (3D transformations), machine learning (neural network forward pass), engineering (structural analysis), economics (input-output models), and cryptography (Hill cipher).

Matrix multiplication: step-by-step guide

Dimension rule: when can you multiply?

Matrix A (m × n) can be multiplied by Matrix B (n × p) only when A's column count equals B's row count. The result has dimensions (m × p). Two 2×2 matrices always produce a 2×2 result. A 2×3 matrix cannot be multiplied by another 2×3 matrix — dimensions don't match.

Worked 2×2 multiplication example

A = [[1,2],[3,4]] × B = [[5,6],[7,8]]:

Determinant and invertibility

For [[4,7],[2,6]]: det = (4×6)−(7×2) = 24−14 = 10. Since det ≠ 0, inverse exists. A⁻¹ = (1/10)×[[6,−7],[−2,4]] = [[0.6,−0.7],[−0.2,0.4]]. Verify: A × A⁻¹ = [[1,0],[0,1]] ✓

Common mistakes to avoid

MistakeCorrect approach
Assuming A×B = B×AMatrix multiplication is NOT commutative. Always check if order matters.
Adding matrices of different sizesAddition requires identical dimensions. Check rows and columns match.
Inverting a singular matrixCalculate determinant first. If det = 0, no inverse exists.

Related calculators

M
Reviewed by Mayra — MBA Finance. Formulas verified against primary sources; see methodology.