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! ABBAAB \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: [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}

2Problem 2medium

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}

3Problem 3hard

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}