Solved Exercises on Matrix Multiplication

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

Matrix Multiplication - Comprehensive Summary

Definitions

Matrix Multiplication: For matrices A (m×n) and B (n×p), the product AB is an (m×p) matrix where \((AB)_{ij} = \sum_{k=1}^{n} A_{ik}B_{kj}\).

Compatibility: Matrix multiplication AB is defined only when the number of columns of A equals the number of rows of B.

Dot Product Interpretation: Entry (i,j) of AB is the dot product of row i of A with column j of B.

Core Rules

• Not commutative: AB ≠ BA in general

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

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

• Identity: AI = IA = A (when dimensions match)

Methods

1. Row-by-column: Compute dot product of each row of A with each column of B

2. Column interpretation: Each column of AB is A times the corresponding column of B

3. Row interpretation: Each row of AB is the corresponding row of A times B

4. Linear combination: Each column of AB is linear combination of columns of A

Key Tips

• Always check dimensions before multiplying

• Use the "inner-outer" rule: (m×n)(n×p) → (m×p)

• Practice with small matrices to build intuition

• Remember that AB may exist while BA does not

Solution: Exercises 1 to 3
1 Basic 2×2 Matrix Multiplication
Exercise 1
Compute the product of \(A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\) and \(B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix}\).
Definition:

Matrix Multiplication: For matrices A (m×n) and B (n×p), the entry in row i and column j of the product AB is the dot product of row i of A with column j of B: \((AB)_{ij} = \sum_{k=1}^{n} A_{ik}B_{kj}\).

Matrix Multiplication Method:
  1. Verify compatibility: number of columns of A equals number of rows of B
  2. Compute each entry of the result matrix using dot products
  3. For entry (i,j): multiply row i of A by column j of B
  4. Arrange results in the correct positions
Matrix Dimensions
(2×2)(2×2) → (2×2)
Entry (1,1)
(1,5) + (2,7) = 19
Complete Product
\(\begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix}\)
Step 1: Verify compatibility

Matrix A is 2×2 and matrix B is 2×2. The number of columns of A (2) equals the number of rows of B (2), so multiplication is possible. The result will be a 2×2 matrix.

Step 2: Compute entry (1,1)

\((AB)_{11} = \text{row 1 of A} \cdot \text{column 1 of B} = (1,2) \cdot (5,7) = (1)(5) + (2)(7) = 5 + 14 = 19\)

Step 3: Compute entry (1,2)

\((AB)_{12} = \text{row 1 of A} \cdot \text{column 2 of B} = (1,2) \cdot (6,8) = (1)(6) + (2)(8) = 6 + 16 = 22\)

Step 4: Compute entry (2,1)

\((AB)_{21} = \text{row 2 of A} \cdot \text{column 1 of B} = (3,4) \cdot (5,7) = (3)(5) + (4)(7) = 15 + 28 = 43\)

Step 5: Compute entry (2,2)

\((AB)_{22} = \text{row 2 of A} \cdot \text{column 2 of B} = (3,4) \cdot (6,8) = (3)(6) + (4)(8) = 18 + 32 = 50\)

Step 6: Assemble the result

\(AB = \begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix}\)

\(AB = \begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix}\)
Final answer:

The product of A and B is \(\begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix}\).

Applied rules:

• Dimension compatibility: Check that inner dimensions match

• Dot product calculation: Multiply corresponding elements and sum

• Position correspondence: Row i of A with column j of B gives entry (i,j)

2 Non-Square Matrices
Exercise 2
Let \(C = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}\) and \(D = \begin{pmatrix} 7 & 8 \\ 9 & 10 \\ 11 & 12 \end{pmatrix}\). Find CD and DC if possible.
Definition:

Rectangular Matrix Multiplication: For C (m×n) and D (n×p), CD exists and results in an (m×p) matrix. The product DC exists only if p = m.

CD Dimensions
(2×3)(3×2) → (2×2)
DC Dimensions
(3×2)(2×3) → (3×3)
Results
Both exist, different sizes
Step 1: Compute CD

C is 2×3 and D is 3×2, so CD is 2×2.

\((CD)_{11} = (1,2,3) \cdot (7,9,11) = 1(7) + 2(9) + 3(11) = 7 + 18 + 33 = 58\)

\((CD)_{12} = (1,2,3) \cdot (8,10,12) = 1(8) + 2(10) + 3(12) = 8 + 20 + 36 = 64\)

\((CD)_{21} = (4,5,6) \cdot (7,9,11) = 4(7) + 5(9) + 6(11) = 28 + 45 + 66 = 139\)

\((CD)_{22} = (4,5,6) \cdot (8,10,12) = 4(8) + 5(10) + 6(12) = 32 + 50 + 72 = 154\)

So: \(CD = \begin{pmatrix} 58 & 64 \\ 139 & 154 \end{pmatrix}\)

Step 2: Compute DC

D is 3×2 and C is 2×3, so DC is 3×3.

\((DC)_{11} = (7,8) \cdot (1,4) = 7(1) + 8(4) = 7 + 32 = 39\)

\((DC)_{12} = (7,8) \cdot (2,5) = 7(2) + 8(5) = 14 + 40 = 54\)

\((DC)_{13} = (7,8) \cdot (3,6) = 7(3) + 8(6) = 21 + 48 = 69\)

\((DC)_{21} = (9,10) \cdot (1,4) = 9(1) + 10(4) = 9 + 40 = 49\)

\((DC)_{22} = (9,10) \cdot (2,5) = 9(2) + 10(5) = 18 + 50 = 68\)

\((DC)_{23} = (9,10) \cdot (3,6) = 9(3) + 10(6) = 27 + 60 = 87\)

\((DC)_{31} = (11,12) \cdot (1,4) = 11(1) + 12(4) = 11 + 48 = 59\)

\((DC)_{32} = (11,12) \cdot (2,5) = 11(2) + 12(5) = 22 + 60 = 82\)

\((DC)_{33} = (11,12) \cdot (3,6) = 11(3) + 12(6) = 33 + 72 = 105\)

So: \(DC = \begin{pmatrix} 39 & 54 & 69 \\ 49 & 68 & 87 \\ 59 & 82 & 105 \end{pmatrix}\)

Step 3: Compare results

CD is 2×2 while DC is 3×3, so they are different matrices entirely.

This demonstrates that matrix multiplication is not commutative.

\(CD = \begin{pmatrix} 58 & 64 \\ 139 & 154 \end{pmatrix}\), \(DC = \begin{pmatrix} 39 & 54 & 69 \\ 49 & 68 & 87 \\ 59 & 82 & 105 \end{pmatrix}\)
Final answer:

\(CD = \begin{pmatrix} 58 & 64 \\ 139 & 154 \end{pmatrix}\) and \(DC = \begin{pmatrix} 39 & 54 & 69 \\ 49 & 68 & 87 \\ 59 & 82 & 105 \end{pmatrix}\). Both products exist but are different matrices.

Applied rules:

• Non-commutativity: AB ≠ BA in general, even when both exist

• Dimension preservation: Result dimensions depend on outer dimensions

• Compatibility check: Inner dimensions must match for multiplication to exist

3 Matrix-Vector Product
Exercise 3
Compute \(M\vec{x}\) where \(M = \begin{pmatrix} 2 & 1 & 0 \\ -1 & 3 & 1 \\ 0 & 2 & -1 \end{pmatrix}\) and \(\vec{x} = \begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix}\).
Definition:

Matrix-Vector Product: A special case of matrix multiplication where the second matrix is a column vector. The result is a column vector where each entry is the dot product of the corresponding row of M with the vector x.

Matrix Dimensions
(3×3)(3×1) → (3×1)
Row 1
(2,1,0) · (1,2,3) = 4
Result
\(\begin{pmatrix} 4 \\ 5 \\ 1 \end{pmatrix}\)
Step 1: Verify compatibility

Matrix M is 3×3 and vector x is 3×1, so the product Mx is 3×1 (a 3-dimensional vector).

Step 2: Compute entry 1

\((M\vec{x})_1 = \text{row 1 of M} \cdot \vec{x} = (2,1,0) \cdot (1,2,3) = 2(1) + 1(2) + 0(3) = 2 + 2 + 0 = 4\)

Step 3: Compute entry 2

\((M\vec{x})_2 = \text{row 2 of M} \cdot \vec{x} = (-1,3,1) \cdot (1,2,3) = (-1)(1) + 3(2) + 1(3) = -1 + 6 + 3 = 8\)

Step 4: Compute entry 3

\((M\vec{x})_3 = \text{row 3 of M} \cdot \vec{x} = (0,2,-1) \cdot (1,2,3) = 0(1) + 2(2) + (-1)(3) = 0 + 4 - 3 = 1\)

Step 5: Assemble the result

\(M\vec{x} = \begin{pmatrix} 4 \\ 8 \\ 1 \end{pmatrix}\)

Step 6: Alternative interpretation

We can also view this as a linear combination of the columns of M:

\(M\vec{x} = 1\begin{pmatrix} 2 \\ -1 \\ 0 \end{pmatrix} + 2\begin{pmatrix} 1 \\ 3 \\ 2 \end{pmatrix} + 3\begin{pmatrix} 0 \\ 1 \\ -1 \end{pmatrix} = \begin{pmatrix} 2 \\ -1 \\ 0 \end{pmatrix} + \begin{pmatrix} 2 \\ 6 \\ 4 \end{pmatrix} + \begin{pmatrix} 0 \\ 3 \\ -3 \end{pmatrix} = \begin{pmatrix} 4 \\ 8 \\ 1 \end{pmatrix}\)

\(M\vec{x} = \begin{pmatrix} 4 \\ 8 \\ 1 \end{pmatrix}\)
Final answer:

The product \(M\vec{x} = \begin{pmatrix} 4 \\ 8 \\ 1 \end{pmatrix}\).

Applied rules:

• Row-vector dot product: Each row of M dotted with vector x

• Linear combination: Result is weighted sum of matrix columns

• Dimension consistency: Result has same rows as M

Matrix Multiplication Properties
\((AB)_{ij} = \sum_{k=1}^{n} A_{ik}B_{kj}\)
Matrix Multiplication Formula
Associativity
\((AB)C = A(BC)\)
Matrix multiplication is associative
Distributivity
\(A(B+C) = AB + AC\)
Matrix multiplication distributes over addition
Non-Commutativity
\(AB \neq BA\) (in general)
Matrix multiplication is not commutative
Compatibility Rule: For AB to exist, the number of columns of A must equal the number of rows of B.
Dimension Rule: If A is (m×n) and B is (n×p), then AB is (m×p).
Identity Property: For any matrix A, AI = IA = A where I is the appropriate identity matrix.
Solution: Exercises 4 to 5
4 Linear Transformation Matrix
Exercise 4
Let \(T: \mathbb{R}^2 \to \mathbb{R}^2\) be defined by \(T\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 2x + 3y \\ x - y \end{pmatrix}\). Find the standard matrix A such that \(T(\vec{x}) = A\vec{x}\).
Definition:

Standard Matrix: For a linear transformation \(T: \mathbb{R}^n \to \mathbb{R}^m\), the standard matrix A is formed by applying T to the standard basis vectors: \(A = [T(\vec{e_1}) \, T(\vec{e_2}) \, \ldots \, T(\vec{e_n})]\).

Standard Basis
\(\vec{e_1} = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \vec{e_2} = \begin{pmatrix} 0 \\ 1 \end{pmatrix}\)
Transformations
\(T(\vec{e_1}) = \begin{pmatrix} 2 \\ 1 \end{pmatrix}, T(\vec{e_2}) = \begin{pmatrix} 3 \\ -1 \end{pmatrix}\)
Standard Matrix
\(A = \begin{pmatrix} 2 & 3 \\ 1 & -1 \end{pmatrix}\)
Step 1: Verify that T is linear

Check additivity: \(T\left(\begin{pmatrix} x_1 \\ y_1 \end{pmatrix} + \begin{pmatrix} x_2 \\ y_2 \end{pmatrix}\right) = T\begin{pmatrix} x_1+x_2 \\ y_1+y_2 \end{pmatrix} = \begin{pmatrix} 2(x_1+x_2) + 3(y_1+y_2) \\ (x_1+x_2) - (y_1+y_2) \end{pmatrix} = \begin{pmatrix} 2x_1 + 3y_1 \\ x_1 - y_1 \end{pmatrix} + \begin{pmatrix} 2x_2 + 3y_2 \\ x_2 - y_2 \end{pmatrix} = T\begin{pmatrix} x_1 \\ y_1 \end{pmatrix} + T\begin{pmatrix} x_2 \\ y_2 \end{pmatrix}\). ✓

Step 2: Apply T to standard basis vector e₁

\(T\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 2(1) + 3(0) \\ 1 - 0 \end{pmatrix} = \begin{pmatrix} 2 \\ 1 \end{pmatrix}\)

Step 3: Apply T to standard basis vector e₂

\(T\begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 2(0) + 3(1) \\ 0 - 1 \end{pmatrix} = \begin{pmatrix} 3 \\ -1 \end{pmatrix}\)

Step 4: Form the standard matrix

The standard matrix A has columns \(T(\vec{e_1})\) and \(T(\vec{e_2})\):

\(A = \begin{pmatrix} 2 & 3 \\ 1 & -1 \end{pmatrix}\)

Step 5: Verify the result

Check: \(A\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 2 & 3 \\ 1 & -1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 2x + 3y \\ x - y \end{pmatrix} = T\begin{pmatrix} x \\ y \end{pmatrix}\). ✓

\(A = \begin{pmatrix} 2 & 3 \\ 1 & -1 \end{pmatrix}\)
Final answer:

The standard matrix is \(A = \begin{pmatrix} 2 & 3 \\ 1 & -1 \end{pmatrix}\).

Applied rules:

• Standard matrix theorem: Every linear transformation has a unique matrix representation

• Column method: Standard matrix columns are transformations of basis vectors

• Verification: Always check that T(x) = Ax for arbitrary x

5 Composition of Linear Transformations
Exercise 5
Let \(S: \mathbb{R}^2 \to \mathbb{R}^2\) have standard matrix \(A_S = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\) and \(T: \mathbb{R}^2 \to \mathbb{R}^2\) have standard matrix \(A_T = \begin{pmatrix} 2 & 0 \\ 1 & 1 \end{pmatrix}\). Find the standard matrix for the composition \(T \circ S\).
Definition:

Composition of Transformations: \((T \circ S)(\vec{x}) = T(S(\vec{x}))\). The standard matrix of the composition is the product of the individual standard matrices: \(A_{T \circ S} = A_T A_S\).

Composition Matrix
\(A_{T \circ S} = A_T A_S\)
Matrix Product
\(\begin{pmatrix} 2 & 0 \\ 1 & 1 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\)
Result
\(\begin{pmatrix} 2 & 4 \\ 4 & 6 \end{pmatrix}\)
Step 1: Understand the composition

The composition \((T \circ S)(\vec{x}) = T(S(\vec{x}))\) means we apply S first, then T. The standard matrix for the composition is the product of the individual matrices in the order T · S.

Step 2: Compute \(A_T A_S\)

\(A_{T \circ S} = A_T A_S = \begin{pmatrix} 2 & 0 \\ 1 & 1 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\)

\((A_{T \circ S})_{11} = (2,0) \cdot (1,3) = 2(1) + 0(3) = 2\)

\((A_{T \circ S})_{12} = (2,0) \cdot (2,4) = 2(2) + 0(4) = 4\)

\((A_{T \circ S})_{21} = (1,1) \cdot (1,3) = 1(1) + 1(3) = 4\)

\((A_{T \circ S})_{22} = (1,1) \cdot (2,4) = 1(2) + 1(4) = 6\)

Step 3: Form the result matrix

\(A_{T \circ S} = \begin{pmatrix} 2 & 4 \\ 4 & 6 \end{pmatrix}\)

Step 4: Verify with an example

Let \(\vec{x} = \begin{pmatrix} 1 \\ 0 \end{pmatrix}\).

\(S(\vec{x}) = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 3 \end{pmatrix}\)

\(T(S(\vec{x})) = \begin{pmatrix} 2 & 0 \\ 1 & 1 \end{pmatrix}\begin{pmatrix} 1 \\ 3 \end{pmatrix} = \begin{pmatrix} 2 \\ 4 \end{pmatrix}\)

\((T \circ S)(\vec{x}) = \begin{pmatrix} 2 & 4 \\ 4 & 6 \end{pmatrix}\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 2 \\ 4 \end{pmatrix}\). ✓

\(A_{T \circ S} = \begin{pmatrix} 2 & 4 \\ 4 & 6 \end{pmatrix}\)
Final answer:

The standard matrix for \(T \circ S\) is \(\begin{pmatrix} 2 & 4 \\ 4 & 6 \end{pmatrix}\).

Applied rules:

• Composition property: Standard matrix of composition is product of individual matrices

• Order matters: \((T \circ S)(\vec{x})\) corresponds to \(A_T A_S\), not \(A_S A_T\)

• Verification: Check with specific vector to confirm correctness

Matrix Multiplication: Advanced Concepts
\(AB = \begin{pmatrix} \vec{a_1}^T \\ \vec{a_2}^T \\ \vdots \\ \vec{a_m}^T \end{pmatrix}\begin{pmatrix} | & | & & | \\ \vec{b_1} & \vec{b_2} & \ldots & \vec{b_p} \\ | & | & & | \end{pmatrix}\)
Matrix Multiplication View
Key definitions:

Matrix Multiplication: A binary operation that produces a matrix from two matrices. The resulting matrix has entries that are dot products of rows and columns.

Linear Transformation: A function that preserves vector addition and scalar multiplication, always representable as matrix multiplication.

Standard Matrix: The unique matrix that represents a linear transformation with respect to standard bases.

Complete methodology:
  1. Before multiplying: Check that the number of columns of the first matrix equals the number of rows of the second
  2. For each entry: Compute the dot product of the corresponding row and column
  3. For verification: Use alternative interpretations (linear combinations of columns/rows)
  4. For compositions: Multiply matrices in the order of transformation application
Tip 1: Remember the "inner-outer" rule: (m×n)(n×p) → (m×p).
Tip 2: Matrix multiplication is not commutative: AB ≠ BA in general.
Tip 3: Use the row-column dot product interpretation to visualize the process.
Tip 4: For large matrices, consider using computational tools or block multiplication.
Common errors: Misaligning rows and columns, forgetting to verify dimensions, confusing the order of multiplication in compositions.
Applications: Computer graphics transformations, neural networks, physics simulations, economic models, data transformations.
Properties to know by heart:

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

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

• Identity: \(AI = IA = A\) where I is the identity matrix

• Zero matrix: \(A0 = 0A = 0\)

• \((AB)^T = B^T A^T\) (transpose property)

Matrix Multiplication Visualization: Geometric Interpretation
Exercise 6: Transformation Composition
Visualize how matrix multiplication represents the composition of linear transformations. Show how a vector is transformed by two matrices sequentially versus by their product.

Geometric Interpretation: Matrix multiplication corresponds to applying linear transformations sequentially. The product matrix represents the combined effect of both transformations.

  • Original vector: \(\vec{v} = \begin{pmatrix} 1 \\ 0 \end{pmatrix}\)
  • After transformation A: \(\vec{v'} = A\vec{v}\)
  • After transformation B: \(\vec{v''} = B(A\vec{v}) = (BA)\vec{v}\)
  • Direct transformation: \(\vec{v''} = (BA)\vec{v}\)

Questions & Answers

Question: Why is matrix multiplication defined the way it is? Why not multiply corresponding entries like addition?

Answer: Matrix multiplication is defined to correspond to composition of linear transformations:

Historical motivation: When we compose two linear transformations, the result is another linear transformation whose matrix is the product of the individual matrices.

Example: If \(T(\vec{x}) = A\vec{x}\) and \(S(\vec{x}) = B\vec{x}\), then \((T \circ S)(\vec{x}) = T(S(\vec{x})) = T(B\vec{x}) = A(B\vec{x}) = (AB)\vec{x}\).

If we multiplied corresponding entries (called the Hadamard product), we wouldn't get the composition property, and the result wouldn't represent a linear transformation. The current definition ensures that matrix multiplication corresponds to function composition, which is fundamental in mathematics and applications.

Question: Why isn't matrix multiplication commutative? It seems like it should be since regular multiplication is.

Answer: Matrix multiplication represents composition of linear transformations, which is not commutative:

Geometric example: Consider rotating a book 90° clockwise, then flipping it horizontally. Now try flipping it horizontally first, then rotating 90° clockwise. The final orientations are different!

Matrix example: Let \(A = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}\) and \(B = \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}\).

Then \(AB = \begin{pmatrix} 2 & 1 \\ 1 & 1 \end{pmatrix}\) but \(BA = \begin{pmatrix} 1 & 1 \\ 1 & 2 \end{pmatrix}\).

Since transformations can depend on the order they're applied, matrix multiplication reflects this non-commutative nature.

Question: What happens if I try to multiply incompatible matrices?

Answer: Matrix multiplication AB is only defined when the number of columns of A equals the number of rows of B:

For A (m×n) and B (p×q): AB is defined only if n = p. The result is (m×q).

Examples:

  • (2×3)(3×4) is defined → (2×4) result
  • (2×3)(4×5) is undefined → 3 ≠ 4
  • (2×3)(2×3) is undefined → 3 ≠ 2

Attempting to multiply incompatible matrices leads to a mathematical error because the dot product operation (required for each entry) cannot be performed when the dimensions don't match.

Question: How is matrix multiplication used in physics?

Answer: Matrix multiplication is fundamental in physics:

Coordinate transformations:

  • Rotating coordinate systems
  • Changing reference frames
  • Converting between different coordinate systems

Quantum mechanics:

  • State evolution operators
  • Measurement operators
  • Spin transformations

Classical mechanics:

  • Rigid body rotations
  • Tensor transformations
  • Normal mode analysis

Matrix multiplication allows physicists to systematically handle transformations and coupled systems.

Question: How is matrix multiplication used in computer graphics?

Answer: Matrix multiplication is essential in computer graphics:

Geometric transformations:

  • Translation, rotation, scaling
  • Shearing and reflection
  • Projection transformations

Pipeline operations:

  • Model-view transformations
  • Camera transformations
  • Viewport transformations

Animation:

  • Skinned mesh transformations
  • Blending between poses
  • Particle system updates

By multiplying transformation matrices, complex sequences of operations can be efficiently applied to vertices in a 3D scene.