Lecture 3 Notes: MIT Linear Algebra (18.06) [Multiplication and Inverse Matrices]

Important Points and Concepts

– When are 2 matrices multipliable? And what would the result look like?

– What are the ways we can multiply 2 matrices?

– What is an inverse matrix? And how do we find it?

Multiplication

When are 2 matrices multipliable? And what would the result look like?

Let A be an m x n matrix and B an n x m matrix. Can we multiply A and B?

An easy way to tell if 2 matrices are multipliable is to check if the number of columns of the matrix A is equal to the number of rows of matrix B. If they are, we can multiply them. The output will have the have the same number of rows as A and the same number of columns as B.

(m x n)(n x m) = m x m

In this case, AB will result in an m x m matrix, let’s call it C.

Let’s do another quick example: A(m x  n)B(n x p) = C(???)

Matrix A is an m x n matrix and B is an n x p matrix. First, can we multiply them? And if so, what would the output look like in terms of rows and columns?

We can see that A has n rows, B has n columns, which means that we can multiply these 2 matrices. C would have the number of rows of A (m) and the number of columns in B (p). Therefore, C would be an m x p matrix.

What are the ways we can multiply 2 matrices?

Ways to multiply $\Bigg[ \hphantom{-} \begin{matrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{matrix} \hphantom{-}\Bigg] \Bigg[ \hphantom{-} \begin{matrix} 7 & 8 \\ 9 & 10 \\ 11 & 12 \end{matrix} \hphantom{-}\Bigg] \hphantom{-} = \hphantom{-} ???$

These matrices are multipliable, the result is an 2 x 3 matrix.

Let’s call the first matrix P, the second matrix Q and the resulting matrix Z.

What are the ways we can multiply 2 matrices?

Dot product (standard way)

To find the top left number of Z, we take the first row of P [1, 2, 3] and the first column of Q [7, 9, 11]. We perform an operation called the dot product, which looks like this: (1, 2, 3) * (7, 9, 11).

The operation produces (1 * 7) + (2 * 9) + (3 * 11) and the top left number of Z results in 58.

For the top right value, we perform the same operation with the same row [1, 2, 3] but a different column. Instead we use the second column of Q [8, 10, 12] since we are trying the find the (1, 2) value of Z. Notice how change which row and column we are multiplying based on the row and column of Z.

The operation produces this: (1 * 8) + (2 * 10) + (3 * 12) and the top left number of Z is 64.

I won’t solve it all the way, but you get the idea. For the bottom left of Z (2, 1), we’d be taking the dot product of the second row of P and the first column of the Q.

Column Way (columns of Z are combinations of columns of P)

How do we multiply a matrix by a column?

Let’s find the first column of Z: P times first column of Q.

And that’s it, we repeat this process for each column of Q to produce each column of Z.

Row way (rows of  Z are combinations of rows of Q)

How do we multiply a row by a matrix?

Let’s find the first column of Z: the first row of P times Q.

Very similar to the column way. We repeat this process for each row of P.

Columns x Rows

Columns of P times a row of Q = (2 x 1) x (1 x 3). We get a 2 x 3 matrix.

A quick example: $\Bigg[ \hphantom{-} \begin{matrix} 2 \\ 3 \\ 4 \end{matrix} \hphantom{-}\Bigg] \Bigg[ \hphantom{-} \begin{matrix} 1 & 6 \end{matrix} \hphantom{-}\Bigg] \hphantom{-} = \hphantom{-} \Bigg[ \hphantom{-} \begin{matrix} 2 & 12 \\ 3 & 18 \\ 4 & 24 \end{matrix} \hphantom{-}\Bigg]$

The first row of the result [2 * 1, 2 * 6] is [2, 12]. The second row is [3 * 1, 3 * 6] is [3, 18] and the third row is [4, 24]. The pattern is easy to see.

Block

Let’s say we want to multiply matrices A and B, both are 20 x 20 matrices. The main concept is that we can break up matrices  into blocks. We can break up A into 4 10 x 10 matrices and B into 4 10 x 10 matrices. Simply multiply the top left blocks of A and B, and we get the top left matrix of the resulting matrix (AB).

Inverses

What is an inverse matrix? And how do we find it?

Let A be a square matrix. $A^{-1} A = I \\ AA^{-1} = I$

The inverse of A times A is the identity matrix, I. And this works both ways for square matrices only.

A matrix has no inverse if

– The determinant is zero (the left diagonal numbers multiplied together minus the right diagonal multiplied together is zero)

– Both columns lie on the same line (for example if the second column in a 2 x 2 matrix is a multiple of the first)

– you can find a vector x with Ax = 0, (x!=0)

Gauss – Jordan (solve 2 equations at once)

Solve for the inverse. $\Bigg[ \hphantom{-} \begin{matrix} 1 & 3 \\ 2 & 7 \end{matrix} \hphantom{-}\Bigg] \Bigg[ \hphantom{-} \begin{matrix} a & b \\ c & d \end{matrix} \hphantom{-}\Bigg] \hphantom{-} = \hphantom{-} \Bigg[ \hphantom{-} \begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix} \hphantom{-}\Bigg]$

First, create an augmented matrix that includes the identity. $\Bigg[ \hphantom{-} \begin{matrix} 1 & 3 & 1 & 0 \\ 2 & 7 & 0 & 1 \end{matrix} \hphantom{-}\Bigg]$

Recreate the identity matrix on the left side of this matrix using elimination and the right side will become the inverse. $\Bigg[ \hphantom{-} \begin{matrix} 1 & 3 & 1 & 0 \\ 2 & 7 & 0 & 1 \end{matrix} \hphantom{-}\Bigg] \rightarrow \Bigg[ \hphantom{-} \begin{matrix} 1 & 3 & 1 & 0 \\ 0 & 1 & -2 & 1 \end{matrix} \hphantom{-}\Bigg] \rightarrow \Bigg[ \hphantom{-} \begin{matrix} 1 & 0 & 7 & -3 \\ 0 & 1 & -2 & 1 \end{matrix} \hphantom{-}\Bigg]$

The process is elimination the usual way, top down. Once we reach the bottom, we perform elimination bottom up to reproduce the identity matrix.

And you can see, the right side becomes the inverse of our original matrix. $EA = I \rightarrow E = A^{-1}$