Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Economics

3 Linear Algebra and Matrices

National Graduate Institute for Policy Studies (GRIPS)

The previous chapter was relatively abstract but it sets us up nicely to study the kinds of practical problems from linear algebra that we encounter in statistics and econometrics. This chapter treats many of the core problems in linear algebra, frequently relating them back to our analysis of vectors and linear maps in chapter 2.

3.1Matrices and Linear Equations

Matrices provide a convenient way to organize data and algebraic operations. Let’s start with definitions.

3.1.1Basic Definitions

A N×KN \times K matrix is a rectangular array A\boldA of real numbers with NN rows and KK columns, written in the following way:

A=(a11a12⋯a1Ka21a22⋯a2K⋮⋮⋮aN1aN2⋯aNK)\boldA = \left( \begin{array}{cccc} a_{11} & a_{12} & \cdots & a_{1K} \\ a_{21} & a_{22} & \cdots & a_{2K} \\ \vdots & \vdots & & \vdots \\ a_{N1} & a_{N2} & \cdots & a_{NK} \end{array} \right)

The symbol anka_{nk} stands for the element in the nnth row of the kkth column. Often these elements represent coefficients in a system of linear equations, such as

a11x1+a12x2+⋯+a1KxK=b1⋮aN1x1+aN2x2+⋯+aNKxK=bN\begin{array}{c} a_{11} x_1 + a_{12} x_2 + \cdots + a_{1K} x_K = b_1 \\ \vdots \\ a_{N1} x_1 + a_{N2} x_2 + \cdots + a_{NK} x_K = b_N \end{array}

For obvious reasons, A\boldA is also called a vector if either N=1N = 1 or K=1K = 1. In the former case, A\boldA is called a row vector, while in the latter case it is called a column vector. When convenient, we will use the notation row⁡nA\row_n \boldA to refer to the nnth row of A\boldA, and col⁡kA\col_k \boldA to refer to its kkth column.

We extend the notation 0\boldzero and 1\boldone from vectors to matrices, in the sense that these symbols will also represent matrices with all elements equal to zero and one respectively. Dimensions will be stated explicitly or clear from context.

If A\boldA is N×KN \times K and N=KN = K, then A\boldA is called square. For an N×NN \times N matrix A\boldA, the NN elements of the form anna_{nn} for n=1,…,Nn=1,\ldots,N are called the principal diagonal:

(a11a12⋯a1Na21a22⋯a2N⋮⋮⋮aN1aN2⋯aNN)\left( \begin{array}{cccc} \red{a_{11}} & a_{12} & \cdots & a_{1N} \\ a_{21} & \red{a_{22}} & \cdots & a_{2N} \\ \vdots & \vdots & & \vdots \\ a_{N1} & a_{N2} & \cdots & \red{a_{NN}} \\ \end{array} \right)

The unique N×NN \times N matrix with ones on the principle diagonal and zeros elsewhere is called the identity matrix, and denoted by I\boldI:

I:=(10⋯001⋯0⋮⋮⋮00⋯1)\boldI := \left( \begin{array}{cccc} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & & \vdots \\ 0 & 0 & \cdots & 1 \\ \end{array} \right)

Note that col⁡nI=en\col_n \boldI = \bolde_n, the nnth canonical basis vector in RN\RR^N.

Just as was the case for vectors, a number of algebraic operations are defined for matrices. The first two, scalar multiplication and addition, are immediate generalizations of the vector case: For γ∈R\gamma \in \RR, we let

γ(a11a12⋯a1Ka21a22⋯a2K⋮⋮⋮aN1aN2⋯aNK):=(γa11γa12⋯γa1Kγa21γa22⋯γa2K⋮⋮⋮γaN1γaN2⋯γaNK)\gamma \left( \begin{array}{cccc} a_{11} & a_{12} & \cdots & a_{1K} \\ a_{21} & a_{22} & \cdots & a_{2K} \\ \vdots & \vdots & & \vdots \\ a_{N1} & a_{N2} & \cdots & a_{NK} \\ \end{array} \right) := \left( \begin{array}{cccc} \gamma a_{11} & \gamma a_{12} & \cdots & \gamma a_{1K} \\ \gamma a_{21} & \gamma a_{22} & \cdots & \gamma a_{2K} \\ \vdots & \vdots & & \vdots \\ \gamma a_{N1} & \gamma a_{N2} & \cdots & \gamma a_{NK} \\ \end{array} \right)

while

(a11⋯a1Ka21⋯a2K⋮⋮⋮aN1⋯aNK)+(b11⋯b1Kb21⋯b2K⋮⋮⋮bN1⋯bNK):=(a11+b11⋯a1K+b1Ka21+b21⋯a2K+b2K⋮⋮⋮aN1+bN1⋯aNK+bNK)\left( \begin{array}{ccc} a_{11} & \cdots & a_{1K} \\ a_{21} & \cdots & a_{2K} \\ \vdots & \vdots & \vdots \\ a_{N1} & \cdots & a_{NK} \\ \end{array} \right) + \left( \begin{array}{ccc} b_{11} & \cdots & b_{1K} \\ b_{21} & \cdots & b_{2K} \\ \vdots & \vdots & \vdots \\ b_{N1} & \cdots & b_{NK} \\ \end{array} \right) := \left( \begin{array}{ccc} a_{11} + b_{11} & \cdots & a_{1K} + b_{1K} \\ a_{21} + b_{21} & \cdots & a_{2K} + b_{2K} \\ \vdots & \vdots & \vdots \\ a_{N1} + b_{N1} & \cdots & a_{NK} + b_{NK} \\ \end{array} \right)

Addition is only defined for matrices that have identical shape.

The matrix product C=AB\boldC = \boldA \boldB of matrices A\boldA and B\boldB is formed by taking as its i,ji,jth element the inner product of the iith row of A\boldA and the jjth column of B\boldB. That is,

cij=⟨row⁡iA, col⁡jB⟩=∑k=1Kaikbkjc_{ij} = \inner{\row_i \boldA,\, \col_j \boldB} = \sum_{k=1}^K a_{ik} b_{kj}

Here’s the picture for i=j=1i=j=1:

(a11⋯a1Ka21⋯a2K⋮⋮⋮aN1⋯aNK)(b11⋯b1Jb21⋯b2J⋮⋮⋮bK1⋯bKJ)=(c11⋯c1Jc21⋯c2J⋮⋮⋮cN1⋯cNJ)\left( \begin{array}{ccc} \red{a_{11}} & \red{\cdots} & \red{a_{1K}} \\ a_{21} & \cdots & a_{2K} \\ \vdots & \vdots & \vdots \\ a_{N1} & \cdots & a_{NK} \\ \end{array} \right) \left( \begin{array}{ccc} \red{b_{11}} & \cdots & b_{1J} \\ \red{b_{21}} & \cdots & b_{2J} \\ \red{\vdots} & \vdots & \vdots \\ \red{b_{K1}} & \cdots & b_{KJ} \\ \end{array} \right) = \left( \begin{array}{ccc} \red{c_{11}} & \cdots & c_{1J} \\ c_{21} & \cdots & c_{2J} \\ \vdots & \vdots & \vdots \\ c_{N1} & \cdots & c_{NJ} \\ \end{array} \right)

Since inner products are only defined for vectors of equal length, we need the length of the rows of A\boldA to be equal to the length of the columns of B\boldB. In other words, if A\boldA is N×KN \times K and B\boldB is J×MJ \times M, then we require K=JK = J. The resulting matrix AB\boldA \boldB is N×MN \times M. Here’s the rule to remember:

A is N×K and B is K×M    ⟹    AB is N×M\boldA \text{ is } N \times K \text{ and } \boldB \text{ is } K \times M \; \implies \; \boldA \boldB \text{ is } N \times M

Matrix multiplication is not commutative: AB\boldA \boldB and BA\boldB \boldA are not in general equal. In most other ways it behaves like ordinary multiplication:

Here and below we use the word conformable to indicate dimensions are such that the operation in question makes sense. For example, two matrices are conformable for addition if they have the same number of rows and columns.

The kkth power of a square matrix A\boldA is defined as

Ak:=A⋯A⏟k terms\boldA^k := \underbrace{\boldA \cdots \boldA}_{k \text{ terms}}

If B\boldB is such that B2=A\boldB^2 = \boldA, then B\boldB is called the square root of A\boldA and written A\sqrt{\boldA}.

Before going further, let’s state the fundamental connection between matrix multiplication and the more elementary notion of linear combinations of vectors, as introduced in Section 2.1.2: Given N×KN \times K matrix A\boldA and K×1K \times 1 column vector x\boldx, the product Ax\boldA \boldx is an N×1N \times 1 column vector formed as a linear combination of the columns of A\boldA, with scalars x1,…,xKx_1, \ldots, x_K. In symbols,

Ax=(a11a12⋯a1Ka21a22⋯a2K⋮⋮⋮aN1aN2⋯aNK)(x1x2⋮xK)=x1(a11a21⋮aN1)+x2(a12a22⋮aN2)+⋯+xK(a1Ka2K⋮aNK)=∑k=1Kxkcol⁡kA\begin{aligned} \boldA \boldx & = \left( \begin{array}{cccc} a_{11} & a_{12} & \cdots & a_{1K} \\ a_{21} & a_{22} & \cdots & a_{2K} \\ \vdots & \vdots & & \vdots \\ a_{N1} & a_{N2} & \cdots & a_{NK} \end{array} \right) \left( \begin{array}{c} x_1 \\ x_2 \\ \vdots \\ x_K \end{array} \right) \\ & = x_1 \left( \begin{array}{c} a_{11} \\ a_{21} \\ \vdots \\ a_{N1} \end{array} \right) + x_2 \left( \begin{array}{c} a_{12} \\ a_{22} \\ \vdots \\ a_{N2} \end{array} \right) + \cdots + x_K \left( \begin{array}{c} a_{1K} \\ a_{2K} \\ \vdots \\ a_{NK} \end{array} \right) \\ & = \sum_{k=1}^K x_k \col_k \boldA \end{aligned}

3.1.2Matrices as Maps

One of the most useful ways to think about matrices is as maps from one vector space to another. In particular, an N×KN \times K matrix A\boldA can be thought of as a map sending a vector x∈RK\boldx \in \RR^K into a new vector y=Ax\boldy = \boldA \boldx in RN\RR^N. As the next theorem shows, these maps are always linear. In fact, they are the only linear functions. In other words, the set of linear functions from RK\RR^K to RN\RR^N and the set of N×KN \times K matrices are in one-to-one correspondence:

When we consider the problem of solving a system of linear equations such as Ax=b\boldA \boldx = \boldb, the first issue we need to concern ourselves with is existence. Can we find an x\boldx that satisfies this equation, for any given b\boldb? A bit of thought will convince you that this is the same question as: Is the corresponding linear map Tx=AxT\boldx = \boldA \boldx an onto function? (See Section 15.2 for the definition.) Equivalently, is rng⁡T\range T equal to all of RN\RR^N?

The range of TT is all vectors of the form Tx=AxT\boldx = \boldA \boldx where x\boldx varies over RK\RR^K. We just saw in Section 3.1.1 that, for any x∈RK\boldx \in \RR^K, we have Ax=∑k=1Kxkcol⁡kA\boldA \boldx = \sum_{k=1}^K x_k \col_k \boldA. It follows that rng⁡T\range T is equal to the column space of A\boldA, which is by definition the span of the columns of A\boldA. We represent it by the symbol

colspace⁡A:=span⁡{col⁡1A,…,col⁡KA}\colspace \boldA := \Span \{ \col_1 \boldA, \ldots, \col_K \boldA \}

To summarize the preceding discussion, we have

colspace⁡A=rng⁡T={Ax:x∈RK}\colspace \boldA = \range T = \setntn{\boldA \boldx}{ \boldx \in \RR^K}

How large is the column space of a given matrix? To answer that question, we have to say what "large" means. In the context of linear algebra, size of subspaces is usually measured by dimension. The dimension of colspace⁡A\colspace \boldA is known as the rank of A\boldA. That is,

rank⁡A:=dim⁡colspace⁡A\rank \boldA := \dim \colspace \boldA

A\boldA is said to have full column rank if rank⁡A\rank \boldA is equal to KK, the number of its columns. The reason we say “full” rank here is that, by definition, colspace⁡A\colspace \boldA is the span of KK vectors. Hence, by part (i) of theorem 2.1.6, we must have dim⁡colspace⁡A⩽K\dim \colspace \boldA \leq K. In other words, the rank of A\boldA is less than or equal to KK. A\boldA is said to have full column rank when this maximum is achieved.

When is this maximum achieved? By part (ii) of theorem 2.1.6, this will be the case precisely when the columns of A\boldA are linearly independent. Let’s state this as a fact:

The last equivalence follows from theorem 2.1.1.

3.1.3Square Matrices and Invertibility

Perhaps the most common problem in linear algebra is solving systems of linear equations. A generic representation is Ax=b\boldA \boldx = \boldb, where x\boldx contains the unknowns and A\boldA and b\boldb are given. There are a variety of scenarios depending on the properties of A\boldA. For now let’s consider the case where A\boldA is N×NN \times N, and seek conditions on A\boldA under which, for every b∈RN\boldb \in \RR^N, there exists exactly one x∈RN\boldx \in \RR^N such that Ax=b\boldA \boldx = \boldb.

The best way to understand this problem is as follows. Let TT be the linear map Tx=AxT \boldx = \boldA \boldx. The question we are asking here is: When does each point b∈RN\boldb \in \RR^N have one and only one preimage under TT? In other words, when is TT a bijection?

To answer this question, we can refer back to the discussion in Section 2.1.7. We saw there that linear bijections are called nonsingular functions, and we discussed a number of equivalences for this property. The next fact replicates these equivalences in the language of matrices.

These results can all be verified using theorem 2.1.7 by checking the corresponding implications for Tx=AxT \boldx = \boldA \boldx. For example, it’s easy to see that if en\bolde_n is the nnth canonical basis vector of RN\RR^N, then

Ten=Aen=col⁡nAT\bolde_n = \boldA \bolde_n = \col_n \boldA

and hence the condition of linear independence of {Te1,…,TeN}\{T\bolde_1, \ldots, T\bolde_N\} in theorem 2.1.7 translates to linear independence of the columns of A\boldA.

Following common usage, if any of the equivalent conditions in fact 3.1.3 are true we will call not just the map TT but also the underlying matrix A\boldA nonsingular. If any one—and hence all—of these conditions fail, then A\boldA is called singular.

Any bijection has an inverse (see Section 15.2). In fact any nonsingular map TT has a nonsingular inverse T−1T^{-1} (see fact 2.1.9). In the present setting, where TT is generated by a matrix A\boldA, the inverse T−1T^{-1} is also associated with a matrix, called the inverse of A\boldA. The next theorem gives details:

For this reason, nonsingular matrices are also referred to as invertible. The proof of theorem 3.1.2 is a solved exercise (ex. 3.5.5).

As stated in the next fact, to show that A\boldA is invertible and B\boldB is the inverse of A\boldA, it suffices to show that B\boldB is either a left inverse, in the sense that BA=I\boldB \boldA = \boldI, or a right inverse, in the sense that AB=I\boldA \boldB = \boldI. A proof is given in Section 3.1.4.

The next fact collects more useful results about inverse matrices.

The relation (AB)−1=B−1A−1(\boldA \boldB)^{-1} = \boldB^{-1} \boldA^{-1} is just a special case of the analogous rule for inversion of bijections (see fact 15.2.1). But you can also prove the equality directly by confirming that B−1A−1\boldB^{-1} \boldA^{-1} is a right inverse (or left inverse) of AB\boldA \boldB.

3.1.4Determinants

To each square matrix A\boldA, we can associate a unique number det⁡A\det \boldA called the determinant of A\boldA. To define it, let S(N)S(N) be the set of all bijections from {1,…,N}\{1, \ldots, N\} to itself. For π∈S(N)\pi \in S(N) we define the signature of π\pi as

sgn⁡(π):=∏m<nπ(m)−π(n)m−n\sgn(\pi) := \prod_{m < n} \frac{\pi(m) - \pi(n)}{m - n}

The determinant of N×NN \times N matrix A\boldA is then given as

det⁡A:=∑π∈S(N)sgn⁡(π)∏n=1Naπ(n)n\det \boldA := \sum_{\pi \in S(N)} \sgn(\pi) \prod_{n=1}^N a_{\pi(n) n}

We won’t concern ourselves with the details of this definition. For now it’s enough to know the following facts:

In the 2×22 \times 2 case one can show that the determinant satisfies

det⁡(abcd)=ad−bc\det \left( \begin{array}{cc} a & b \\ c & d \\ \end{array} \right) = ad - bc

As an example of how these results can be useful, let’s go back and prove fact 3.1.4. Fix square matrix A\boldA and suppose that a right inverse B\boldB exists, in the sense that AB=I\boldA \boldB = \boldI. This equality implies that both A\boldA and B\boldB are nonsingular, since applying det⁡\det to both sides of AB=I\boldA \boldB = \boldI and using the rules in fact 3.1.6 gives det⁡(A)det⁡(B)=1\det(\boldA) \det(\boldB) = 1. It follows that both det⁡A\det \boldA and det⁡B\det \boldB are nonzero. Hence both matrices are nonsingular.

To show that B\boldB is the inverse of A\boldA, we just need to check that, in addition to AB=I\boldA \boldB = \boldI, we have BA=I\boldB \boldA = \boldI. To obtain the latter equality from the former, premultiply the former by B\boldB to get BAB=B\boldB \boldA \boldB = \boldB and then postmultiply by B−1\boldB^{-1} to get BA=I\boldB \boldA = \boldI. The proof for the left inverse case is similar.

3.2Properties of Matrices

Let’s look at some special kinds of matrices and their role in linear algebra.

3.2.1Diagonal and Triangular Matrices

A square matrix is called

For example, if we define

L:=(100250361)andU:=(123056001)\boldL := \left( \begin{array}{ccc} 1 & 0 & 0 \\ 2 & 5 & 0 \\ 3 & 6 & 1 \end{array} \right) \quad \text{and} \quad \boldU := \left( \begin{array}{ccc} 1 & 2 & 3 \\ 0 & 5 & 6 \\ 0 & 0 & 1 \end{array} \right)

then L\boldL and U\boldU are lower and upper triangular respectively. The great advantage of triangular matrices is that the associated linear equations are simple to solve using either forward or backward substitution. For example, with the system

(100250361)(x1x2x3)=(x12x1+5x23x1+6x2+x3)=(b1b2b3)\left( \begin{array}{ccc} 1 & 0 & 0 \\ 2 & 5 & 0 \\ 3 & 6 & 1 \end{array} \right) \left( \begin{array}{ccc} x_1 \\ x_2 \\ x_3 \end{array} \right) = \left( \begin{array}{c} x_1 \\ 2x_1 + 5x_2 \\ 3x_1 + 6x_2 + x_3 \end{array} \right) = \left( \begin{array}{c} b_1 \\ b_2 \\ b_3 \\ \end{array} \right)

the top equation involves only x1x_1, so we can solve for its value directly. Plugging this value into the second equation, we can solve for x2x_2 and so on.

An even better situation arises when our matrix is both upper and lower triangular. These are the diagonal matrices. In other words, a square matrix A\boldA is diagonal if all entries off the principal diagonal are zero. For example, the identity matrix is diagonal.

The following notation is often used to define diagonal matrices:

diag⁡(d1,…,dN):=(d10⋯00d2⋯0⋮⋮⋮00⋯dN)\diag(d_1, \ldots, d_N) := \left( \begin{array}{cccc} d_1 & 0 & \cdots & 0 \\ 0 & d_2 & \cdots & 0 \\ \vdots & \vdots & & \vdots \\ 0 & 0 & \cdots & d_N \\ \end{array} \right)

With diagonal matrices it is trivial to compute powers, roots, inverses and products:

You can check parts (i) and (ii) directly. The other claims follow from (i) and (ii).

3.2.2Trace, Transpose, and Symmetry

The trace of an N×NN \times N matrix A\boldA is the sum of the elements on its principal diagonal:

trace⁡A=∑n=1Nann\trace \boldA = \sum_{n=1}^N a_{nn}

The transpose of N×KN \times K matrix A\boldA is a K×NK \times N matrix A⊺\boldA^\T such that col⁡n(A⊺)=row⁡nA\col_n(\boldA^\T) = \row_n \boldA. For example,

A:=(104020503060)  ⟹  A⊺=(102030405060)\boldA := \left( \begin{array}{cc} 10 & 40 \\ 20 & 50 \\ 30 & 60 \end{array} \right) \quad \implies \quad \boldA^\T = \left( \begin{array}{ccc} 10 & 20 & 30 \\ 40 & 50 & 60 \end{array} \right)

and

B:=(135246)  ⟹  B⊺=(123456)\boldB := \left( \begin{array}{ccc} 1 & 3 & 5 \\ 2 & 4 & 6 \\ \end{array} \right) \quad \implies \quad \boldB^\T = \left( \begin{array}{cc} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{array} \right)

A square matrix A\boldA is called symmetric if A⊺=A\boldA^\T = \boldA, or, equivalently, ank=akna_{nk} = a_{kn} for every kk and nn. Note that A⊺A\boldA^\T \boldA and AA⊺\boldA \boldA^\T are always well-defined and symmetric.

Note that if a\bolda and b\boldb are N×1N \times 1 vectors, then the matrix product a⊺b=b⊺a\bolda^\T \boldb = \boldb^\T \bolda is equal to ∑n=1Nanbn\sum_{n=1}^N a_n b_n, which is the same as the inner product ⟨a,b⟩\inner{\bolda, \boldb}. In what follows we’ll often work with column vectors and use matrix product rather than inner product notation.

3.2.3Eigenvalues and Eigenvectors

Let A\boldA be N×NN \times N. As in Section 3.1.2, think of A\boldA as a linear map, so that Ax\boldA \boldx is the image of x\boldx under A\boldA. In general, A\boldA will map x\boldx to some arbitrary new location but sometimes x\boldx will only be scaled. That is,

Ax=λx\boldA \boldx = \lambda \boldx

for some scalar λ\lambda. If x\boldx and λ\lambda satisfy (3.6) and x\boldx is nonzero, then x\boldx is called an eigenvector of A\boldA, λ\lambda is called an eigenvalue, and (x,λ)(\boldx, \lambda) is called an eigenpair.

Consider now the matrix

R:=(0−110)\boldR := \left( \begin{array}{cc} 0 & -1 \\ 1 & 0 \\ \end{array} \right)

that rotates any point counterclockwise by 90∘90^{\circ}, as shown in figure 3.1. This rotation causes the scaling in (3.6) to fail for any λ∈R\lambda \in \RR and nonzero x∈R2\boldx \in \RR^2. If, however, we admit the possibility that λ\lambda and the elements of x\boldx can be complex, then (3.6) can hold. For example, direct calculation confirms that λ=i\lambda = i and x=(1,−i)⊺\boldx = (1, -i)^\T is an eigenpair for R\boldR. It turns out that contemplation of complex eigenpairs is useful. Here eigenpairs are taken to be complex-valued unless explicitly stated to be real.

\boldR rotates points by 90^{\circ}

Figure 3.1:R\boldR rotates points by 90∘90^{\circ}

Here I\boldI is the N×NN \times N identity. Exercise 3.5.17 asks you to confirm this important fact. For the 2×22 \times 2 matrix in (3.4), the rule for the 2×22 \times 2 determinant in (3.4), fact 3.2.6 and a little bit of algebra imply that its eigenvalues are given by the two roots of the polynomial expression

λ2−(a+d)λ+(ad−bc)=0\lambda^2 - (a + d) \lambda + (ad - bc) = 0

More generally, given any N×NN \times N matrix A\boldA, it can be shown via the fundamental theorem of algebra that there exist complex numbers λ1,…,λN\lambda_1, \ldots, \lambda_N, not necessarily distinct, such that

det⁡(A−λI)=∏n=1N(λn−λ)\det(\boldA - \lambda \boldI) = \prod_{n=1}^N (\lambda_n - \lambda)

It is clear that each λn\lambda_n satisfies det⁡(A−λnI)=0\det(\boldA - \lambda_n \boldI) = 0 and hence is an eigenvalue of A\boldA. In particular, λ1,…,λN\lambda_1, \ldots, \lambda_N is the set of eigenvalues of A\boldA, although it’s worth repeating that these numbers are not necessarily distinct.

It is immediate from (i) that A\boldA is nonsingular   ⟺  \iff all its eigenvalues are nonzero.

3.2.4Quadratic Forms

In statistics and econometrics we often encounter quadratic expressions. In general, given symmetric N×NN \times N matrix A\boldA, the quadratic function or quadratic form on RN\RR^N associated with A\boldA is the map QQ defined by

Q(x):=x⊺Ax=∑j=1N∑i=1NaijxixjQ(\boldx) := \boldx^\T \boldA \boldx = \sum_{j=1}^N \sum_{i=1}^N a_{ij} x_i x_j

To give a simple illustration, let N=2N = 2 and let A\boldA be the identity matrix I\boldI. In this case,

Q(x)=∥x∥2=x12+x22Q(\boldx) = \| \boldx \|^2 = x_1^2 + x_2^2

A 3D graph of this function is shown in figure 3.2.

Quadratic function Q(\boldx) = x_1^2 + x_2^2

Figure 3.2:Quadratic function Q(x)=x12+x22Q(\boldx) = x_1^2 + x_2^2

One thing you’ll notice about this function is that its graph lies everywhere above zero, or Q(x)⩾0Q(\boldx) \geq 0. In fact we know that ∥x∥2\| \boldx \|^2 is nonnegative and will be zero only when x=0\boldx = \boldzero. Hence the graph touches zero only at the point x=0\boldx = \boldzero. Many other choices of A\boldA yield a quadratic form with this property. Such A\boldA are said to be positive definite. More generally, an N×NN \times N symmetric matrix A\boldA is called

If A\boldA fits none of these categories, then A\boldA is called indefinite. Figure 3.3 shows the graph of a negative definite quadratic function. Now the function is hill-shaped, and 0\boldzero is the unique global maximum. Figure 3.4 shows an indefinite form.

Quadratic function Q(\boldx) = -x_1^2 - x_2^2

Figure 3.3:Quadratic function Q(x)=−x12−x22Q(\boldx) = -x_1^2 - x_2^2

Quadratic function Q(\boldx) = x_1^2/2 + 8 x_1 x_2 + x_2^2/2

Figure 3.4:Quadratic function Q(x)=x12/2+8x1x2+x22/2Q(\boldx) = x_1^2/2 + 8 x_1 x_2 + x_2^2/2

The easiest case for detecting definiteness is when the matrix A\boldA is diagonal, since

A=diag⁡(d1,…,dN)impliesQ(x)=d1x12+⋯+dNxN2\boldA = \diag(d_1, \ldots, d_N) \quad \text{implies} \quad Q(\boldx) = d_1 x_1^2 + \cdots + d_N x_N^2

From the right-hand expression we see that a diagonal matrix is positive definite if and only if all diagonal elements are positive. Analogous statements are true for nonnegative, nonpositive and negative definite matrices. The next fact generalizes this idea and is proved in Section 3.3.4.

It follows from fact 3.2.8 that

Finally, here’s a necessary (but not sufficient) condition for each kind of definiteness.

3.3Projection and Decomposition

This section collects some essential results on projection and decomposition of matrices. The projection material takes our abstract projection theory from Section 2.2 and translates it into the more concrete language of matrices.

3.3.1Projection Matrices

As stated in theorem 2.2.2, given any subspace SS, the corresponding projection P=proj⁡S\boldP = \proj S is a linear map from RN\RR^N to RN\RR^N. In view of theorem 3.1.1, it follows that there exists an N×NN \times N matrix P^\hat \boldP such that Px=P^x\boldP \boldx = \hat \boldP \boldx for all x∈RN\boldx \in \RR^N. In fact we’ve anticipated this in the notation P\boldP, and from now on P\boldP will also represent the corresponding matrix. But what does this matrix look like?

This result generalizes fact 2.2.6, which pertains to projection onto the span of an orthonormal basis. The expression in (3.8) is more complex, but at the same time it applies to any basis, orthonormal or otherwise. We further explore the connection between the two results in Section 3.3.3. For the proof of theorem 3.3.1 see exercise 3.5.30 and its solution.

The construction of P\boldP in (3.8) implicitly assumes that B⊺B\boldB^\T \boldB is nonsingular. This is justified because B\boldB has full column rank (see ex. 3.5.28). As usual, we let M=I−P\boldM = \boldI - \boldP denote the residual projection.

For example, it’s easy to see that Mc\boldM_c in (3.10) maps 1\boldone to 0\boldzero. Exercise 3.5.31 asks you to prove fact 3.3.1.

A square matrix A\boldA is called idempotent if AA=A\boldA \boldA = \boldA.

Idempotence of P\boldP and M\boldM can be checked by direct calculation. A better understanding is obtained by reflecting on the fact that projecting onto a subspace twice is the same as projecting once. After one projection the vector is already in the subspace. See fact 2.2.8.

For orthogonal projections, we can say more:

To see why rank⁡P=dim⁡S\rank \boldP = \dim S, recall that the rank of a linear map is the dimension of its range. When P=proj⁡S\boldP = \proj S, the range of P\boldP is exactly SS.

To show that trace⁡P=dim⁡S\trace \boldP = \dim S also holds, we can appeal to fact 3.3.3. There’s also a nice direct proof. See exercise 3.5.27 and its solution. Once we know that trace⁡P=dim⁡S\trace\boldP = \dim S, it’s clear that trace⁡M=N−dim⁡S\trace\boldM = N - \dim S because

trace⁡M=trace⁡(I−P)=trace⁡I−trace⁡P=N−dim⁡S\trace\boldM = \trace(\boldI - \boldP) = \trace \boldI - \trace\boldP = N - \dim S

3.3.2Overdetermined Systems of Equations

In Section 3.1.3 we talked about solving equations of the form Ax=b\boldA \boldx = \boldb when A\boldA is square. In statistics and econometrics, we often work the case where A\boldA is N×KN \times K and K⩽NK \leq N. When the inequality is strict, the system of equations is said to be overdetermined.

Consider the problem of whether or not there exists a vector x\boldx satisfying Ax=b\boldA \boldx = \boldb in this setting. Intuitively, when the number of equations is larger than the number of unknowns (N>KN > K) we may not be able to find an x\boldx that satisfies all NN equations. There are several equivalent ways to formalize this intuition. The linear map T ⁣:RK→RNT \colon \RR^K \to \RR^N corresponding to A\boldA is Tx=AxT\boldx = \boldA \boldx (see Section 3.1.2). We know the following statements to be equivalent:

  1. there exists an x∈RK\boldx \in \RR^K with Ax=b\boldA \boldx = \boldb.

  2. b∈colspace⁡A\boldb \in \colspace \boldA.

  3. b∈rng⁡T\boldb \in \range T.

We also know from theorem 2.1.8 that when K<NK < N, the function TT cannot be onto, and hence it’s possible that b\boldb lies outside the range of TT.

In fact we can say more than this. When K<NK < N, the scenario b∈colspace⁡A\boldb \in \colspace \boldA is in some sense very rare. The reason is that the dimension of colspace⁡A\colspace \boldA, which is precisely the rank of A\boldA, is less than or equal to KK (see Section 3.1.2) and hence strictly less than NN. There is a sense in which KK-dimensional subspaces of RN\RR^N are negligible, and hence the “chance” of b\boldb happening to lie in this subspace is tiny.[1]

As a result the standard approach is to admit that an exact solution may not exist, and to focus instead on finding a x∈RK\boldx \in \RR^K such that Ax\boldA \boldx is as close to b\boldb as possible. It’s natural that "close to" is defined in terms of ordinary Euclidean norm, which leads us to the minimization problem

min⁡x∈RK∥b−Ax∥\min_{\boldx \in \RR^K} \| \boldb - \boldA \boldx \|

This is called a least squares problem because solving (3.11) is the same as minimizing ∥b−Ax∥2\| \boldb - \boldA \boldx \|^2 with respect to x\boldx, and the squared norm is, by definition, a sum of squares. Assuming as before that A\boldA is N×KN \times K with K⩽NK \leq N and b\boldb is N×1N \times 1, we can use the orthogonal projection theorem to solve (3.11) as follows:

In the expression for x^\hboldx in (3.12), the matrix (A⊺A)−1A⊺(\boldA^\T \boldA)^{-1} \boldA^\T is called the pseudoinverse of A\boldA. If K=NK = N—that is, if A\boldA is in fact square—then, under our full rank assumption, the pseudoinverse reduces to the inverse A−1\boldA^{-1}, and the least squares solution x^\hboldx in (3.12) reduces to the expression given in (3.3).

What happens if we drop the assumption that the columns of A\boldA are linearly independent? The set colspace⁡A\colspace \boldA is still a linear subspace, and the orthogonal projection theorem still gives us a closest point Pb\boldP \boldb to b\boldb in colspace⁡A\colspace \boldA. Since Pb∈colspace⁡A\boldP \boldb \in \colspace \boldA, there still exists a vector x^\hboldx such that Pb=Ax^\boldP \boldb = \boldA \hboldx. The problem is that now there exists an infinity of such vectors. Exercise 3.5.34 asks you to prove this.

3.3.3QR Decomposition

The QR decomposition of a given matrix A\boldA is a product of the form QR\boldQ \boldR, where the first matrix has orthonormal columns and the second is upper triangular. This factorization has many applications, including least squares problems and the computation of eigenvalues. The decomposition is based on Gram–Schmidt orthogonalization.

Given the decomposition A=QR\boldA = \boldQ \boldR, the least squares solution x^\hboldx defined in (3.12) can also be written as x^=R−1Q⊺b\hboldx = \boldR^{-1} \boldQ^\T \boldb (ex. 3.5.32). Premultiplying by R\boldR converts this expression to Rx^=Q⊺b\boldR \hboldx = \boldQ^\T \boldb, which is easy to solve because R\boldR is triangular (see Section 3.2.1).

3.3.4Diagonalization and Spectral Theory

One important concept in dynamic systems and related fields is topological conjugacy. If f ⁣:A→Af \colon A \to A and g ⁣:B→Bg \colon B \to B, then gg is said to be topologically conjugate to ff whenever there exists a continuous bijection τ ⁣:B→A\tau \colon B \to A such that f=τ∘g∘τ−1f = \tau \circ g \circ \tau^{-1}. The idea is that the action of ff can be replicated by transporting a point into the domain of gg, applying gg, and then transporting it back. This can be beneficial if gg is somehow simpler than ff.

In the case of linear maps—that is, matrices—it is natural to study conjugacy in a setting where the bijection is also required to be linear. In linear algebra this is called similarity. In particular, a square matrix A\boldA is said to be similar to another matrix B\boldB if there exists an invertible matrix P\boldP such that A=PBP−1\boldA = \boldP \boldB \boldP^{-1}. Figure 3.5 shows the conjugate relationship of the two matrices when thought of as maps.

\boldA is similar to \boldB

Figure 3.5:A\boldA is similar to B\boldB

The next fact is a fun exercise.

As discussed above, similarity of A\boldA to a given matrix B\boldB is most useful when B\boldB is somehow simpler than A\boldA, or more amenable to a given operation. The simplest kind of matrices we work with are diagonal matrices, so similarity to a diagonal matrix is particularly desirable. If A\boldA is similar to a diagonal matrix, then A\boldA is called diagonalizable.

If A=PΛP−1\boldA = \boldP \boldLambda \boldP^{-1} where Λ\boldLambda is diagonal, it follows immediately that the elements on the principal diagonal of Λ\boldLambda are the eigenvalues of A\boldA, and that the columns of P\boldP are eigenvectors. To see this, observe that A=PΛP−1\boldA = \boldP \boldLambda \boldP^{-1} implies AP=PΛ\boldA \boldP = \boldP \boldLambda. Equating the nnth column on each side gives Apn=λnpn\boldA \boldp_n = \lambda_n \boldp_n, where pn:=col⁡nP\boldp_n := \col_n \boldP. Finally, pn\boldp_n is not the zero vector because otherwise P\boldP would not be invertible. Let’s summarize:

But when is A\boldA diagonalizable? The only thing we need to make the expression A=PΛP−1\boldA = \boldP \boldLambda \boldP^{-1} work is for P\boldP to be invertible. This explains the next fact.

If A\boldA does have NN linearly independent eigenvectors, then we are in good shape—diagonalization is possible. But can we do any better? The matrix Λ\boldLambda cannot really be simplified, but in some cases P\boldP can be. In particular, things are even nicer if P\boldP has orthonormal columns—that is, its columns form an orthonormal set, and hence an orthonormal basis of RN\RR^N. These kinds of matrices are called orthogonal matrices. Here are some nice properties of such matrices.

The first result tells us is that if A=QΛQ−1\boldA = \boldQ \boldLambda \boldQ^{-1} and Q\boldQ has orthonormal columns, then A=QΛQ⊺\boldA = \boldQ \boldLambda \boldQ^\T. It’s easy to see from this expression that A\boldA must be symmetric, so if we hope to diagonalize with this extra orthonormal property, then we shouldn’t look beyond symmetric matrices. The following fundamental theorem tells us that this form of diagonalization is possible precisely when A\boldA is symmetric.

This is one version of the spectral decomposition theorem. See, for example, §10.3 of Jänich (1994). QΛQ⊺\boldQ \boldLambda \boldQ^\T is called the symmetric eigenvalue decomposition of A\boldA. It’s not hard to see that its action on a given N×1N \times 1 vector x\boldx can be written as

Ax=∑n=1Nλn(un⊺x)un\boldA\boldx = \sum_{n=1}^N \lambda_n (\boldu_n^\T \boldx) \boldu_n

where λn\lambda_n is the nnth eigenvalue of A\boldA and un=col⁡nQ\boldu_n = \col_n \boldQ. Compare with x=∑n=1N(un⊺x)un\boldx = \sum_{n=1}^N (\boldu_n^\T \boldx) \boldu_n, which is true by fact 2.2.3.

One nice application of the spectral theorem is a proof of fact 3.2.8, which states among other things that symmetric matrix A\boldA is positive definite if and only if its eigenvalues are all positive. Exercise 3.5.23 and its solution step you through the arguments.

Here QΛQ⊺\boldQ \boldLambda \boldQ^\T is the spectral decomposition of A\boldA. To check that QΛQ⊺\boldQ \sqrt{\boldLambda} \boldQ^\T is a square root just multiply. Λ\sqrt{\boldLambda} exists because A\boldA is nonnegative definite, and hence its eigenvalues are nonnegative (see fact 3.2.8 and fact 3.2.2).

By combining our results on spectral decomposition with the QR decomposition discussed in Section 3.3.3, we can prove the following well-known fact:

This decomposition is called the Cholesky decomposition. The proof is obtained by writing

A=QΛQ⊺=QΛΛQ⊺=(ΛQ⊺)⊺ΛQ⊺\boldA = \boldQ \boldLambda \boldQ^\T = \boldQ \sqrt{\boldLambda} \sqrt{ \boldLambda} \boldQ^\T = (\sqrt{ \boldLambda} \boldQ^\T)^\T \sqrt{ \boldLambda} \boldQ^\T

and applying the QR decomposition to ΛQ⊺\sqrt{ \boldLambda} \boldQ^\T. This allows us to write ΛQ⊺=Q~R\sqrt{ \boldLambda} \boldQ^\T = \tilde \boldQ \boldR, where R\boldR is nonsingular and upper triangular, and Q~\tilde \boldQ has orthonormal columns. Because the columns of Q~\tilde \boldQ are orthonormal,

A=(Q~R)⊺Q~R=R⊺Q~⊺Q~R=R⊺R\boldA = (\tilde \boldQ \boldR)^\T \tilde \boldQ \boldR = \boldR^\T \tilde \boldQ^\T \tilde \boldQ \boldR = \boldR^\T \boldR

Our decomposition has the properties stated in fact 3.3.10.

3.3.5Norms and Continuity

Given vector sequence {xn}\{\boldx_n\} in RK\RR^K and any point x∈RK\boldx \in \RR^K, we say that {xn}\{\boldx_n\} converges to x\boldx and write xn→x\boldx_n \to \boldx if, for any ϵ>0\epsilon > 0, there exists an N∈NN \in \NN such that ∥xn−x∥<ϵ\|\boldx_n - \boldx\| < \epsilon whenever n⩾Nn \geq N. Another way to say this is that the real-valued sequence zn:=∥xn−x∥z_n := \|\boldx_n - \boldx\| converges to zero in R\RR as n→∞n \to \infty.

For econometrics it is helpful if we extend the notion of convergence to matrices. We can do this in a parallel fashion by defining norms over matrices. The matrix norm of N×KN \times K matrix A\boldA is defined as

∥A∥:=max⁡{∥Ax∥ : x∈RK,  ∥x∥=1}\| \boldA \| := \max \left\{ \| \boldA \boldx \| \,: \, \boldx \in \RR^K, \; \| \boldx \| = 1 \right\}

In this expression there are two different norms in play: The left-hand side is a matrix norm, while on the right we have the ordinary vector norm.

Given a sequence of N×KN \times K matrices An\boldA_n and an N×KN \times K matrix A\boldA, we say that An\boldA_n converges to A\boldA if the matrix norm deviation ∥An−A∥\|\boldA_n - \boldA\| converges to zero in R\RR.

While the value in (3.15) is not particularly easy to solve for in general, the definition is entirely standard, and one can show that the matrix norm behaves like the vector norm in many ways. For example,

Compare these results with those of fact 2.1.2.

This bound is handy. For example, it tells us that if every element of A\boldA is close to zero then ∥A∥\| \boldA \| must also be close to zero.

3.3.5.1Neumann Series

Let’s look at an important result in analysis that uses matrix norms. Starting in chapter 7, we will investigate dynamic systems such as xt+1=Axt+b\boldx_{t+1} = \boldA \boldx_t + \boldb, where xt\boldx_t represents the values of some variables of interest and A\boldA and b\boldb form the parameters in the law of motion for xt\boldx_t. One question we might ask in this setting is whether or not there exists a "stationary" vector x∈RN\boldx \in \RR^N, in the sense that xt=x\boldx_t = \boldx implies xt+1=x\boldx_{t+1} = \boldx. In other words, we seek an x∈RN\boldx \in \RR^N that solves the system of equations

x=Ax+b(A is N×N and b is N×1)\boldx = \boldA \boldx + \boldb \qquad (\boldA \text{ is } N \times N \text{ and } \boldb \text{ is } N \times 1)

We can get some insight by reflecting on the scalar case x=ax+bx = a x + b. If ∣a∣<1|a| < 1, then this equation has the unique solution

xˉ=b1−a=b∑k=0∞ak\bar x = \frac{b}{1-a} = b \sum_{k=0}^{\infty} a^k

The second equality follows from elementary results on geometric series.

It turns out that a similar result is true in RN\RR^N if we replace the condition ∣a∣<1|a| < 1 with an analogous result for matrices based around the matrix norm. We begin with the Neumann series lemma, which states the following:

Here I\boldI is the identity. The equality in (3.17) means that the matrix sum ∑i=0tAi\sum_{i=0}^t \boldA^i converges to the left-hand side in matrix norm as t→∞t \to \infty. The sum is called the Neumann series associated with A\boldA. The condition in the theorem ensures that it converges. When the condition holds, (3.16) has the unique solution

xˉ=(I−A)−1b=∑i=0∞Aib\bar \boldx = (\boldI - \boldA)^{-1} \boldb = \sum_{i=0}^{\infty} \boldA^i \boldb

How to test the condition in theorem 3.3.5? The most commonly used sufficient condition involves the spectral radius of A\boldA, which is defined as

ϱ(A):=max⁡{∣λ∣:λ is an eigenvalue of A}\rho(\boldA) := \max \setntn{ |\lambda| } { \lambda \text{ is an eigenvalue of } \boldA}

In this definition, ∣λ∣|\lambda| is the modulus of the possibly complex number λ\lambda.[3]

To understand why ϱ(A)<1\rho(\boldA) < 1 is sufficient for the result in the Neumann series lemma, consider theorem 3.3.5 in this light: The claim is that ∑i=0∞Ai\sum_{i=0}^{\infty} \boldA^i is the inverse of I−A\boldI - \boldA, so ∑i=0tAi(I−A)\sum_{i=0}^t \boldA^i (\boldI - \boldA) should be close to I\boldI for large tt. Evidently

∑i=0tAi(I−A)=∑i=0tAi−∑i=0tAi+1=I−At+1\sum_{i=0}^t \boldA^i (\boldI - \boldA) = \sum_{i=0}^t \boldA^i - \sum_{i=0}^t \boldA^{i+1} = \boldI - \boldA^{t+1}

Hence, for the result to go through, we require At→0\boldA^t \to \boldzero as t→∞t \to \infty. The case where A\boldA is diagonalizable gives the clearest insight here, so let’s suppose, as in Section 3.3.4, that A=PΛP−1\boldA = \boldP \boldLambda \boldP^{-1} where Λ\boldLambda is a diagonal matrix containing the eigenvalues λ1,…,λN\lambda_1, \ldots, \lambda_N of A\boldA on its principal diagonal. As discussed in fact 3.3.5, we then have

At=P(λ1t0⋯00λ2t⋯0⋮⋮⋮00⋯λNt)P−1\boldA^t = \boldP \left( \begin{matrix} \lambda_1^t & 0 & \cdots & 0 \\ 0 & \lambda_2^t & \cdots & 0 \\ \vdots & \vdots & & \vdots \\ 0 & 0 & \cdots & \lambda_N^t \\ \end{matrix} \right) \boldP^{-1}

If ϱ(A)<1\rho(\boldA) < 1, then ∣λn∣<1|\lambda_n| < 1 for all nn, and hence λnt→0\lambda_n^t \to 0 as t→∞t \to \infty. It follows that At→0\boldA^t \to \boldzero as required.

3.4Further Reading

Good treatments of matrix and linear algebra include Jänich (1994) and Axler (2015).

3.5Exercises

3.5.1Solutions to Selected Exercises

Footnotes
  1. Formally, KK dimensional subspaces have measure zero in RN\RR^N whenever K<NK < N. Hence every probability measure that is absolutely continuous with respect to Lebesgue measure puts zero mass on such a set. Less formally, consider the case where N=3N = 3 and K=2K=2. Then colspace⁡A\colspace \boldA forms at most a 2-dimensional plane in R3\RR^3. Intuitively, this set has no volume in R3\RR^3 because planes have no “thickness.” Similarly, while we might visualize b\boldb as a dot in R3\RR^3, as a point it is in fact infinitesimally small. Hence the chance of a randomly chosen b\boldb lying in colspace⁡A\colspace \boldA is zero.

  2. If we permit the eigenvectors to be complex, then the requirement is that they form a basis of CN\CC^N, the set of complex NN-vectors. In this case there is a sense in which almost all matrices are diagonalizable.

  3. The modulus of a+ib∈Ca + ib \in \CC is (a2+b2)1/2(a^2 + b^2)^{1/2}. If the imaginary part is zero, this reduces to the usual notion of absolute value.

  4. This is the so-called "underdetermined" case, where the number of equations is less than the number of unknowns. Intuitively, we do not have enough restrictions to pin down values uniquely.

  5. Hint: In view of fact 3.2.9, it suffices to show that B⊺B\boldB^\T \boldB is positive definite.

  6. Hint: Look at fact 3.3.9 and the argument that follows it.

References
  1. Jänich, K. (1994). Linear Algebra. New York: Springer.
  2. Axler, S. (2015). Linear Algebra Done Right. New York: Springer.