Return to the MTH 237 homepage.

### Introduction

In the last section, we learned that by consolidating a system of equations into a **matrix** we could quickly (and more important, in a way that is easily automated—*c.f. *extra credit #1) get at the solution(s) of the system, should they exist.

It is standard operating procedure in mathematics, once an object is discovered, to ask what else can be done with the object. What **structure** exists here? There are many kinds of mathematical structure, but one with which you are already familiar is the algebraic properties of the real numbers **R**. Let’s recall what they are.

- Addition is
**associative**:*(a + b) + c = a + (b + c)*. - Addition is
**commutative:***a + b = b + a.* - There exists an
**additive****identity**0 such that*a +*0 = 0 +*a = a*. - There exist
**additive****inverses***-a*such that*a + (-a) =*0. - Multiplication is
**associative:***a(bc) = (ab)c*. - Multiplication is
**commutative**:*ab = ba*. - There exists a
**multiplicative****identity**1 such that 1*a*=*a.* - Multiplication
**distributes**over addition:*a(b+c) = ab + ac*. - There exist
**multiplicative inverses***1/a*for all nonzero*a*such that*a(1/a) =*0.

The question arises: what are ways to define addition and multiplication on matrices that both make sense and follow as many of these rules as possible? We’ll answer that question in this section.

### The basics

A matrix, loosely speaking, is an array of numbers. To be more technical (and we must), let *m *and *n *be positive integers. When we have a **matrix ***A *with *m ***rows **and *n ***columns **whose entries are all **real numbers**, we say . The entry in the *i*-th row and *j*-th column of *A (*or, more easily, the (*i,j*)-th entry) is denoted . The matrix looks like

This is all very abstract so let’s see an example. Kicking up a random 3×4 (three rows, four columns) matrix in Octave gives

.

Here, *A *belongs to the set . (If you are unfamiliar with set theory, we will cover the basics at the beginning of the second part of the course.) The element in its second row and third column is 6, so . The element in its first row and fourth column is 3, so . And so on.

### Addition and subtraction

If I asked you to make up a way to add matrices together, you’d probably come up with adding each of their entries together. You’d be right, except for one problem: the matrices must be of the same size. It doesn’t make sense to add entries if one of the entries doesn’t exist! Addition for matrices of the same size, then, is defined

The above sentence is read *the *(i,j)-*th entry of *A+B *is the *(i,j)*-th **entry of *A *plus the *(i,j)-*th entry of B*. For notational simplicity, this is how we will be defining all of the matrix operations—in terms of what happens to each entry.

For example,

Subtraction’s definition should not surprise you.

For example,

Addition satisfies the rules we’d hope for.

- Addition is
**associative**: (*A*+*B*) +*C*=*A*+ (*B*+*C*). - Addition is
**commutative**:*A*+*B*=*B*+*A*. - There exists an
**additive identity**such that

*A*+ =*A*. - For every
*A*there exists an**additive inverse***-A*such that*A*+ (-*A*) =

One way to regard subtraction is as addition of a number times negative one, like how 4 – 3 = 4 + (-1)3. To get a result like these for matrices, we will need to introduce a new operation.

### Scalar multiplication

We haven’t talked about scalar multiplication before, because for numbers scalar multiplication is just, well, multiplication. In linear algebra, however, it is of utmost priority along with addition.

Let (Greek “lambda”) be a real number and *A *be a matrix. Then

In other words, just multiply every entry of *A *by . Example:

The properties of multiplication by scalars and (Greek “mu”) on compatible matrices *A *and *B *are listed below. These will be important later, as they are a key ingredient in what makes a vector space, the central object of study in linear algebra.

- Multiplication is
**associative**: - There exists an
**identity scalar**1 such that - Multiplication
**distributes**over matrix addition: - Multiplication also
**distributes**over scalar addition:

It may be clear to you that scalar multiplication is a sort of “stretching” operation. In fact, if the matrix in question is a row or column vector with two or three entries, it is identical to the scalar multiplication from vector calculus, which geometrically *was *in fact a stretching operation.

So far, we have adding matrices and scaling them. Is there a sensible way to multiply two matrices together?

There is, but you won’t like it.

### Matrix multiplication

In the interest of establishing the usefulness of matrices concretely before diving headfirst into the abstraction necessary to talk about vector spaces, linear transformations, and the magic that’s going on under the hood here, I will just tell you how to multiply matrices without telling you why it is an extremely good definition. As we move forward in the course, hopefully you will see that for yourself: remarkably many useful properties fall out of this definition.

If *A *and *B *are matrices such that *A *has as many columns as *B *has rows, then

[*i-*th row of *A*] [*j*-th column of *B*].

Here, is the vector dot product from calculus. As reminder, that is the operation where you multiply each component together and then add. Assuming that *A *has *n *columns and B has *n *rows,

Let’s see an example.

First, we note that the matrix on the left, *A*, has the same number of columns as the one on the right, *B*, has rows (two each). Good! These matrices are compatible. Furthermore, the other dimensions of the factors tell us that the result will be a 2 (rows of the left factor) x 3 (columns of the right factor) matrix.

To get the (1,1)-th entry of the product, we take the 1st row of *A *and dot it with the 1st column of *B*. The result is 9(-1) + (-2)0 = -9:

To get the (2,2)-th entry of the product, compute the dot product of the 2nd row of *A *with the 2nd column of *B: *3(2) + 0(2) = 6.

The rest are filled in as follows. Try it yourself!

However, observe that if we reversed the order of the matrices, it wouldn’t work! Since *B *has three columns and *A *has two columns, the product *BA *doesn’t exist. If *AB *exists but *BA *doesn’t, we are forced to conclude that in general

even if both exist!

Multiplication, by necessity, will not follow all the rules that we’d like. Above, we see commutativity is out. (The reason that commutativity can’t happen is due to the magic-under-the-hood view of matrix multiplication, which we’ll see in a couple of sections.) What rules *do *work, then? If *A*, *B*, and *C* are compatible matrices (*i.e. *can be multiplied together as described),

- Multiplication is
**associative**: (*AB*)*C*=*A*(*BC*) - Multiplication
**distributes**over multiplication:*A*(*B*+*C*) =*AB*+*AC*. - If
*A*is a*m*x*n*matrix, then*A*has a**left identity**such that and a**right identity**such that . If*A*is square, we can just write

This identity matrix is

*i.e. *it is the matrix with 1’s on the diagonal and 0’s everywhere else.

### The inverse of a matrix

If matrices can be multiplied together, then one rightfully wonders if there is some type of division operation. (This is the kind of thing you think about, right?) Again, the answer is *sometimes*. Recall that in real number division, the reciprocal of is a number such that

so long if *a *is nonzero. Extending this sentence to refer to matrices *A *rather than real numbers *a, *we might write

Such a matrix $A^{-1}$ is called the inverse of *A*.

Let *A *have *m *rows and *n *columns and $A^{-1}$ have *h *rows and *k *columns. Observe first that if the above sentence is true, then *n = h* and *k** = m* so that the multiplication is possible at all. Since we want * *to be the same size no matter how we order the factors, we also have *m = n = h = k*. Therefore, for such a sentence to be possible, *A *must be square. (Square matrices, as we will see, are the most like numbers. For example, they may always be added and multiplied.)

Can we find the inverse of every square matrix? No, just like not every number has a reciprocal. There is a *zero-ness *to matrices that are not invertible. In the next section, we will discover the special quality that makes a matrix invertible, but it is necessary that the matrix be square.

Recall that matrix equations like *AX = B* may be rendered as augmented matrices [ *A *| *B *]. The solution is found by row-reducing the augmented matrix until *A *is in reduced row echelon form. The right side of the bar becomes the solution in this process. To find the matrix, we are solving the equation *AX = I*, or row-reducing the augmented matrix [ *A *| *I* ]. If exists, then we should be able to row-reduce [ *A *| *I *] into [ *I *| ].

If a matrix *A *has an inverse, then the matrix equation *A***x **= **b** has a unique solution

As an example, the square matrix

has the inverse

so long as *ad – bc *is not zero. To see this, multiply the two matrices together (in both orders!) and see that you get the identity matrix both times.

To end, we will summarize two last easy matrix operations.

### Transposition

The **transpose **of a matrix swaps its rows and columns. If *A *is a *m *x *n *matrix, then is a *n *x *m *matrix such that

.

A matrix with real entries is **normal **if it computes with its transpose, *i.e. *. A matrix is **symmetric **if it is its own transpose, *i.e. *.

### Trace

If *A *is a square matrix of size *n, *then the trace of a matrix is the sum of its diagonal entries: