Skip to main content

Calcu.fit

Matrix Calculator: Add, Multiply, Determinant, Inverse & More

Use this free matrix calculator to work with matrices. Enter one or two matrices, choose an operation, and see the result with step-by-step working. You can add, subtract, and multiply matrices, find the transpose, determinant, inverse, rank, trace, and eigenvalues, and solve a system of linear equations. No signup needed.

Matrix Calculator

Separate columns with spaces or commas; rows with new lines or semicolons. Fractions like 1/2 are accepted.

Result

Matrix Properties

Step-by-Step Solution

How to Use This Matrix Calculator

  1. Choose the size of your matrix (rows × columns), and enter the numbers. You can use decimals, negative numbers, and fractions.
  2. For operations that need two matrices (add, subtract, multiply), enter the second matrix too.
  3. Choose the operation.
  4. Click Calculate.

To solve a system of equations, choose “Solve Ax = b,” enter the coefficient matrix A and the constants b.

What You’ll See in Your Results

  • The result matrix, or a single number for operations such as determinant and trace
  • Step-by-step working
  • Whether a matrix is invertible (not singular)
  • Eigenvalues and eigenvectors for square matrices
  • The solution of a linear system, or a message if there is no solution or many solutions

What Is a Matrix?

A matrix is a rectangular grid of numbers arranged in rows and columns. An m × n matrix has m rows and n columns. Matrices are used to organize data and to describe linear transformations, systems of equations, graphics, networks, and more.

Example of a 2 × 2 matrix:

A = [ 1 2 ; 3 4 ]

(rows are separated by semicolons here)

Matrix Operations and Rules

OperationRuleSize requirement
Addition and subtractionAdd or subtract matching entriesSame size
Scalar multiplicationMultiply every entry by the numberAny size
Matrix multiplicationEntry (i, j) = row i of A times column j of BA is m × n and B is n × p. The result is m × p
Transpose (Aᵀ)Swap rows and columnsAny size
DeterminantA single number for a square matrixSquare (n × n)
Inverse (A⁻¹)A⁻¹ × A = I, the identity matrixSquare, with determinant not 0
TraceSum of the diagonal entriesSquare
RankNumber of independent rows (or columns)Any size

Important Formulas

Determinant of a 2 × 2 matrix [a b; c d]: det = a × d − b × c

Inverse of a 2 × 2 matrix: A⁻¹ = (1 ÷ det) × [d −b; −c a]

Determinant of a 3 × 3 matrix (expanding along the first row):
det = a(ei − fh) − b(di − fg) + c(dh − eg), for the matrix [a b c; d e f; g h i]

Properties:

  • A × B is not always equal to B × A. Matrix multiplication is not commutative.
  • det(A × B) = det(A) × det(B)
  • (A × B)ᵀ = Bᵀ × Aᵀ
  • (A × B)⁻¹ = B⁻¹ × A⁻¹
  • A matrix has an inverse only if its determinant is not 0.

Eigenvalues: the values λ that satisfy det(A − λI) = 0. For each eigenvalue, the eigenvectors v satisfy A × v = λ × v.

Solving a system: for Ax = b, if A is invertible, x = A⁻¹ × b.

Matrix Examples

For the first examples, use these two matrices:

A = [ 1 2 ; 3 4 ] and B = [ 5 6 ; 7 8 ]

Example 1: Addition and Subtraction

  • A + B = [ 1+5 2+6 ; 3+7 4+8 ] = [ 6 8 ; 10 12 ]
  • A − B = [ 1−5 2−6 ; 3−7 4−8 ] = [ −4 −4 ; −4 −4 ]

Example 2: Scalar Multiplication

  • 3 × A = [ 3 6 ; 9 12 ]

Example 3: Matrix Multiplication

  • Entry (1, 1): 1×5 + 2×7 = 19
  • Entry (1, 2): 1×6 + 2×8 = 22
  • Entry (2, 1): 3×5 + 4×7 = 43
  • Entry (2, 2): 3×6 + 4×8 = 50
  • A × B = [ 19 22 ; 43 50 ]

Example 4: Multiplication Is Not Commutative

  • B × A = [ 23 34 ; 31 46 ]

This is different from A × B = [ 19 22 ; 43 50 ]. The order matters.

Example 5: Multiplying Matrices of Different Sizes

M is 2 × 3 and N is 3 × 2, so M × N is 2 × 2.

M = [ 1 2 3 ; 4 5 6 ] and N = [ 7 8 ; 9 10 ; 11 12 ]

  • M × N = [ 58 64 ; 139 154 ]
  • For example, entry (1, 1): 1×7 + 2×9 + 3×11 = 58

N × M would be 3 × 3, a different size.

Example 6: Transpose

  • Aᵀ = [ 1 3 ; 2 4 ]

Example 7: Determinant and Trace

  • det(A) = 1×4 − 2×3 = −2
  • Trace of A = 1 + 4 = 5
  • det(B) = 5×8 − 6×7 = −2
  • det(A × B) = 19×50 − 22×43 = 950 − 946 = 4, which equals det(A) × det(B) = (−2) × (−2) = 4

Example 8: Inverse of a 2 × 2 Matrix

  • det(A) = −2, which is not 0, so A is invertible.
  • A⁻¹ = (1 ÷ −2) × [ 4 −2 ; −3 1 ] = [ −2 1 ; 1.5 −0.5 ]
  • Check: A × A⁻¹ gives the identity matrix [ 1 0 ; 0 1 ].

Example 9: Determinant of a 3 × 3 Matrix

D = [ 2 1 3 ; 0 1 4 ; 5 6 0 ]

  • det(D) = 2(1×0 − 4×6) − 1(0×0 − 4×5) + 3(0×6 − 1×5)
  • = 2(−24) − 1(−20) + 3(−5) = −48 + 20 − 15 = −43
  • Since det(D) is not 0, D has an inverse:
    D⁻¹ = (1 ÷ 43) × [ 24 −18 −1 ; −20 15 8 ; 5 7 −2 ]

Example 10: A Singular Matrix (No Inverse)

C = [ 2 0 1 ; 1 3 2 ; 1 1 1 ]

  • det(C) = 2(3×1 − 2×1) − 0 + 1(1×1 − 3×1) = 2(1) + 1(−2) = 0
  • The determinant is 0, so C has no inverse. Its rank is 2, less than 3.

Example 11: Rank

  • The matrix [ 1 2 ; 2 4 ] has a second row that is twice the first, so only one row is independent.
  • Rank = 1, and its determinant is 0.

Example 12: Solving a 2 × 2 System

Solve 2x + y = 5 and x − y = 1.

  • A = [ 2 1 ; 1 −1 ], b = [ 5 ; 1 ]
  • det(A) = 2×(−1) − 1×1 = −3
  • x = A⁻¹ × b = x = 2, y = 1
  • Check: 2×2 + 1 = 5 and 2 − 1 = 1.

Example 13: Solving a 3 × 3 System

Solve:

  • x + y + z = 6
  • 2y + 5z = −4
  • 2x + 5y − z = 27

The coefficient matrix has a determinant of −21, which is not 0, so there is exactly one solution:

  • x = 5, y = 3, z = −2

Example 14: Eigenvalues of a 2 × 2 Matrix

E = [ 2 1 ; 1 2 ]

  • Solve det(E − λI) = (2 − λ)² − 1 = 0, so λ² − 4λ + 3 = 0.
  • Eigenvalues: λ = 3 and λ = 1
  • Eigenvector for λ = 3: (1, 1)
  • Eigenvector for λ = 1: (1, −1)

Example 15: Powers and Element-by-Element Products

  • A² = A × A = [ 7 10 ; 15 22 ]
  • Element-by-element (Hadamard) product A ∘ B = [ 5 12 ; 21 32 ]. This is different from the matrix product.

The Identity and Zero Matrices

  • The identity matrix I has 1s on the diagonal and 0s elsewhere. For any matrix, A × I = I × A = A.
  • The zero matrix has all entries 0. A + 0 = A.
  • A matrix that is equal to its transpose is symmetric.

How Many Solutions Does a System Have?

For a system Ax = b with a square matrix A:

  • If det(A) ≠ 0, there is exactly one solution.
  • If det(A) = 0, there is either no solution or infinitely many solutions, depending on b.

Where Are Matrices Used?

  • Solving systems of equations in science, engineering, and economics
  • Computer graphics and games: rotating, scaling, and moving objects
  • Data science and machine learning: data tables, neural networks, and principal components
  • Networks and graphs: describing connections
  • Physics and engineering: transformations, vibrations, and circuits
  • Statistics: regression and covariance

Tips for Working with Matrices

  • Check the sizes before you add or multiply. Addition needs the same size, and multiplication needs the number of columns of A to equal the number of rows of B.
  • Remember that the order of multiplication matters.
  • A matrix can only have an inverse if it is square and its determinant is not 0.
  • To check an inverse, multiply it by the original matrix. You should get the identity matrix.
  • For a 3 × 3 determinant, expand along a row or column with many zeros to save work.
  • With decimals, tiny rounding errors can appear, such as 0.9999999 instead of 1. The calculator rounds the display.
  • Use fractions, when you can, for exact answers.

Matrix Calculator vs. Other Tools

  • Determinant Calculator: the determinant of a square matrix.
  • Inverse Matrix Calculator: the inverse of a square matrix.
  • Linear Equation Solver: systems of equations.
  • Eigenvalue Calculator: eigenvalues and eigenvectors.
  • Statistics Calculator: mean, median, standard deviation, and more.
  • Scientific Calculator: general math and functions.

Frequently Asked Questions (FAQ)

How do I multiply two matrices?

 Multiply each row of the first matrix by each column of the second, adding the products. Each entry (i, j) of the result is the sum of row i of A times column j of B. The number of columns in A must equal the number of rows in B.

No. A × B is usually not equal to B × A. For the matrices above, A × B = [ 19 22 ; 43 50 ] and B × A = [ 23 34 ; 31 46 ].

For a 2 × 2 matrix [a b ; c d], det = ad − bc. For larger matrices, expand along a row or column using cofactors.

 For a 2 × 2 matrix, swap a and d, change the signs of b and c, and divide by the determinant. For larger matrices, use row reduction or the adjugate method.

When it is not square, or when its determinant is 0. Such a matrix is called singular.

The matrix you get by swapping its rows and columns. The entry in row i, column j becomes the entry in row j, column i.

The number of linearly independent rows (or columns). A square n × n matrix has an inverse only if its rank is n.

 The sum of the entries on its main diagonal. The trace of [ 1 2 ; 3 4 ] is 5.

An eigenvector of a matrix A is a vector v that only gets scaled when A acts on it: A × v = λ × v. The scale factor λ is the eigenvalue.

 Write it as Ax = b, where A holds the coefficients. If A is invertible, x = A⁻¹ × b. You can also use row reduction.

 Addition works entry by entry, so each entry needs a partner in the same position in the other matrix.

 Yes. It is free, with no registration and no limits.

It uses standard methods, and results with decimals are rounded for display. Very large or ill-conditioned matrices can have small numerical errors.

Disclaimer

This calculator is for general informational and educational purposes only. Results are calculated from the numbers you enter and may include small rounding differences. For engineering, scientific, financial, or other critical work, verify results with an independent method or a qualified professional.