Matrix Operations

Adding, subtracting, and multiplying matrices

Matrix Operations

What is a Matrix?

A matrix is a rectangular array of numbers.

Example: A=[1234]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}

Dimensions: rows ร— columns (this is a 2ร—2 matrix)

Adding Matrices

Add corresponding entries. Matrices must have same dimensions.

[abcd]+[efgh]=[a+eb+fc+gd+h]\begin{bmatrix} a & b \\ c & d \end{bmatrix} + \begin{bmatrix} e & f \\ g & h \end{bmatrix} = \begin{bmatrix} a+e & b+f \\ c+g & d+h \end{bmatrix}

Subtracting Matrices

Subtract corresponding entries.

[5321]โˆ’[2110]=[3211]\begin{bmatrix} 5 & 3 \\ 2 & 1 \end{bmatrix} - \begin{bmatrix} 2 & 1 \\ 1 & 0 \end{bmatrix} = \begin{bmatrix} 3 & 2 \\ 1 & 1 \end{bmatrix}

Scalar Multiplication

Multiply every entry by the scalar:

3[1234]=[36912]3\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} = \begin{bmatrix} 3 & 6 \\ 9 & 12 \end{bmatrix}

Matrix Multiplication

Not commutative! ABโ‰ BAAB \neq BA in general

For Amร—nA_{m \times n} and Bnร—pB_{n \times p}:

  • Result is mร—pm \times p matrix
  • Inner dimensions must match!

Entry formula: (AB)ij=(AB)_{ij} = (row ii of AA) ยท (column jj of BB)

Example: [1234][5678]=[19224350]\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}

๐Ÿ“š Practice Problems

1Problem 1easy

โ“ Question:

Add the matrices: [2 3] + [1 4] [5 1] [2 0]

๐Ÿ’ก Show Solution

Step 1: Add corresponding elements: [2+1 3+4] = [3 7] [5+2 1+0] [7 1]

Step 2: Note that matrices must have the same dimensions to be added

Answer: [3 7] [7 1]

2Problem 2easy

โ“ Question:

Add: [2513]+[4126]\begin{bmatrix} 2 & 5 \\ 1 & 3 \end{bmatrix} + \begin{bmatrix} 4 & 1 \\ 2 & 6 \end{bmatrix}

๐Ÿ’ก Show Solution

Add corresponding entries:

[2+45+11+23+6]=[6639]\begin{bmatrix} 2+4 & 5+1 \\ 1+2 & 3+6 \end{bmatrix} = \begin{bmatrix} 6 & 6 \\ 3 & 9 \end{bmatrix}

Answer: [6639]\begin{bmatrix} 6 & 6 \\ 3 & 9 \end{bmatrix}

3Problem 3easy

โ“ Question:

Multiply the matrix by the scalar: 3[2 -1] [4 5]

๐Ÿ’ก Show Solution

Step 1: Multiply each element by 3: 3[2 -1] = [3ยท2 3ยท(-1)] [4 5] [3ยท4 3ยท5]

Step 2: Calculate: = [6 -3] [12 15]

Answer: [6 -3] [12 15]

4Problem 4medium

โ“ Question:

Multiply: [2314][56]\begin{bmatrix} 2 & 3 \\ 1 & 4 \end{bmatrix} \begin{bmatrix} 5 \\ 6 \end{bmatrix}

๐Ÿ’ก Show Solution

This is a 2ร—2 matrix times a 2ร—1 matrix. Result will be 2ร—1.

First entry: 2(5)+3(6)=10+18=282(5) + 3(6) = 10 + 18 = 28

Second entry: 1(5)+4(6)=5+24=291(5) + 4(6) = 5 + 24 = 29

Answer: [2829]\begin{bmatrix} 28 \\ 29 \end{bmatrix}

5Problem 5medium

โ“ Question:

Multiply: [1 2][5] [3 4][6]

๐Ÿ’ก Show Solution

Step 1: Check dimensions: First matrix: 2ร—2 Second matrix: 2ร—1 Result will be: 2ร—1

Step 2: Calculate first element (row 1 ร— column): 1(5) + 2(6) = 5 + 12 = 17

Step 3: Calculate second element (row 2 ร— column): 3(5) + 4(6) = 15 + 24 = 39

Step 4: Write result: [17] [39]

Answer: [17] [39]

6Problem 6medium

โ“ Question:

Multiply: [1 2][5 6] [3 4][7 8]

๐Ÿ’ก Show Solution

Step 1: Check dimensions: Both are 2ร—2, result will be 2ร—2

Step 2: Calculate element (1,1): Row 1 ร— Column 1: 1(5) + 2(7) = 5 + 14 = 19

Step 3: Calculate element (1,2): Row 1 ร— Column 2: 1(6) + 2(8) = 6 + 16 = 22

Step 4: Calculate element (2,1): Row 2 ร— Column 1: 3(5) + 4(7) = 15 + 28 = 43

Step 5: Calculate element (2,2): Row 2 ร— Column 2: 3(6) + 4(8) = 18 + 32 = 50

Step 6: Write result: [19 22] [43 50]

Answer: [19 22] [43 50]

7Problem 7hard

โ“ Question:

Multiply: [1234][2013]\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 2 & 0 \\ 1 & 3 \end{bmatrix}

๐Ÿ’ก Show Solution

Calculate each entry of the 2ร—2 result:

Entry (1,1): 1(2)+2(1)=2+2=41(2) + 2(1) = 2 + 2 = 4

Entry (1,2): 1(0)+2(3)=0+6=61(0) + 2(3) = 0 + 6 = 6

Entry (2,1): 3(2)+4(1)=6+4=103(2) + 4(1) = 6 + 4 = 10

Entry (2,2): 3(0)+4(3)=0+12=123(0) + 4(3) = 0 + 12 = 12

Answer: [461012]\begin{bmatrix} 4 & 6 \\ 10 & 12 \end{bmatrix}

8Problem 8hard

โ“ Question:

Given A = [1 2] and B = [5 6], find 2A - 3B. [3 4] [7 8]

๐Ÿ’ก Show Solution

Step 1: Calculate 2A: 2A = 2[1 2] = [2 4] [3 4] [6 8]

Step 2: Calculate 3B: 3B = 3[5 6] = [15 18] [7 8] [21 24]

Step 3: Subtract 3B from 2A: 2A - 3B = [2 4] - [15 18] [6 8] [21 24]

Step 4: Subtract corresponding elements: = [2-15 4-18] [6-21 8-24]

Step 5: Simplify: = [-13 -14] [-15 -16]

Answer: [-13 -14] [-15 -16]