Matrix Calculator

Add, subtract, or multiply two matrices with step-by-step computation.

Enter Matrices

Matrix A:
Matrix B:

Result

Operation
A + B
Matrix Size 2 x 2
Operation Addition

Step-by-Step Computation

C = A + B

Understanding Matrix Operations

Matrices are rectangular arrays of numbers organized in rows and columns. Matrix operations are fundamental to linear algebra and have wide-ranging applications in computer graphics, physics, statistics, machine learning, and engineering. This calculator supports three basic operations: addition, subtraction, and multiplication.

Matrix Operations Explained

Matrix Addition

Add corresponding elements of two matrices of the same dimensions. C[i][j] = A[i][j] + B[i][j].

C = A + B (element-wise)

Matrix Subtraction

Subtract corresponding elements. Matrices must have the same dimensions.

C = A - B (element-wise)

Matrix Multiplication

Each element C[i][j] is the dot product of row i of A and column j of B.

C[i][j] = sum(A[i][k] * B[k][j])

Identity Matrix

A square matrix with 1s on the diagonal and 0s elsewhere. Multiplying by I leaves a matrix unchanged.

A * I = I * A = A

Properties of Matrix Operations

Addition and Subtraction

  • Commutative: A + B = B + A
  • Associative: (A + B) + C = A + (B + C)
  • Both matrices must have the same dimensions (m x n).
  • The result has the same dimensions as the input matrices.

Multiplication

  • Not commutative: A * B does not generally equal B * A.
  • Associative: (A * B) * C = A * (B * C)
  • Distributive: A * (B + C) = A * B + A * C
  • To multiply A (m x n) by B (n x p), the number of columns in A must equal the number of rows in B.
  • The result is an m x p matrix.

Applications

Matrix operations are essential in computer graphics for transformations (rotation, scaling, translation), in physics for describing quantum states and coordinate transformations, in statistics for multivariate analysis, in machine learning for neural network computations, and in engineering for solving systems of linear equations and finite element analysis.