Matrix Multiplication

Master matrix multiplication: definition, algorithms, properties, and applications through these 5 detailed exercises.

Solution: Exercises 1 to 3
1 Basic matrix multiplication
Exercise 1
Find the product of matrices:
\(A = \begin{bmatrix} 2 & 3 \\ 1 & 4 \end{bmatrix}\) and \(B = \begin{bmatrix} 1 & 2 \\ 0 & 5 \end{bmatrix}\)
Definition:

Matrix multiplication: The product of two matrices where element (i,j) is the dot product of row i of the first matrix and column j of the second matrix

Matrix multiplication algorithm:
  1. Verify that the number of columns in the first matrix equals the number of rows in the second matrix
  2. For each element (i,j) in the result, compute the dot product of row i of the first matrix and column j of the second matrix
  3. Place the result in position (i,j) of the product matrix
Matrices A and B
\(\begin{bmatrix} 2 & 3 \\ 1 & 4 \end{bmatrix} \cdot \begin{bmatrix} 1 & 2 \\ 0 & 5 \end{bmatrix}\)
Element (1,1)
\([2, 3] \cdot [1, 0] = 2\)
Element (1,2)
\([2, 3] \cdot [2, 5] = 19\)
Step 1: Verify compatibility

Matrix A is 2×2 and Matrix B is 2×2. The number of columns in A (2) equals the number of rows in B (2), so multiplication is possible

Step 2: Calculate element (1,1)

Take row 1 of A: [2, 3] and column 1 of B: [1, 0]

Dot product: (2)(1) + (3)(0) = 2 + 0 = 2

Step 3: Calculate element (1,2)

Take row 1 of A: [2, 3] and column 2 of B: [2, 5]

Dot product: (2)(2) + (3)(5) = 4 + 15 = 19

Step 4: Calculate element (2,1)

Take row 2 of A: [1, 4] and column 1 of B: [1, 0]

Dot product: (1)(1) + (4)(0) = 1 + 0 = 1

Step 5: Calculate element (2,2)

Take row 2 of A: [1, 4] and column 2 of B: [2, 5]

Dot product: (1)(2) + (4)(5) = 2 + 20 = 22

\(AB = \begin{bmatrix} 2 & 19 \\ 1 & 22 \end{bmatrix}\)
Final answer:

The product of matrices A and B is \(\begin{bmatrix} 2 & 19 \\ 1 & 22 \end{bmatrix}\)

Applied rules:

• Compatibility requirement: Columns of first matrix must equal rows of second matrix

• Dot product calculation: Multiply corresponding elements and sum the products

• Dimension result: Product of (m×n) and (n×p) matrices is (m×p)

2 Different dimensions multiplication
Exercise 2
Find the product of matrices:
\(C = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}\) and \(D = \begin{bmatrix} 2 \\ 1 \\ 0 \end{bmatrix}\)
Definition:

Rectangular matrix multiplication: Multiplying matrices of different dimensions when compatibility condition is met

Matrices C and D
\(\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \cdot \begin{bmatrix} 2 \\ 1 \\ 0 \end{bmatrix}\)
Result Dimensions
\(2 \times 1\) matrix
Step 1: Verify compatibility

Matrix C is 2×3 and Matrix D is 3×1. The number of columns in C (3) equals the number of rows in D (3), so multiplication is possible

Step 2: Calculate element (1,1)

Take row 1 of C: [1, 2, 3] and column 1 of D: [2, 1, 0]

Dot product: (1)(2) + (2)(1) + (3)(0) = 2 + 2 + 0 = 4

Step 3: Calculate element (2,1)

Take row 2 of C: [4, 5, 6] and column 1 of D: [2, 1, 0]

Dot product: (4)(2) + (5)(1) + (6)(0) = 8 + 5 + 0 = 13

Step 4: Form the result matrix

The result is a 2×1 matrix: \(\begin{bmatrix} 4 \\ 13 \end{bmatrix}\)

\(CD = \begin{bmatrix} 4 \\ 13 \end{bmatrix}\)
Final answer:

The product of matrices C and D is \(\begin{bmatrix} 4 \\ 13 \end{bmatrix}\)

Applied rules:

• Dimension compatibility: Number of columns in first matrix must equal number of rows in second matrix

• Result dimensions: (m×n) × (n×p) = (m×p)

• Row-by-column multiplication: Each row of first matrix is dotted with each column of second matrix

3 Identity matrix multiplication
Exercise 3
Find the product of matrix:
\(E = \begin{bmatrix} 7 & 2 \\ 3 & 5 \end{bmatrix}\) and the identity matrix \(I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\)
Definition:

Identity matrix: A square matrix with ones on the diagonal and zeros elsewhere, which acts as the multiplicative identity for matrix multiplication

Matrix E and Identity I
\(\begin{bmatrix} 7 & 2 \\ 3 & 5 \end{bmatrix} \cdot \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\)
Result
\(\begin{bmatrix} 7 & 2 \\ 3 & 5 \end{bmatrix}\)
Step 1: Identify the identity matrix

The 2×2 identity matrix is \(I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\)

Step 2: Calculate element (1,1)

Take row 1 of E: [7, 2] and column 1 of I: [1, 0]

Dot product: (7)(1) + (2)(0) = 7 + 0 = 7

Step 3: Calculate element (1,2)

Take row 1 of E: [7, 2] and column 2 of I: [0, 1]

Dot product: (7)(0) + (2)(1) = 0 + 2 = 2

Step 4: Calculate element (2,1)

Take row 2 of E: [3, 5] and column 1 of I: [1, 0]

Dot product: (3)(1) + (5)(0) = 3 + 0 = 3

Step 5: Calculate element (2,2)

Take row 2 of E: [3, 5] and column 2 of I: [0, 1]

Dot product: (3)(0) + (5)(1) = 0 + 5 = 5

\(EI = \begin{bmatrix} 7 & 2 \\ 3 & 5 \end{bmatrix}\)
Final answer:

The product of matrix E and the identity matrix is \(\begin{bmatrix} 7 & 2 \\ 3 & 5 \end{bmatrix}\), which equals matrix E itself

Applied rules:

• Identity property: For any matrix A, AI = IA = A

• Identity matrix: Acts as the multiplicative identity in matrix multiplication

• Diagonal elements: Ones on the diagonal preserve the original matrix elements

Matrix Multiplication: Properties and Rules
\((AB)_{ij} = \sum_{k=1}^{n} a_{ik}b_{kj}, \quad A_{m \times n} \cdot B_{n \times p} = C_{m \times p}\)
Matrix Multiplication Formula
Element Formula
\( (AB)_{ij} = \sum a_{ik}b_{kj} \)
Element (i,j) of product
Dimension Rule
\( (m \times n)(n \times p) = (m \times p) \)
Result dimensions
Identity Property
\( AI = IA = A \)
Multiplication by identity
Key definitions:

Matrix multiplication: A binary operation that produces a matrix from two matrices where element (i,j) is the dot product of row i of the first matrix and column j of the second matrix

Dot product: The sum of the products of corresponding elements of two vectors

Identity matrix: A square matrix with ones on the main diagonal and zeros elsewhere

Compatible matrices: Matrices where the number of columns in the first matrix equals the number of rows in the second matrix

Matrix multiplication methodology:
  1. Check compatibility: Verify that columns of first matrix equal rows of second matrix
  2. Calculate dimensions: Result matrix will have dimensions (rows of first) × (columns of second)
  3. Compute each element: For element (i,j), take dot product of row i of first matrix and column j of second matrix
  4. Fill result matrix: Place computed values in corresponding positions
  5. Verify dimensions: Ensure the result has the expected dimensions
Tip 1: Always verify that matrices are compatible before attempting multiplication.
Tip 2: Matrix multiplication is NOT commutative: AB ≠ BA in general.
Tip 3: The identity matrix acts as a multiplicative identity: AI = IA = A.
Solution: Exercises 4 to 5
4 Non-commutative multiplication
Exercise 4
Find both products \(FG\) and \(GF\) where:
\(F = \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix}\) and \(G = \begin{bmatrix} 3 & 1 \\ 2 & 4 \end{bmatrix}\)
Definition:

Non-commutative operation: An operation where changing the order of operands changes the result

Product FG
\(\begin{bmatrix} 7 & 9 \\ 2 & 4 \end{bmatrix}\)
Product GF
\(\begin{bmatrix} 3 & 7 \\ 2 & 8 \end{bmatrix}\)
Step 1: Calculate FG

Element (1,1): [1, 2] · [3, 2] = (1)(3) + (2)(2) = 3 + 4 = 7

Element (1,2): [1, 2] · [1, 4] = (1)(1) + (2)(4) = 1 + 8 = 9

Element (2,1): [0, 1] · [3, 2] = (0)(3) + (1)(2) = 0 + 2 = 2

Element (2,2): [0, 1] · [1, 4] = (0)(1) + (1)(4) = 0 + 4 = 4

So \(FG = \begin{bmatrix} 7 & 9 \\ 2 & 4 \end{bmatrix}\)

Step 2: Calculate GF

Element (1,1): [3, 1] · [1, 0] = (3)(1) + (1)(0) = 3 + 0 = 3

Element (1,2): [3, 1] · [2, 1] = (3)(2) + (1)(1) = 6 + 1 = 7

Element (2,1): [2, 4] · [1, 0] = (2)(1) + (4)(0) = 2 + 0 = 2

Element (2,2): [2, 4] · [2, 1] = (2)(2) + (4)(1) = 4 + 4 = 8

So \(GF = \begin{bmatrix} 3 & 7 \\ 2 & 8 \end{bmatrix}\)

Step 3: Compare results

\(FG = \begin{bmatrix} 7 & 9 \\ 2 & 4 \end{bmatrix} \neq \begin{bmatrix} 3 & 7 \\ 2 & 8 \end{bmatrix} = GF\)

\(FG = \begin{bmatrix} 7 & 9 \\ 2 & 4 \end{bmatrix}\), \(GF = \begin{bmatrix} 3 & 7 \\ 2 & 8 \end{bmatrix}\)
Final answer:

Matrix multiplication is not commutative: \(FG \neq GF\)

Applied rules:

• Non-commutativity: Matrix multiplication does not commute in general

• Order matters: The order of matrices in multiplication affects the result

• Verification: Always check that the result makes sense given the operation

5 Matrix equation with multiplication
Exercise 5
Solve for matrix X in the equation: \(AX = B\) where:
\(A = \begin{bmatrix} 2 & 1 \\ 3 & 2 \end{bmatrix}\) and \(B = \begin{bmatrix} 5 \\ 8 \end{bmatrix}\)
Definition:

Matrix equation: An equation where the unknown is a matrix, often solved using matrix multiplication and inverses

Original Equation
\(AX = B\)
Solution
\(X = \begin{bmatrix} 2 \\ 1 \end{bmatrix}\)
Step 1: Set up the equation

We have: \(\begin{bmatrix} 2 & 1 \\ 3 & 2 \end{bmatrix} \cdot X = \begin{bmatrix} 5 \\ 8 \end{bmatrix}\)

Since the result is 2×1, X must be 2×1: \(X = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}\)

Step 2: Perform the multiplication

\(\begin{bmatrix} 2 & 1 \\ 3 & 2 \end{bmatrix} \cdot \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 2x_1 + x_2 \\ 3x_1 + 2x_2 \end{bmatrix}\)

Step 3: Set up the system of equations

\(2x_1 + x_2 = 5\) (Equation 1)

\(3x_1 + 2x_2 = 8\) (Equation 2)

Step 4: Solve the system

From Equation 1: \(x_2 = 5 - 2x_1\)

Substitute into Equation 2: \(3x_1 + 2(5 - 2x_1) = 8\)

\(3x_1 + 10 - 4x_1 = 8\)

\(-x_1 = -2\)

\(x_1 = 2\)

Then: \(x_2 = 5 - 2(2) = 1\)

Step 5: Verify the solution

\(\begin{bmatrix} 2 & 1 \\ 3 & 2 \end{bmatrix} \cdot \begin{bmatrix} 2 \\ 1 \end{bmatrix} = \begin{bmatrix} 2(2) + 1(1) \\ 3(2) + 2(1) \end{bmatrix} = \begin{bmatrix} 5 \\ 8 \end{bmatrix}\) ✓

\(X = \begin{bmatrix} 2 \\ 1 \end{bmatrix}\)
Final answer:

The solution to the matrix equation is \(X = \begin{bmatrix} 2 \\ 1 \end{bmatrix}\)

Applied rules:

• Matrix equation solving: Convert to system of linear equations

• Dimension matching: Ensure matrices have compatible dimensions

• Verification: Always check the solution by substitution

Comprehensive Guide: Matrix Multiplication
\((AB)_{ij} = \sum_{k=1}^{n} a_{ik}b_{kj}, \quad A_{m \times n} \cdot B_{n \times p} = C_{m \times p}\)
Matrix Multiplication Definition
Key definitions:

Matrix multiplication: The process of computing the product of two matrices where each element is the dot product of a row from the first matrix and a column from the second matrix

Dot product: The sum of the products of corresponding elements of two vectors: \(\vec{a} \cdot \vec{b} = \sum a_i b_i\)

Compatibility: Two matrices can be multiplied if and only if the number of columns in the first matrix equals the number of rows in the second matrix

Identity matrix: A square matrix with ones on the diagonal and zeros elsewhere, denoted as I

Matrix multiplication methodology:
  1. Check compatibility: Verify that the number of columns in the first matrix equals the number of rows in the second matrix
  2. Determine result dimensions: The product will have dimensions (rows of first) × (columns of second)
  3. Calculate each element: For element (i,j) of the product, compute the dot product of row i of the first matrix and column j of the second matrix
  4. Organize calculations: Use systematic approach to avoid errors
  5. Verify result: Check dimensions and sample calculations
Tip 1: Always verify matrix compatibility before starting multiplication.
Tip 2: Matrix multiplication is not commutative: AB ≠ BA in general.
Tip 3: The identity matrix I acts as a multiplicative identity: AI = IA = A.
Tip 4: The zero matrix acts as a multiplicative zero: A·0 = 0·A = 0.
Common errors: Forgetting to check compatibility, miscalculating dot products, confusing row/column operations, assuming commutativity.
Exam preparation: Practice with different matrix sizes, memorize dimension rules, understand properties of special matrices.
Important properties and rules:

• Associativity: (AB)C = A(BC)

• Distributivity: A(B + C) = AB + AC

• Non-commutativity: AB ≠ BA in general

• Identity property: AI = IA = A

Visualization: Matrix Multiplication Process
Understanding How Matrix Multiplication Works
Visualizing the matrix multiplication process:
1. Row-column dot products
2. Dimension compatibility
3. Result matrix formation
4. Non-commutative property

Analysis: The visualization shows how matrix multiplication transforms input matrices into output matrices.

  • Each element is a dot product of row and column
  • Dimensions must be compatible for multiplication
  • Order of matrices affects the result
  • Identity matrix preserves original matrix

Questions & Answers

Question: Why can't I multiply any two matrices together?

Answer: Matrix multiplication is only defined when the number of columns in the first matrix equals the number of rows in the second matrix. This is because we need to compute dot products between rows of the first matrix and columns of the second matrix.

For example, you can multiply a 2×3 matrix by a 3×4 matrix (since 3 = 3), but you cannot multiply a 2×3 matrix by a 4×2 matrix (since 3 ≠ 4).

This restriction ensures that the dot product operation is mathematically valid.

Question: How do I calculate the dot product of a row and column?

Answer: To calculate the dot product of a row and column, you multiply corresponding elements and sum the results.

For example, the dot product of row [2, 3] and column [4, 1] is:

(2)(4) + (3)(1) = 8 + 3 = 11

Make sure the row and column have the same number of elements for the dot product to be valid.

Question: Why isn't matrix multiplication commutative like regular multiplication?

Answer: Matrix multiplication is not commutative because the process involves taking dot products of rows from the first matrix with columns from the second matrix. When you switch the order, you're taking dot products of rows from the second matrix with columns from the first matrix, which generally gives different results.

Additionally, even if both products AB and BA are defined, they might have different dimensions. For example, if A is 2×3 and B is 3×2, then AB is 2×2 but BA is 3×3.

The only exception is when multiplying by the identity matrix: AI = IA = A.