# Review of linear algebra

## Contents

# Review of linear algebra#

## Terminology#

An ordinary number in \(\mathbb{R}\) or \(\mathbb{C}\) may be called a **scalar**. An \(m\times n\) matrix \(\mathbf{A}\) is a rectangular \(m\)-by-\(n\) array of numbers called **elements** or *entries*. The numbers \(m\) and \(n\) are called the **row dimension** and the **column dimension**, respectively; collectively they describe the **size** or *shape* of \(\mathbf{A}\). We say \(\mathbf{A}\) belongs to the set \(\mathbb{R}^{m\times n}\) if its entries are real, or \(\mathbb{C}^{m\times n}\) if they are complex-valued. A **square** matrix has equal row and column dimensions. A **row vector** has dimension \(1\times n\), while a **column vector** has dimension \(m \times 1\).

In this text, *all vectors are column vectors*, and we use \(\mathbb{R}^n\) or \(\mathbb{C}^n\) to denote spaces of these vectors. When a row vector is needed, it is given an explicit transpose symbol (see below).

We use capital letters in bold to refer to matrices, and lowercase bold letters for vectors. The bold symbol \(\boldsymbol{0}\) may refer to a vector of all zeros or to a zero matrix, depending on context; we use \(0\) as the scalar zero only.

To refer to a specific element of a matrix, we use the uppercase name of the matrix *without* boldface. For instance, \(A_{24}\) refers to the \((2,4)\) element of \(\mathbf{A}\). To refer to an element of a vector, we use just one subscript, as in \(x_3\). A boldface character with one or more subscripts, on the other hand, is a matrix (uppercase) or vector (lowercase) that belongs to a numbered collection.

We will have frequent need to refer to the individual columns of a matrix as vectors. We use a lowercase bold version of the matrix name with a subscript to represent the column number. For example, \(\mathbf{a}_1,\mathbf{a}_2,\ldots,\mathbf{a}_n\) are the columns of the \(m\times n\) matrix \(\mathbf{A}\). Conversely, whenever we define a sequence of vectors \(\mathbf{v}_1,\ldots,\mathbf{v}_p\), we can implicitly consider them to be columns of a matrix \(\mathbf{V}\). Sometimes we might write

to emphasize the connection between a matrix and its columns.

The **diagonal** (more specifically, *main diagonal*) of an \(n\times n\) matrix \(\mathbf{A}\) refers to the entries \(A_{ii}\), \(i=1,\ldots,n\). The entries \(A_{ij}\) where \(j-i=k\) are on a **superdiagonal** if \(k>0\) and a **subdiagonal** if \(k<0\). The diagonals are numbered as indicated here:

A **diagonal matrix** is one whose entries are all zero off the main diagonal. An **upper triangular matrix** \(\mathbf{U}\) has entries \(U_{ij}\) with \(U_{ij}=0\) if \(i>j\), and a **lower triangular matrix** \(\mathbf{L}\) has \(L_{ij}=0\) if \(i<j\).

The **transpose** of \(\mathbf{A}\in\mathbb{C}^{m\times n}\) is the matrix \(\mathbf{A}^T\in\mathbb{C}^{n\times m}\) given by

The **adjoint** or **hermitian** of a matrix \(\mathbf{A}\) is given by \(\mathbf{A}^*=\overline{\mathbf{A}^T}\), where the bar denotes taking a complex conjugate elementwise.1 If \(\mathbf{A}\) is real, then \(\mathbf{A}^*=\mathbf{A}^T\). A square matrix is **symmetric** if \(\mathbf{A}^T=\mathbf{A}\) and **hermitian** if \(\mathbf{A}^*=\mathbf{A}\).

## Algebra#

Matrices and vectors of the same size may be added elementwise. Multiplication by a scalar is also defined elementwise. These operations obey the familiar laws of commutativity, associativity, and distributivity. The multiplication of two matrices, on the other hand, is less straightforward.

There are two ways for vectors to be multiplied together. If \(\mathbf{v}\) and \(\mathbf{w}\) are in \(\mathbb{C}^n\), their **inner product** is

Trivially, one finds that \(\mathbf{w}^* \mathbf{v} = \overline{(\mathbf{v}^*\mathbf{w})}\).

Additionally, any two vectors \(\mathbf{v}\in\mathbb{C}^m\) and \(\mathbf{w}\in\mathbb{C}^n\) (with \(m\neq n\) allowed) have an **outer product**, which is an \(m\times n\) matrix:

For real vectors, the complex conjugates above have no effect and \({}^*\) becomes \({}^T\).

In order for matrices \(\mathbf{A}\) and \(\mathbf{B}\) to be multiplied, it is necessary that their inner dimensions match. Thus, if \(\mathbf{A}\) is \(m\times p\), then \(\mathbf{B}\) must be \(p \times n\). In terms of scalar components, the \((i,j)\) entry of \(\mathbf{C}=\mathbf{A}\mathbf{B}\) is given by

Note that even if \(\mathbf{A}\mathbf{B}\) is defined, \(\mathbf{B}\mathbf{A}\) may not be. Moreover, even when both products are defined, they may not equal each other.

Matrix multiplication is not commutative, i.e., the order of terms in a product matters to the result.

Matrix multiplication is associative, however:

Hence while we cannot change the ordering of the *terms*, we can change the order of the *operations*. This is a property that we will use repeatedly. We also note here the important identity

Specifically, if either product is defined, then they both are defined and equal each other.

## Linear combinations#

It is worth reinterpreting (2) at a vector level. If \(\mathbf{A}\) has dimensions \(m\times n\), it can be multiplied on the right by an \(n \times 1\) column vector \(\mathbf{v}\) to produce an \(m \times 1\) column vector \(\mathbf{A}\mathbf{v}\), which satisfies

We say that \(\mathbf{A}\mathbf{v}\) is a **linear combination** of the columns of \(\mathbf{A}\).

Multiplying a matrix on the right by a column vector produces a linear combination of the columns of the matrix.

There is a similar interpretation of multiplying \(\mathbf{A}\) on the left by a row vector. Keeping to our convention that boldface letters represent column vectors, we write, for \(\mathbf{v}\in\mathbb{R}^m\),

Multiplying a matrix on the left by a row vector produces a linear combination of the rows of the matrix.

These two observations extend to more general matrix-matrix multiplications. One can show that (assuming that \(\mathbf{A}\) is \(m\times p\) and \(\mathbf{B}\) is \(p\times n\))

Equivalently, if we write \(\mathbf{A}\) in terms of rows, then

A matrix-matrix product is a horizontal concatenation of matrix-vector products involving the columns of the right-hand matrix. Equivalently, a matrix-matrix product is also a vertical concatenation of vector-matrix products involving the rows of the left-hand matrix.

The representations of matrix multiplication are interchangeable; whichever one is most convenient at any moment can be used.

Let

Then, going by (2), we get

But note also, for instance, that

and so on, as according to (6).

There is also an interpretation, presented in Section 2.4, of matrix products in terms of vector outer products.

## Identity and inverse#

The **identity matrix** of size \(n\), called \(\mathbf{I}\) (or sometimes \(\mathbf{I}_n\)), is a diagonal \(n\times n\) matrix with every diagonal entry equal to one. As can be seen from (6) and (7), it satisfies \(\mathbf{A}\mathbf{I}=\mathbf{A}\) for \(\mathbf{A}\in\mathbb{C}^{m\times n}\) and \(\mathbf{I}\mathbf{B}=\mathbf{B}\) for \(\mathbf{B}\in\mathbb{C}^{n\times p}\). It is therefore the matrix analog of the number 1, the multiplicative identity.

Let

Suppose we want to create a zero in the (2,1) entry by adding \(-3\) times the first row to the second row, leaving the other rows unchanged.

We can express this operation as a product \(\mathbf{A}\mathbf{B}\) as follows. From dimensional considerations alone, \(\mathbf{A}\) will need to be \(3\times 3\). According to (5), we get “\(-3\) times row 1 plus row 2” from left-multiplying \(\mathbf{B}\) by the column vector \(\bigl[ -3,\: 1,\: 0 \bigr]\). Equation (7) tells us that this must be the second row of \(\mathbf{A}\).

Since the first and third rows of \(\mathbf{A}\mathbf{B}\) are the same as those of \(\mathbf{B}\), similar logic tells us that the first and third rows of \(\mathbf{A}\) are the same as the identity matrix:

This can be verified using (2).

Note that a square matrix \(\mathbf{A}\) can always be multiplied by itself to get a matrix of the same size. Hence we can define the integer powers \(\mathbf{A}^2=(\mathbf{A})(\mathbf{A})\), \(\mathbf{A}^3=(\mathbf{A}^2) \mathbf{A} = (\mathbf{A}) \mathbf{A}^2\) (by associativity), and so on. By definition, \(\mathbf{A}^0=\mathbf{I}\).

If \(\mathbf{A}\) is an \(n\times n\) matrix, then there may be at most one matrix \(\mathbf{Z}\) of the same size such that

If \(\mathbf{Z}\) exists, it is called the **inverse** of \(\mathbf{A}\) and is written as \(\mathbf{A}^{-1}\). In this situation we say that \(\mathbf{A}\) is **invertible**.

The zero matrix has no inverse. For \(n>1\) there are also nonzero matrices that have no inverse. Such matrices are called **singular**. The properties “invertible” and “singular” are exclusive opposites; thus, *nonsingular* means invertible and *noninvertible* means singular.

## Linear systems#

Given a square, \(n\times n\) matrix \(\mathbf{A}\) and \(n\)-vectors \(\mathbf{x}\) and \(\mathbf{b}\), the equation \(\mathbf{A}\mathbf{x}=\mathbf{b}\) is equivalent to

The following facts are usually proved in any elementary text on linear algebra.

The following statements are equivalent:

\(\mathbf{A}\) is nonsingular.

\((\mathbf{A}^{-1})^{-1} = \mathbf{A}\).

\(\mathbf{A}\mathbf{x}=\boldsymbol{0}\) implies that \(\mathbf{x}=\boldsymbol{0}\).

\(\mathbf{A}\mathbf{x}=\mathbf{b}\) has a unique solution, \(\mathbf{x}=\mathbf{A}^{-1}\mathbf{b}\), for any \(n\)-vector \(\mathbf{b}\).

## Exercises#

✍ In racquetball, the winner of a rally serves the next rally. Generally, the server has an advantage. Suppose that when Ashley and Barbara are playing racquetball, Ashley wins 60% of the rallies she serves and Barbara wins 70% of the rallies she serves. If \(\mathbf{x}\in\mathbb{R}^2\) is such that \(x_1\) is the probability that Ashley serves first and \(x_2=1-x_1\) is the probability that Barbara serves first, define a matrix \(\mathbf{A}\) such that \(\mathbf{A}\mathbf{x}\) is a vector of the probabilities that Ashley and Barbara each serve the second rally. What is the meaning of \(\mathbf{A}^{10}\mathbf{x}\)?

✍ Suppose we have lists of \(n\) terms and \(m\) documents. We can define an \(m\times n\) matrix \(\mathbf{A}\) such that \(A_{ij}=1\) if term \(j\) appears in document \(i\), and \(A_{ij}=0\) otherwise. Now suppose that the term list is

"numerical", "analysis", "more", "cool", "accounting"

and that \(\mathbf{x} = \begin{bmatrix} 1 & 1 & 0 & 1 & 0 \end{bmatrix}^T\). Give an interpretation of the product \(\mathbf{A}\mathbf{x}\).

✍ Let

\[\begin{split}\mathbf{A} = \begin{bmatrix} 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}.\end{split}\]Show that \(\mathbf{A}^n=0\) when \(n\ge 4\).

✍ Find two matrices \(\mathbf{A}\) and \(\mathbf{B}\), neither of which is the zero matrix, such that \(\mathbf{A}\mathbf{B}=\boldsymbol{0}\).

✍ Prove that when \(\mathbf{A} \mathbf{B}\) is defined, \(\mathbf{B}^T\mathbf{A}^T\) is defined too, and use Equation (2) to show that \((\mathbf{A}\mathbf{B})^T=\mathbf{B}^T\mathbf{A}^T\).

✍ Show that if \(\mathbf{A}\) is invertible, then \((\mathbf{A}^T)^{-1}=(\mathbf{A}^{-1})^T\). (This matrix is often just written as \(\mathbf{A}^{-T}\).)

✍ Prove true, or give a counterexample: The product of upper triangular square matrices is upper triangular.

- 1
The conjugate of a complex number is found by replacing all references to the imaginary unit \(i\) by \(-i\). We do not use complex numbers until the second half of the book.