Matrix Calculator

Perform matrix operations including addition, multiplication, inverse, and determinant.

Free to use
12,500+ users
Updated January 2025
Instant results

Matrix Calculator

Matrix Operations

Matrix A

Rows:
Cols:

Rows and columns are linked for square matrices.

Matrix Operations

A matrix is a rectangular array of numbers. This calculator performs common matrix operations. Note that for multiplication, the number of columns in the first matrix must equal the number of rows in the second. For addition and subtraction, matrices must have the same dimensions.

How the Matrix Calculator Works

The Matrix Calculator performs essential operations on matrices, rectangular arrays of numbers that are fundamental to linear algebra, computer graphics, data science, quantum mechanics, and engineering. Matrices provide a compact way to represent systems of equations, linear transformations, data tables, and relationships between variables. Understanding matrix operations is essential for advanced mathematics and modern technology.

A matrix is described by its dimensions: an m×n matrix has m rows and n columns. Each number in the matrix is called an element or entry. Matrices are powerful because they allow us to manipulate multiple equations or transformations simultaneously, performing complex operations efficiently through simple rules.

Matrix Addition and Subtraction

Matrices can be added or subtracted only if they have the same dimensions (same number of rows and columns). The operation is performed element-wise: add or subtract corresponding entries. For example:

[[1, 2], [3, 4]] + [[5, 6], [7, 8]] = [[1+5, 2+6], [3+7, 4+8]] = [[6, 8], [10, 12]]

Scalar Multiplication

To multiply a matrix by a scalar (a single number), multiply every element in the matrix by that scalar. For example:

3 × [[1, 2], [3, 4]] = [[3, 6], [9, 12]]

Scalar multiplication scales the entire matrix, maintaining its structure while changing magnitudes.

Matrix Multiplication

Matrix multiplication is more complex. To multiply matrix A (m×n) by matrix B (n×p), the number of columns in A must equal the number of rows in B. The result is an m×p matrix where each entry is the dot product of a row from A with a column from B.

For example, to find the entry in row i, column j of the product AB:
Multiply each element of row i in A by the corresponding element of column j in B, then sum these products.

Important: Matrix multiplication is not commutative—AB does not generally equal BA. The order matters!

Matrix Inverse

A square matrix A has an inverse A⁻1 (if it exists) such that AA⁻1 = A⁻1A = I, where I is the identity matrix. Not all matrices have inverses—only square matrices with non-zero determinants are invertible. The inverse "undoes" the transformation represented by the matrix, analogous to division for numbers.

For a 2×2 matrix [[a, b], [c, d]], the inverse is (1/det) × [[d, -b], [-c, a]], where det = ad - bc.

Matrix Transpose

The transpose of a matrix A, written A^T, is formed by swapping rows and columns. The first row becomes the first column, the second row becomes the second column, etc. For example:

[[1, 2, 3], [4, 5, 6]]^T = [[1, 4], [2, 5], [3, 6]]

Transposition is useful in many operations and changes an m×n matrix to an n×m matrix.

Matrix Operations in Practice

Example 1: Matrix Addition

Problem: Add [[2, 3], [5, 7]] + [[1, 4], [2, 3]]

Solution: Add corresponding elements:
= [[2+1, 3+4], [5+2, 7+3]]
= [[3, 7], [7, 10]]

Example 2: Matrix Multiplication

Problem: Multiply [[1, 2], [3, 4]] × [[2, 0], [1, 3]]

Solution: Calculate each entry using row-column dot products:
Top-left: (1)(2) + (2)(1) = 2 + 2 = 4
Top-right: (1)(0) + (2)(3) = 0 + 6 = 6
Bottom-left: (3)(2) + (4)(1) = 6 + 4 = 10
Bottom-right: (3)(0) + (4)(3) = 0 + 12 = 12
Result: [[4, 6], [10, 12]]

Example 3: Finding the Inverse

Problem: Find the inverse of [[2, 1], [5, 3]]

Solution:
First, calculate the determinant: det = (2)(3) - (1)(5) = 6 - 5 = 1
Since det ≠ 0, the inverse exists.
A⁻1 = (1/1) × [[3, -1], [-5, 2]] = [[3, -1], [-5, 2]]
Verification: Multiply A × A⁻1 to confirm you get the identity matrix.

Example 4: Transpose

Problem: Find the transpose of [[1, 2, 3], [4, 5, 6]]

Solution: Swap rows and columns:
Row 1 [1, 2, 3] becomes column 1: [1, 4]
Row 2 [4, 5, 6] becomes column 2: [2, 5], then [3, 6]
Result: [[1, 4], [2, 5], [3, 6]]

The original 2×3 matrix becomes a 3×2 matrix.

Tips for Working with Matrices

Check Dimensions First

Before attempting any operation, verify dimension compatibility. For addition/subtraction, matrices must be the same size. For multiplication AB, the number of columns in A must equal the number of rows in B. Many errors stem from attempting impossible operations, so always check dimensions before calculating.

Remember Multiplication Order Matters

Unlike regular numbers where 3×5 = 5×3, matrix multiplication is not commutative: AB ≠ BA in general. In fact, even if AB is defined, BA might not be (if dimensions don't match). Always pay careful attention to the order of multiplication, especially when solving equations or composing transformations.

Organize Your Calculations

Matrix operations involve many numbers. Write clearly, align entries properly in rows and columns, and work systematically. For multiplication, calculate one entry at a time rather than trying to do everything at once. Label intermediate results. Neat, organized work prevents errors and makes checking easier.

Use Identity and Zero Matrices

The identity matrix I acts like the number 1: AI = IA = A. The zero matrix acts like 0: A + 0 = A and A × 0 = 0. These special matrices help verify your work and understand matrix properties. When checking inverses, multiply to confirm you get the identity matrix.

Key Terms Glossary

Matrix

A rectangular array of numbers arranged in rows and columns. Matrices are used to represent linear transformations, systems of equations, data, and relationships. They're fundamental objects in linear algebra and have countless applications.

Dimensions

The size of a matrix, written as m×n where m is the number of rows and n is the number of columns. For example, a 2×3 matrix has 2 rows and 3 columns, containing 6 elements total. Dimensions determine which operations are possible.

Square Matrix

A matrix with the same number of rows and columns (n×n). Only square matrices have determinants and potentially inverses. Examples include 2×2, 3×3, and 4×4 matrices. Many special properties apply only to square matrices.

Identity Matrix

A square matrix with 1s on the main diagonal (top-left to bottom-right) and 0s elsewhere, denoted I. The identity matrix is the multiplicative identity: AI = IA = A. It represents the "do nothing" transformation.

Inverse Matrix

For a square matrix A, its inverse A⁻1 (if it exists) satisfies AA⁻1 = A⁻1A = I. Not all matrices have inverses—the determinant must be non-zero. The inverse "undoes" the transformation represented by the matrix.

Transpose

The transpose of matrix A, written A^T or A', is formed by swapping rows and columns. If A is m×n, then A^T is n×m. The element at position (i,j) in A moves to position (j,i) in A^T.

Determinant

A scalar value computed from a square matrix that indicates whether the matrix is invertible (det ≠ 0) or singular (det = 0). For a 2×2 matrix [[a,b],[c,d]], det = ad - bc. Determinants represent the scaling factor of the linear transformation.

Element (Entry)

An individual number in a matrix, often referenced by its position. The element in row i, column j is denoted a_ij. For example, in [[1,2],[3,4]], the element a_12 is 2 (first row, second column).

Frequently Asked Questions