C

Matrix Multiplication Calculator

Calculate matrix multiplication with step-by-step solutions. Supports 2x2, 3x3 matrices and more with detailed examples and mathematical explanations. Perfect for students, engineers, and anyone working with linear algebra, computer graphics, or data science applications.

Matrix Multiplication Calculator

Enter your matrices below. The number of columns in the first matrix must equal the number of rows in the second matrix.

Matrix Tools

Matrix A

12
1
2

💡 Tip: Paste CSV/TSV data directly into the matrix area

Matrix B

12
1
2

💡 Tip: Paste CSV/TSV data directly into the matrix area

Result

Result Matrix (A × B)

12
1
19
22
2
43
50

Calculation Steps

Multiplying 2×2 matrix A with 2×2 matrix B to get 2×2 result matrix.
C[0][0] = A[0][0] × B[0][0] = 1 × 5 = 5 + A[0][1] × B[1][0] = 2 × 7 = 14 = 19
C[0][1] = A[0][0] × B[0][1] = 1 × 6 = 6 + A[0][1] × B[1][1] = 2 × 8 = 16 = 22
C[1][0] = A[1][0] × B[0][0] = 3 × 5 = 15 + A[1][1] × B[1][0] = 4 × 7 = 28 = 43
C[1][1] = A[1][0] × B[0][1] = 3 × 6 = 18 + A[1][1] × B[1][1] = 4 × 8 = 32 = 50

Matrix Multiplication Rules

Dimension Requirements

For matrices A (m×n) and B (p×q), multiplication is only possible when n = p

  • • Result matrix will be m×q
  • • Each element is sum of products
  • • Order matters: A×B ≠ B×A
Common Sizes
  • • 2×2 × 2×2 → 2×2 result
  • • 3×3 × 3×3 → 3×3 result
  • • 2×3 × 3×4 → 2×4 result
  • • 1×n × n×1 → 1×1 result (dot product)

How to Calculate Matrix Multiplication

General Formula

For matrices A (m×n) and B (n×p):
C[i][j] = Σ(k=0 to n-1) A[i][k] × B[k][j]
where i = 0,1,...,m-1 and j = 0,1,...,p-1

Step-by-Step Process:

  1. 1
    Check dimensions
    Ensure columns of A = rows of B
  2. 2
    Calculate each element
    For each position (i,j), sum products of corresponding elements
  3. 3
    Verify result
    Result matrix has rows of A and columns of B

Important Considerations

⚠️ Order Matters

Matrix multiplication is not commutative: A×B ≠ B×A in general

🔢 Dimension Validation

Always check matrix dimensions before multiplication

  • • Columns of A = Rows of B
  • • Result size: rows of A × columns of B
  • • Invalid dimensions cause errors
⚡ Computational Complexity

Time complexity: O(m×n×p) for m×n × n×p matrices

  • • Large matrices are computationally expensive
  • • Consider matrix size limits
  • • Use optimized algorithms for large data
🎯 Zero Matrices

Multiplying by zero matrix gives zero result

  • • A × 0 = 0 (zero matrix)
  • • Identity matrix: A × I = A
  • • Special cases to remember
⚠️ Common Errors

Watch out for these common mistakes

  • • Wrong dimension assumptions
  • • Confusing with element-wise multiplication
  • • Incorrect order of operations

Example Cases

Case 1: 2×2 Matrix Multiplication

Matrix A:
[1, 2]
[3, 4]

Matrix B:
[5, 6]
[7, 8]
Result A×B:
[19, 22]
[43, 50]

Calculation:
1×5+2×7=19, 1×6+2×8=22
3×5+4×7=43, 3×6+4×8=50

Use Case: Common in computer graphics transformations and linear algebra problems.

Case 2: 2×3 × 3×2 Matrix Multiplication

Matrix A (2×3):
[1, 2, 3]
[4, 5, 6]

Matrix B (3×2):
[7, 8]
[9, 10]
[11, 12]
Result A×B (2×2):
[58, 64]
[139, 154]

Key:
Columns of A = Rows of B = 3

Use Case: Perfect for demonstrating dimension compatibility and real-world applications.

Tips for Success

✅ Start Small

Begin with 2×2 matrices to understand the process before moving to larger matrices.

📐 Visualize the Process

Think of it as "row times column" - each element in the result is the dot product of a row and column.

🔍 Check Your Work

Verify dimensions and recalculate a few elements manually to ensure accuracy.

Frequently Asked Questions

What is matrix multiplication?
Matrix multiplication is a binary operation that produces a matrix from two matrices. For matrices A (m×n) and B (n×p), the product AB is an m×p matrix where each element is the sum of products of corresponding elements from rows of A and columns of B.
What are the rules for matrix multiplication?
Matrix multiplication requires the number of columns in the first matrix to equal the number of rows in the second matrix. The result has the same number of rows as the first matrix and the same number of columns as the second matrix.
What is the difference between matrix multiplication and Hadamard (element-wise) multiplication?
Matrix multiplication (AB) produces a new matrix where each element is the dot product of a row from A and a column from B. Hadamard multiplication (A⊙B) multiplies corresponding elements directly: (A⊙B)[i,j] = A[i,j] × B[i,j]. Matrix multiplication requires compatible dimensions, while Hadamard requires identical dimensions.
Does matrix multiplication follow associative, distributive, and commutative laws?
Matrix multiplication is associative: (AB)C = A(BC) and distributive: A(B+C) = AB+AC. However, it is NOT commutative: AB ≠ BA in general. The order of multiplication matters significantly, and AB may not even be defined when BA is defined.
What are practical applications of matrix multiplication in deep learning and computer graphics?
In deep learning, matrix multiplication powers neural network layers where weights multiply input vectors. In computer graphics, it transforms 3D coordinates through rotation, scaling, and translation matrices. For example, a 4×4 transformation matrix can rotate a 3D point, and weight matrices in neural networks process feature vectors through hidden layers.