PAGE 1

3.4 Matrix Operations

notation: usually capital letters \(A, B, \text{etc}\)

in print (books) often bold faced

Each number in a matrix is called an element identified by the row and column it occupies.

\[ A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \]

elements are usually the lowercase equivalent

\[ a_{11} = 1, \quad a_{12} = 2, \quad a_{13} = 3 \]
\[ a_{23} = 6 \]

In the notation \(a_{11}\), the first index refers to the row and the second refers to the column.

\[ = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \end{bmatrix} = [a_{ij}] \]

Compact way to express matrix

PAGE 2

Addition

We can add two matrices of the same dimension (\(\#\) rows and \(\#\) columns).

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

\(2 \times 2\)

\[ B = \begin{bmatrix} -1 & -2 \\ -5 & -10 \end{bmatrix} \]

\(2 \times 2\)

\[ A + B = \begin{bmatrix} 1 + (-1) & 2 + (-2) \\ 3 + (-5) & 4 + (-10) \end{bmatrix} \]

element-by-element

\[ = \begin{bmatrix} 0 & 0 \\ -2 & -6 \end{bmatrix} \]
\[ C = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \]

\(2 \times 3\)

\[ D = \begin{bmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{bmatrix} \]

\(3 \times 2\)

\(A + C\) is not possible (different sizes)

neither is \(A + C\) or \(C + D\)

PAGE 3

Scalar multiplication

scalar \( c \) (normally lowercase)

matrix \( A \)

then \( cA = [c \cdot a_{ij}] \) multiply each element by scalar \( c \)

\[ A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \]
\[ 5A = \begin{bmatrix} 5 & 10 \\ 15 & 20 \end{bmatrix} \]
\[ -3A = \begin{bmatrix} -3 & -6 \\ -9 & -12 \end{bmatrix} \]
\[ B = \begin{bmatrix} 1 & 2 & 3 \\ 6 & 5 & 4 \end{bmatrix} \]
\[ 5B = \begin{bmatrix} 5 & 10 & 15 \\ 30 & 25 & 20 \end{bmatrix} \]
\[ -3B = \begin{bmatrix} -3 & -6 & -9 \\ -18 & -15 & -12 \end{bmatrix} \]

Subtraction

\( A - B = A + (-1)B \)

same size
\[ A = \begin{bmatrix} 1 & 2 & 3 \end{bmatrix} \quad B = \begin{bmatrix} 0 & -1 & -5 \end{bmatrix} \]
PAGE 4
\[ \begin{aligned} A - B &= [1 \quad 2 \quad 3] + (-1)[0 \quad -1 \quad -5] \\ &= [1 \quad 2 \quad 3] + [0 \quad 1 \quad 5] = [1 \quad 3 \quad 8] \end{aligned} \]

matrices w/ one row or one column only are called vectors

\( A = [1 \quad 2 \quad 3] \) is a row vector

\( C = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} \) is a column vector

Matrix multiplication

very different from numbers

\( AB \) is possible only if # columns of \( A \) is equal to # rows of \( B \)

first matrix has the same # of columns as the # of rows of the second matrix

result is a matrix w/ # of rows of 1st and # of columns of 2nd

PAGE 5

Matrix Multiplication Dimensions

\( AB = C \)

\( [3 \times 3] [3 \times 1] = 3 \times 1 \)

Inner dimensions must match

The number of columns in A must equal the number of rows in B.

Resulting Dimensions

  • Rows of result: from first matrix
  • Columns of result: from second matrix

Example

Given matrices \( A \) and \( B \):

\( A = \begin{bmatrix} 1 & 1 \\ 2 & 1 \end{bmatrix} \quad (2 \times 2) \)

\( B = \begin{bmatrix} -4 & 0 & 3 \\ 1 & -5 & 2 \end{bmatrix} \quad (2 \times 3) \)

Calculating the product \( AB \):

Dimension Check:

\( AB \) is \( (2 \times 2) \times (2 \times 3) \). The inner dimensions (2 and 2) match!

\( AB = \begin{bmatrix} 1 & 1 \\ 2 & 1 \end{bmatrix} \begin{bmatrix} -4 & 0 & 3 \\ 1 & -5 & 2 \end{bmatrix} \)

Method: Multiply row by column, then add.

\( = \begin{bmatrix} 1 \cdot -4 + 1 \cdot 1 & 1 \cdot 0 + 1 \cdot -5 & 1 \cdot 3 + 1 \cdot 2 \\ 2 \cdot -4 + 1 \cdot 1 & 2 \cdot 0 + 1 \cdot -5 & 2 \cdot 3 + 1 \cdot 2 \end{bmatrix} \)

\( = \begin{bmatrix} -3 & -5 & 5 \\ -7 & -5 & 8 \end{bmatrix} \)

PAGE 6

Matrix Commutativity

General Rule: For matrices, \( AB \neq BA \) in general.

\( BA \) is NOT possible for the previous example.

\( B \) is \( 2 \times 3 \) and \( A \) is \( 2 \times 2 \). The inner dimensions (3 and 2) do NOT match.

Example: Both products possible but unequal

\( A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} \quad (2 \times 2) \)

\( B = \begin{bmatrix} -1 & 9 \\ -5 & -6 \end{bmatrix} \quad (2 \times 2) \)

\( AB \) and \( BA \) are both possible.

Calculating \( AB \):

\( AB = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} \begin{bmatrix} -1 & 9 \\ -5 & -6 \end{bmatrix} = \begin{bmatrix} -7 & 12 \\ -11 & -3 \end{bmatrix} \)

Calculating \( BA \):

\( BA = \begin{bmatrix} -1 & 9 \\ -5 & -6 \end{bmatrix} \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} = \begin{bmatrix} 7 & 17 \\ -16 & -17 \end{bmatrix} \)

\( AB \neq BA \) in general

PAGE 7

Matrix Multiplication and the Identity Matrix

\[ A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}_{2 \times 2} \quad B = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}_{2 \times 2} \]
\[ AB = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \]
\[ BA = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \]

This is one exception to \( AB \neq BA \)

because the matrix \( \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \) is a \( 2 \times 2 \) identity matrix.

It is the matrix equivalent of the number 1:

  • \( 1 \cdot 5 = 5 \cdot 1 \)
  • \( 1 \cdot 10 = 10 \cdot 1 \)
PAGE 8

There is NO matrix division but there is matrix inverse (later part of chapter).

\( \rightarrow \) equivalent to scalar inverse: \( 1 \cdot a^{-1} = \frac{1}{a} \)

Ways to interpret linear systems

\[ \begin{cases} x_1 + 3x_2 = 9 \\ 2x_1 + x_2 = 8 \end{cases} \]

Express as a matrix equation:

\[ \underbrace{\begin{bmatrix} 1 & 3 \\ 2 & 1 \end{bmatrix}}_{A} \underbrace{\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}}_{\vec{x}} = \underbrace{\begin{bmatrix} 9 \\ 8 \end{bmatrix}}_{\vec{b}} \]

\( A\vec{x} = \vec{b} \)

Express as a vector equation:

\[ x_1 \begin{bmatrix} 1 \\ 2 \end{bmatrix} + x_2 \begin{bmatrix} 3 \\ 1 \end{bmatrix} = \begin{bmatrix} 9 \\ 8 \end{bmatrix} \]
PAGE 9

1st Interpretation of a Linear System

The first interpretation of the system of equations:

\[ \begin{cases} x_1 + 3x_2 = 9 \\ 2x_1 + x_2 = 8 \end{cases} \]

is the intersection of the two lines.

Coordinate graph showing two lines intersecting at the point (3, 2) on the x1-x2 plane.

2nd Interpretation: Vector Equation

The second interpretation views the system as a linear combination of vectors:

\[ x_1 \begin{bmatrix} 1 \\ 2 \end{bmatrix} + x_2 \begin{bmatrix} 3 \\ 1 \end{bmatrix} = \begin{bmatrix} 9 \\ 8 \end{bmatrix} \]

In this geometric view, we scale the column vectors by \(x_1\) and \(x_2\) to reach the target vector:

  • \(x_1 \to 3 \begin{bmatrix} 1 \\ 2 \end{bmatrix}\)
  • \(x_2 \to 2 \begin{bmatrix} 3 \\ 1 \end{bmatrix}\)
Vector addition diagram showing 3 times vector [1,2] plus 2 times vector [3,1] resulting in vector [9,8].