Matrix Calculator

Perform matrix operations including addition, subtraction, multiplication, determinant, transpose, and inverse. Supports 2x2, 3x3, and 4x4 matrices.

Matrix A

Matrix B

Result

Calculate to see result
Operation
A + B

Quick Reference

Addition: Add corresponding elements
Subtraction: Subtract corresponding elements
Multiply: Row × Column dot product
Determinant: Scalar value of square matrix
Transpose: Swap rows and columns
Inverse: A⁻¹ where A × A⁻¹ = I

Note: For multiplication, the number of columns in Matrix A must equal the number of rows in Matrix B.

How Matrix Operations Work

A matrix is a rectangular array of numbers arranged in rows and columns. Matrix operations form the foundation of linear algebra and have applications in computer graphics, physics simulations, machine learning, and data analysis. Each operation follows specific rules based on the structure of the matrices involved.

Matrix Addition and Subtraction Rules

Addition and subtraction require matrices of identical dimensions. You simply add or subtract the corresponding elements at each position. For example, element at row 1, column 2 of Matrix A combines with the element at row 1, column 2 of Matrix B. If the matrices have different sizes, these operations cannot be performed.

Addition Formula:

C[i,j] = A[i,j] + B[i,j] for all positions i,j

Matrix Multiplication Using Dot Products

Matrix multiplication is more complex than addition. To multiply matrices A and B, the number of columns in A must equal the number of rows in B. Each element in the result comes from the dot product of a row from A and a column from B. The resulting matrix has the same number of rows as A and the same number of columns as B.

For example, if A is 2×3 and B is 3×2, the result C will be 2×2. Element C[1,1] equals (A row 1) · (B column 1), calculated as: A[1,1]×B[1,1] + A[1,2]×B[2,1] + A[1,3]×B[3,1].

What Is a Matrix Determinant?

The determinant is a scalar value computed from a square matrix that provides important information about the matrix. It tells you whether the matrix has an inverse (determinant ≠ 0), and its sign indicates orientation preservation. Determinants are used in solving systems of linear equations, finding eigenvalues, and calculating areas or volumes in geometry.

2×2 Determinant Formula:

|A| = ad - bc, where A = [[a,b],[c,d]]

3×3 Determinant (Sarrus' Rule):

|A| = aei + bfg + cdh - ceg - bdi - afh

Transpose: Swapping Rows and Columns

The transpose of a matrix flips it over its diagonal, converting rows into columns and columns into rows. Element A[i,j] becomes A^T[j,i]. A 2×3 matrix becomes a 3×2 matrix when transposed. Transpose operations are useful in solving systems of equations and in algorithms like least squares fitting.

How Do You Find the Inverse of a Matrix?

The inverse of matrix A (written A⁻¹) is the matrix that when multiplied by A gives the identity matrix: A × A⁻¹ = I. Not all matrices have inverses - only square matrices with non-zero determinants are invertible. The identity matrix I has 1s on the diagonal and 0s elsewhere.

For a 2×2 matrix [[a,b],[c,d]], the inverse is (1/det) × [[d,-b],[-c,a]], where det = ad-bc. For larger matrices, methods like Gaussian elimination or the adjugate formula are used. Matrix inverses solve systems of linear equations: if Ax = b, then x = A⁻¹b.

Applications in Computer Graphics and Machine Learning

Matrix operations power modern technology. In 3D graphics, 4×4 transformation matrices rotate, scale, and translate objects. Neural networks multiply weight matrices by input vectors millions of times per second. Image processing uses matrices for blurring, sharpening, and edge detection filters.

For related mathematical tools, explore our algebra calculator for equation solving, percentage calculator for ratio calculations, or standard deviation calculator for statistical analysis.

Last Updated: January 2026 | Reviewed for accuracy

Related Math Calculators