Safaa Dabagh

Lesson 1: Matrix Operations

Module 8, Lesson 1 of 4 Next Lesson

Learning Objectives

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):

123
456

3 × 2 matrix (3 rows, 2 columns):

78
910
1112

1 × 4 matrix (row matrix):

2-305

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-27
10-3
462

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 =

10
01

Answer: 2 × 2 (square matrix)

(b) C =

3-142

Answer: 1 × 4 (row matrix)

(c) D =

25-1
037
1-24
68-3

Answer: 4 × 3

Section 1: Matrix Equality

Equal Matrices: Two matrices are equal if and only if:

  1. They have the same dimensions, AND
  2. All corresponding entries are equal

Example 4: Determining Matrix Equality

Are these matrices equal?

A =

25
-13
and B =
25
-13

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

2x5
3y + 1
=
85
37

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 =

123
and B =
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 =

25
-13
and B =
4-2
07

Solution:

Both matrices are 2 × 2, so addition is defined. Add corresponding entries:

A + B =

2+45+(-2)
-1+03+7
=
63
-110

Answer: A + B =

63
-110

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 =

5-32
10-4
and D =
21-1
3-25

Solution:

Both are 2 × 3 matrices, so subtraction is defined:

C - D =

5-2-3-12-(-1)
1-30-(-2)-4-5
=
3-43
-22-9

Example 9: Incompatible Dimensions

Can we add these matrices?

E =

12
34
and F =
567
8910

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 =

12
34
, B =
5-1
20
, and C =
-23
1-5
, find A + B - C.

Solution:

Work from left to right:

A + B =

61
54

(A + B) - C =

61
54
-
-23
1-5
=
8-2
49

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
45

Solution:

Multiply each entry by 3:

3A =

3(2)3(-1)
3(4)3(5)
=
6-3
1215

Example 12: Negative Scalar

Find -2B where B =

30-4
1-25

Solution:

-2B =

-608
-24-10

Example 13: Fractional Scalar

Find (1/2)C where C =

8-6
410
-20

Solution:

(1/2)C =

4-3
25
-10

Example 14: Combining Scalar Multiplication and Addition

If A =

12
34
and B =
56
78
, find 2A + 3B.

Solution:

Step 1: Find 2A:

2A =

24
68

Step 2: Find 3B:

3B =

1518
2124

Step 3: Add the results:

2A + 3B =

1722
2732

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:

  1. Take row i from matrix A
  2. Take column j from matrix B
  3. 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 =

23
14
and B =
56
78

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 =

3136
3338

Example 16: Different Dimensions

Find AB where A =

123
456
and B =
78
910
1112

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 =

5864
139154

Example 17: Matrix Multiplication is Not Commutative

Given A =

12
34
and B =
05
67
, show that AB ≠ BA.

Solution:

Calculate AB:

AB =

1(0)+2(6)1(5)+2(7)
3(0)+4(6)3(5)+4(7)
=
1219
2443

Calculate BA:

BA =

0(1)+5(3)0(2)+5(4)
6(1)+7(3)6(2)+7(4)
=
1520
2740

Answer: AB ≠ BA. Matrix multiplication is NOT commutative.

Example 18: When Multiplication is Undefined

Can we multiply these matrices?

C =

12
34
and D =
567
8910
111213

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 =

2-34
and B =
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 =

102
-131
and B =
31
21
10

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)
=
51
42

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:

  1. Commutative: A + B = B + A
  2. Associative: (A + B) + C = A + (B + C)
  3. Zero Matrix: A + O = A (where O is the zero matrix)
  4. Additive Inverse: A + (-A) = O
  5. Scalar Distribution: k(A + B) = kA + kB
  6. Scalar Distribution: (k + m)A = kA + mA
  7. Scalar Association: k(mA) = (km)A
  8. Identity: 1 · A = A

Properties of Matrix Multiplication:

For matrices A, B, C (where products are defined) and scalar k:

  1. Associative: (AB)C = A(BC)
  2. Left Distributive: A(B + C) = AB + AC
  3. Right Distributive: (A + B)C = AC + BC
  4. Scalar Association: k(AB) = (kA)B = A(kB)
  5. NOT Commutative: In general, AB ≠ BA

Example 21: Verifying Distributive Property

Verify that A(B + C) = AB + AC for:

A =

21
34
, B =
10
23
, C =
45
67

Solution:

Left side: A(B + C)

First: B + C =

55
810

Then: A(B + C) =

1820
4755

Right side: AB + AC

AB =

43
1112

AC =

1417
3643

AB + AC =

1820
4755

Answer: Both sides equal

1820
4755
. Property verified!

Section 6: Special Matrices

Zero Matrix (O): A matrix where all entries are zero.

Example: The 2 × 3 zero matrix is

000
000

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 =

10
01

3 × 3 identity: I3 =

100
010
001

Example 23: Identity Property

Verify that AI = A for A =

25
37

Solution:

AI =

25
37
10
01
=
2(1)+5(0)2(0)+5(1)
3(1)+7(0)3(0)+7(1)
=
25
37
= A

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 =

305020
254035
(rows: stores; columns: product types)

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 =

20
02
scales points by a factor of 2. Apply this transformation to the point (3, 4).

Solution:

Represent the point as a column matrix:

P =

3
4

Multiply by the transformation matrix:

TP =

20
02
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

1234
5678
?

Answer: 2 × 4 (2 rows, 4 columns)

2. Find A + B where A =

3-1
25
and B =
42
-31

Answer:

71
-16

3. Find 4C where C =

2-3
10

Answer:

8-12
40

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 =

12
34
and B =
20
13

Answer:

46
1012

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:

10
01

9. Find 2A - 3B where A =

51
2-3
and B =
24
1-1

Answer:

4-10
1-3

2A =

102
4-6
; 3B =
612
3-3
; 2A - 3B =
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

Back to Module 8 Next: Matrix Inverses