Matrix Calculator
Select an operation to see the formula and calculation steps.
A matrix is a rectangular grid made up of numbers, symbols, or expressions, organized into rows and columns. Matrices are essential tools in many areas of math and science, including physics, statistics, computer graphics, linear algebra, and numerical analysis.
The size or dimensions of a matrix are described as m × n, where m represents the number of rows and n the number of columns. Each individual entry in a matrix is known as an element, and its position is typically indicated by a subscript. For example, the element in the first row and third column is written as a₁,₃.
This Matrix Calculator helps you perform various matrix operations such as addition, subtraction, multiplication, exponentiation (power), transposition, and determinant calculation.
Matrix Addition
Matrix addition is only possible when the matrices involved are the same size — that is, they have the same number of rows and columns. For example, you can add two 3×3 or two 2×4 matrices, but you can’t add a 2×3 and a 3×2 matrix.
To add matrices, simply add their corresponding elements:
Example:
Let
A =
1 2
3 4
B =
5 6
7 8
Add each pair of corresponding elements:
c₁,₁ = 1 + 5 = 6
c₁,₂ = 2 + 6 = 8
c₂,₁ = 3 + 7 = 10
c₂,₂ = 4 + 8 = 12
Resulting Matrix (C):
10 12
Matrix Subtraction
Subtracting matrices follows the same rules as addition: both matrices must have the same dimensions. The operation is performed by subtracting corresponding elements.
Example:
Let
A =
1 2
3 4
B =
5 6
7 8
Subtract corresponding elements:
c₁,₁ = 1 – 5 = -4
c₁,₂ = 2 – 6 = -4
c₂,₁ = 3 – 7 = -4
c₂,₂ = 4 – 8 = -4
Resulting Matrix (C):
-4 -4
Matrix Multiplication
Scalar Multiplication
A matrix can be multiplied by a single number (scalar) by multiplying every element in the matrix by that number.
Example:
A =
1 2
3 4
Scalar = 5
Result =
5×1 5×2
5×3 5×4
=
5 10
15 20
Matrix-Matrix Multiplication
To multiply two matrices, the number of columns in the first must equal the number of rows in the second. For example, you can multiply a 2×3 matrix with a 3×4 matrix.
Example:
A =
1 2 1
3 4 1
B =
5 6 1 1
7 8 1 1
1 1 1 1
Since A is 2×3 and B is 3×4, the result will be a 2×4 matrix. Each element in the resulting matrix is the dot product of a row from A and a column from B:
c₁,₁ = (1×5) + (2×7) + (1×1) = 20
c₁,₂ = (1×6) + (2×8) + (1×1) = 23
c₁,₃ = (1×1) + (2×1) + (1×1) = 4
c₁,₄ = same as above = 4
c₂,₁ = (3×5) + (4×7) + (1×1) = 44
c₂,₂ = (3×6) + (4×8) + (1×1) = 51
c₂,₃ = (3×1) + (4×1) + (1×1) = 8
c₂,₄ = same as above = 8
Resulting Matrix (C):
44 51 8 8
Power of a Matrix
Raising a matrix to a power (e.g., A², A³, etc.) means multiplying it by itself repeatedly. This operation is only defined for square matrices (same number of rows and columns).
Example:
A =
1 3
2 1
A² = A × A =
1×1 + 3×2 1×3 + 3×1
2×1 + 1×2 2×3 + 1×1
=
7 6
4 7
Transpose of a Matrix
The transpose of a matrix is formed by flipping its rows and columns. This means the element at position (i, j) becomes (j, i).
Example:
A =
1 3
2 1
Transpose (Aᵀ) =
1 2
3 1
Determinant of a Matrix
The determinant is a special number that can be calculated from a square matrix. It is widely used in linear algebra to determine properties like matrix invertibility and to solve systems of equations.
2×2 Determinant
For a 2×2 matrix:
A =
a b
c d
The determinant is:
|A| = ad – bc
The determinant is:
|A| = ad – bc
Example:
A =
2 4
6 8
|A| = (2×8) – (4×6) = 16 – 24 = -8
3×3 Determinant (Laplace Expansion)
To compute the determinant of a 3×3 matrix:
A =
a b c
d e f
g h i
Use the following expansion:
|A| = a(ei – fh) – b(di – fg) + c(dh – eg)