Lesson 1: Matrix Operations
Learning Objectives
- Understand matrix notation, dimensions, and terminology
- Identify matrix entries using row and column notation
- Determine when two matrices are equal
- Add and subtract matrices with compatible dimensions
- Multiply matrices by scalars
- Multiply matrices using the row-by-column method
- Recognize when matrix operations are defined
- Apply properties of matrix operations
- Identify and work with special matrices (zero and identity matrices)
- Apply matrices to real-world problems in economics, transformations, and networks
Introduction: What is a Matrix?
Matrix: A rectangular array of numbers arranged in rows and columns, enclosed in brackets.
Matrices (plural of matrix) are powerful tools in mathematics used to organize data, solve systems of equations, perform transformations, and model real-world situations. They appear in computer graphics, economics, engineering, statistics, and many other fields.
Example 1: Matrix Notation
Here are examples of matrices with different sizes:
2 × 3 matrix (2 rows, 3 columns):
1 2 3 4 5 6
3 × 2 matrix (3 rows, 2 columns):
7 8 9 10 11 12
1 × 4 matrix (row matrix):
2 -3 0 5
3 × 1 matrix (column matrix):
1 -2 4
Matrix Dimensions: A matrix with m rows and n columns is called an m × n matrix (read "m by n"). The dimensions are always written as rows × columns.
Entry notation: The entry in row i and column j is denoted aij. For example, a23 is the entry in row 2, column 3.
Example 2: Identifying Matrix Entries
Consider the matrix A =
5 -2 7 1 0 -3 4 6 2
Solution:
This is a 3 × 3 matrix. Let's identify some entries:
- a11 = 5 (row 1, column 1)
- a12 = -2 (row 1, column 2)
- a23 = -3 (row 2, column 3)
- a32 = 6 (row 3, column 2)
- a33 = 2 (row 3, column 3)
Example 3: Determining Matrix Dimensions
State the dimensions of each matrix:
(a) B =
1 0 0 1
Answer: 2 × 2 (square matrix)
(b) C =
3 -1 4 2
Answer: 1 × 4 (row matrix)
(c) D =
2 5 -1 0 3 7 1 -2 4 6 8 -3
Answer: 4 × 3
Section 1: Matrix Equality
Equal Matrices: Two matrices are equal if and only if:
- They have the same dimensions, AND
- All corresponding entries are equal
Example 4: Determining Matrix Equality
Are these matrices equal?
A =
and B =
2 5 -1 3
2 5 -1 3
Solution:
Both are 2 × 2 matrices and all corresponding entries are equal:
- a11 = b11 = 2
- a12 = b12 = 5
- a21 = b21 = -1
- a22 = b22 = 3
Answer: Yes, A = B
Example 5: Finding Unknown Entries
Find x and y if
=
2x 5 3 y + 1
8 5 3 7
Solution:
For the matrices to be equal, corresponding entries must be equal:
From entry (1,1): 2x = 8, so x = 4
From entry (2,2): y + 1 = 7, so y = 6
Answer: x = 4, y = 6
Example 6: Different Dimensions
Can these matrices be equal?
A =
and B =
1 2 3
1 2 3
Solution:
A is 1 × 3 and B is 3 × 1. Since they have different dimensions, they cannot be equal, even though they contain the same numbers.
Answer: No, they are not equal.
Section 2: Matrix Addition and Subtraction
Matrix Addition: If A and B are matrices of the same dimensions, then A + B is the matrix obtained by adding corresponding entries.
If A = [aij] and B = [bij], then (A + B)ij = aij + bij
Important
Matrix addition is only defined for matrices with the SAME dimensions. You cannot add a 2 × 3 matrix to a 3 × 2 matrix.
Example 7: Adding Matrices
Find A + B where A =
and B =
2 5 -1 3
4 -2 0 7
Solution:
Both matrices are 2 × 2, so addition is defined. Add corresponding entries:
A + B =
=
2+4 5+(-2) -1+0 3+7
6 3 -1 10
Answer: A + B =
6 3 -1 10
Matrix Subtraction: If A and B are matrices of the same dimensions, then A - B is the matrix obtained by subtracting corresponding entries.
If A = [aij] and B = [bij], then (A - B)ij = aij - bij
Example 8: Subtracting Matrices
Find C - D where C =
and D =
5 -3 2 1 0 -4
2 1 -1 3 -2 5
Solution:
Both are 2 × 3 matrices, so subtraction is defined:
C - D =
=
5-2 -3-1 2-(-1) 1-3 0-(-2) -4-5
3 -4 3 -2 2 -9
Example 9: Incompatible Dimensions
Can we add these matrices?
E =
and F =
1 2 3 4
5 6 7 8 9 10
Solution:
E is 2 × 2 and F is 2 × 3. They have different dimensions.
Answer: No, E + F is undefined because the matrices have different dimensions.
Example 10: Combined Operations
If A =
, B =
1 2 3 4
, and C =
5 -1 2 0
, find A + B - C.
-2 3 1 -5
Solution:
Work from left to right:
A + B =
6 1 5 4
(A + B) - C =
-
6 1 5 4
=
-2 3 1 -5
8 -2 4 9
Section 3: Scalar Multiplication
Scalar Multiplication: If A is a matrix and k is a real number (called a scalar), then kA is the matrix obtained by multiplying every entry of A by k.
If A = [aij], then (kA)ij = k · aij
Example 11: Multiplying by a Scalar
Find 3A where A =
2 -1 4 5
Solution:
Multiply each entry by 3:
3A =
=
3(2) 3(-1) 3(4) 3(5)
6 -3 12 15
Example 12: Negative Scalar
Find -2B where B =
3 0 -4 1 -2 5
Solution:
-2B =
-6 0 8 -2 4 -10
Example 13: Fractional Scalar
Find (1/2)C where C =
8 -6 4 10 -2 0
Solution:
(1/2)C =
4 -3 2 5 -1 0
Example 14: Combining Scalar Multiplication and Addition
If A =
and B =
1 2 3 4
, find 2A + 3B.
5 6 7 8
Solution:
Step 1: Find 2A:
2A =
2 4 6 8
Step 2: Find 3B:
3B =
15 18 21 24
Step 3: Add the results:
2A + 3B =
17 22 27 32
Section 4: Matrix Multiplication
Matrix multiplication is more complex than addition or scalar multiplication. It is NOT done by simply multiplying corresponding entries.
Matrix Multiplication: If A is an m × n matrix and B is an n × p matrix, then the product AB is an m × p matrix.
Key requirement: The number of columns in A must equal the number of rows in B.
The entry in row i, column j of AB is found by multiplying the entries in row i of A by the corresponding entries in column j of B, then adding the products.
Row × Column Method:
To find entry (i,j) in the product AB:
- Take row i from matrix A
- Take column j from matrix B
- Multiply corresponding entries and add the results
Dimension Compatibility
For AB to be defined, the dimensions must satisfy:
A is (m × n) and B is (n × p) → AB is (m × p)
The inner dimensions (both n) must match. The outer dimensions (m and p) give the size of the product.
Example 15: Basic Matrix Multiplication (2 × 2)
Find AB where A =
and B =
2 3 1 4
5 6 7 8
Solution:
A is 2 × 2 and B is 2 × 2, so AB is defined and will be 2 × 2.
Entry (1,1): Row 1 of A × Column 1 of B
[2, 3] · [5, 7]T = 2(5) + 3(7) = 10 + 21 = 31
Entry (1,2): Row 1 of A × Column 2 of B
[2, 3] · [6, 8]T = 2(6) + 3(8) = 12 + 24 = 36
Entry (2,1): Row 2 of A × Column 1 of B
[1, 4] · [5, 7]T = 1(5) + 4(7) = 5 + 28 = 33
Entry (2,2): Row 2 of A × Column 2 of B
[1, 4] · [6, 8]T = 1(6) + 4(8) = 6 + 32 = 38
Answer: AB =
31 36 33 38
Example 16: Different Dimensions
Find AB where A =
and B =
1 2 3 4 5 6
7 8 9 10 11 12
Solution:
A is 2 × 3 and B is 3 × 2. The product AB will be 2 × 2.
Entry (1,1):
[1, 2, 3] · [7, 9, 11]T = 1(7) + 2(9) + 3(11) = 7 + 18 + 33 = 58
Entry (1,2):
[1, 2, 3] · [8, 10, 12]T = 1(8) + 2(10) + 3(12) = 8 + 20 + 36 = 64
Entry (2,1):
[4, 5, 6] · [7, 9, 11]T = 4(7) + 5(9) + 6(11) = 28 + 45 + 66 = 139
Entry (2,2):
[4, 5, 6] · [8, 10, 12]T = 4(8) + 5(10) + 6(12) = 32 + 50 + 72 = 154
Answer: AB =
58 64 139 154
Example 17: Matrix Multiplication is Not Commutative
Given A =
and B =
1 2 3 4
, show that AB ≠ BA.
0 5 6 7
Solution:
Calculate AB:
AB =
=
1(0)+2(6) 1(5)+2(7) 3(0)+4(6) 3(5)+4(7)
12 19 24 43
Calculate BA:
BA =
=
0(1)+5(3) 0(2)+5(4) 6(1)+7(3) 6(2)+7(4)
15 20 27 40
Answer: AB ≠ BA. Matrix multiplication is NOT commutative.
Example 18: When Multiplication is Undefined
Can we multiply these matrices?
C =
and D =
1 2 3 4
5 6 7 8 9 10 11 12 13
Solution:
C is 2 × 2 and D is 3 × 3.
For CD: C has 2 columns but D has 3 rows. The inner dimensions don't match.
Answer: CD is undefined. (Note: DC would be defined and would result in a 3 × 2 matrix.)
Example 19: Row Matrix Times Column Matrix
Find AB where A =
and B =
2 -3 4
1 5 -2
Solution:
A is 1 × 3 and B is 3 × 1, so AB is 1 × 1 (a single number).
AB = [2(-1) + (-3)(5) + 4(-2)] = [2 - 15 - 8] = [-21]
Or simply: AB = -21
Example 20: Larger Matrix Multiplication
Find AB where A =
and B =
1 0 2 -1 3 1
3 1 2 1 1 0
Solution:
A is 2 × 3, B is 3 × 2, so AB is 2 × 2.
AB =
=
1(3)+0(2)+2(1) 1(1)+0(1)+2(0) -1(3)+3(2)+1(1) -1(1)+3(1)+1(0)
5 1 4 2
Section 5: Properties of Matrix Operations
Properties of Matrix Addition and Scalar Multiplication:
For matrices A, B, C (of the same dimensions) and scalars k, m:
- Commutative: A + B = B + A
- Associative: (A + B) + C = A + (B + C)
- Zero Matrix: A + O = A (where O is the zero matrix)
- Additive Inverse: A + (-A) = O
- Scalar Distribution: k(A + B) = kA + kB
- Scalar Distribution: (k + m)A = kA + mA
- Scalar Association: k(mA) = (km)A
- Identity: 1 · A = A
Properties of Matrix Multiplication:
For matrices A, B, C (where products are defined) and scalar k:
- Associative: (AB)C = A(BC)
- Left Distributive: A(B + C) = AB + AC
- Right Distributive: (A + B)C = AC + BC
- Scalar Association: k(AB) = (kA)B = A(kB)
- NOT Commutative: In general, AB ≠ BA
Example 21: Verifying Distributive Property
Verify that A(B + C) = AB + AC for:
A =
, B =
2 1 3 4
, C =
1 0 2 3
4 5 6 7
Solution:
Left side: A(B + C)
First: B + C =
5 5 8 10
Then: A(B + C) =
18 20 47 55
Right side: AB + AC
AB =
4 3 11 12
AC =
14 17 36 43
AB + AC =
18 20 47 55
Answer: Both sides equal
. Property verified!
18 20 47 55
Section 6: Special Matrices
Zero Matrix (O): A matrix where all entries are zero.
Example: The 2 × 3 zero matrix is
0 0 0 0 0 0
Identity Matrix (I): A square matrix with 1's on the main diagonal and 0's elsewhere.
The identity matrix acts like the number 1 in matrix multiplication: AI = IA = A
Example 22: Identity Matrices
Write the 2 × 2 and 3 × 3 identity matrices.
Solution:
2 × 2 identity: I2 =
1 0 0 1
3 × 3 identity: I3 =
1 0 0 0 1 0 0 0 1
Example 23: Identity Property
Verify that AI = A for A =
2 5 3 7
Solution:
AI =
2 5 3 7
=
1 0 0 1
=
2(1)+5(0) 2(0)+5(1) 3(1)+7(0) 3(0)+7(1)
= A
2 5 3 7
Section 7: Applications of Matrices
Example 24: Inventory Application
A company has two stores. Store 1 has 30 laptops, 50 tablets, and 20 smartphones. Store 2 has 25 laptops, 40 tablets, and 35 smartphones. Write this information as a matrix. If each laptop costs $800, each tablet costs $400, and each smartphone costs $600, use matrix multiplication to find the total inventory value at each store.
Solution:
Inventory matrix:
A =
(rows: stores; columns: product types)
30 50 20 25 40 35
Price column matrix:
P =
800 400 600
Calculate AP:
AP =
=
30(800)+50(400)+20(600) 25(800)+40(400)+35(600)
56,000 57,000
Answer: Store 1 has $56,000 in inventory; Store 2 has $57,000 in inventory.
Example 25: Transformation Application
A transformation matrix T =
scales points by a factor of 2. Apply this transformation to the point (3, 4).
2 0 0 2
Solution:
Represent the point as a column matrix:
P =
3 4
Multiply by the transformation matrix:
TP =
2 0 0 2
=
3 4
6 8
Answer: The transformed point is (6, 8), which is (3, 4) scaled by a factor of 2.
Check Your Understanding
1. What are the dimensions of the matrix
?
1 2 3 4 5 6 7 8
Answer: 2 × 4 (2 rows, 4 columns)
2. Find A + B where A =
and B =
3 -1 2 5
4 2 -3 1
Answer:
7 1 -1 6
3. Find 4C where C =
2 -3 1 0
Answer:
8 -12 4 0
4. If A is 3 × 4 and B is 4 × 2, what are the dimensions of AB?
Answer: 3 × 2 (outer dimensions)
5. Can you multiply a 2 × 3 matrix by a 2 × 3 matrix?
Answer: No. The first matrix has 3 columns but the second has 2 rows. The inner dimensions don't match.
6. Find AB where A =
and B =
1 2 3 4
2 0 1 3
Answer:
4 6 10 12
Entry (1,1): 1(2) + 2(1) = 4; Entry (1,2): 1(0) + 2(3) = 6; Entry (2,1): 3(2) + 4(1) = 10; Entry (2,2): 3(0) + 4(3) = 12
7. Is matrix multiplication commutative? That is, does AB always equal BA?
Answer: No, matrix multiplication is NOT commutative. In general, AB ≠ BA.
8. What is the 2 × 2 identity matrix?
Answer:
1 0 0 1
9. Find 2A - 3B where A =
and B =
5 1 2 -3
2 4 1 -1
Answer:
4 -10 1 -3
2A =
; 3B =
10 2 4 -6
; 2A - 3B =
6 12 3 -3
4 -10 1 -3
10. Find [2, -1, 3] ·
4 5 6
Answer: 21
2(4) + (-1)(5) + 3(6) = 8 - 5 + 18 = 21
Key Takeaways
- A matrix is a rectangular array of numbers with dimensions m × n (rows × columns)
- Entry aij is in row i, column j
- Two matrices are equal if they have the same dimensions and all corresponding entries are equal
- Matrix addition and subtraction: Add or subtract corresponding entries (only defined for same dimensions)
- Scalar multiplication: Multiply every entry by the scalar
- Matrix multiplication: Use row × column method; (AB)ij = row i of A × column j of B
- For AB to be defined: number of columns in A must equal number of rows in B
- If A is m × n and B is n × p, then AB is m × p
- Matrix multiplication is NOT commutative: AB ≠ BA in general
- Matrix multiplication IS associative: (AB)C = A(BC)
- Distributive property: A(B + C) = AB + AC
- Zero matrix (O): All entries are 0; A + O = A
- Identity matrix (I): 1's on diagonal, 0's elsewhere; AI = IA = A
- Matrices are used for data organization, transformations, economics, and solving systems