National Graduate Institute for Policy Studies (GRIPS)
Our first technical topic for this book is linear algebra, which is one of the foundation stones of applied mathematics in general, and econometrics and statistics in particular. Data ordered by observation are naturally stored in vectors. Related vectors are naturally grouped into matrices. Once our data are organized this way, we need to perform basic arithmetic operations or solve equations or quadratic minimization problems. In this chapter we cover the foundations of vector operations used in linear algebra. As we’ll see, the conceptual aspects of linear algebra are clearest if we begin by stripping away details such as matrices and look instead at linear operations from a more abstract perspective.
For arbitrary N∈N, the symbol RN represents the set of all N-vectors, or vectors of length N. A typical element has the form
x=x1x2⋮xN where xn∈R for each n
(R=R1 represents the set of all real numbers, which is the union of the rational and irrational numbers.) While x has been written vertically, as a column of numbers, we could also write it horizontally as x=(x1,…,xN). For now vectors are just a sequences of numbers, and it makes no difference whether we write them vertically or horizontally. (Only when we work with matrix multiplication does it become necessary to distinguish between column and row vectors.)
The vector of ones will be denoted 1 and the vector of zeros will be denoted 0:
1:=1⋮1,0:=0⋮0
Although vectors are infinitesimal points in RN, they are often represented visually as arrows from the origin to the point itself. Figure 2.1 gives an illustration for the case N=2.
In vector space theory there are two fundamental algebraic operations: vector addition and scalar multiplication. For x,y∈RN, their vector sum is
x+y=x1⋮xN+y1⋮yN:=x1+y1⋮xN+yN
If α∈R, then the scalar product of α and x is defined to be
αx=αx1⋮xN:=αx1⋮αxN
Thus addition and scalar multiplication are defined in terms of ordinary addition and multiplication in R, computed element by element, adding and multiplying respectively.[1]Figure 2.2 and Figure 2.3 show examples of vector addition and scalar multiplication in the case N=2.
Subtraction of two vectors is performed element by element, just like addition. Subtraction is not a primitive operation because the definition can be given in terms of addition and scalar multiplication: x−y:=x+(−1)y. An illustration of subtraction is given in figure 2.4. One way to remember this operation is to draw a line from y to x and then shift it to the origin.
These properties are easy to check from (2.1). For example, regarding the second equality, pick any α,β∈R and any x,y∈RN. By the definitions of scalar multiplication and inner product respectively, we have
⟨αx,βy⟩=n=1∑Nαxnβyn=αβn=1∑Nxnyn=αβ⟨x,y⟩
The (Euclidean) norm of a vector x∈RN is defined as
and represents the length of the vector x. (In the arrow representation of vectors in figures 2.2–2.4, the norm of the vector is equal to the length of the arrow.)
Properties (i) and (ii) you can verify yourself without difficulty. Proofs for (iii) and (iv) are a bit harder. Property (iii) is called the triangle inequality, while (iv) is called the Cauchy–Schwarz inequality. The proof of the Cauchy–Schwarz inequality is given as a solved exercise after we’ve built up some more tools (see ex. 3.5.33). If you’re prepared to accept the Cauchy–Schwarz inequality for now, then the triangle inequality follows, because, by the properties of the inner product given in fact 2.1.1,
One of the most elementary ways to work with vectors is to combine them using linear operations. Given vectors x1,…,xK in RN, a linear combination of these vectors is a new vector of the form
for some collection of scalars α1,…,αK (i.e., with αk∈R for all k). Figure 2.5 shows four different linear combinations y=α1x1+α2x2 where x1,x2 are fixed vectors in R2 and the scalars α1 and α2 are varied.
Given any nonempty X⊂RN, the set of all vectors that can be made by (finite) linear combinations of elements of X is called the span of X, and denoted by spanX. For example, the set of all linear combinations of X:={x1,…,xK} is
spanX:={ all vectors k=1∑Kαkxk such that α:=(α1,…,αK)∈RK}
As will be discussed below, the span of certain collections of vectors turns out to have an intimate connection with existence of solutions to linear equations.
Linear independence is an apparently simple concept with implications that stretch deep into many aspects of analysis. If you wish to understand when a matrix is invertible, or when a system of linear equations has a unique solution, or when a least squares estimate is uniquely defined, the most important foundational idea is linear independence of vectors.
Let’s begin with the definition. Consider a set of vectors X:={x1,…,xK}. We can surely realize the origin 0 as a linear combination of these vectors, just by setting all of the scalars αk in ∑k=1Kαkxk to zero. The set X is called linearly independent when this is the only possibility. That is, X⊂RN is called linearly independent if
How can we interpret linear independence? One way to understand it is as an indicator of the algebraic diversity of a given collection of vectors. In particular, in a linearly independent set, the span is relatively large, in the sense that every vector contributes to the span. Here’s a formal statement of this idea.
Exercise 2.4.15 asks you to check these equivalences. For now let’s just step through them in the context of two examples. First consider the pair of canonical basis vectors {e1,e2} in R2, as depicted in figure 2.7. As we saw in examples 2.1.4 and 2.1.7, this pair is linearly independent, and its span is all of R2. Both vectors contribute to the span, since removing either one reduces the span to just a line in R2. (For example, the span of {e1} is just the horizontal axis in R2.) Neither one of this pair can be written as a linear combination of the other.
Next, consider instead the pair {x1,x2} in example 2.1.8. These vectors fail to be linearly independent, as shown in that example. It is also clear that dropping either one does not change the span—it remains the horizontal axis in any case. Finally, we saw in example 2.1.8 that x2=−2x1, which means that each vector can be written as a linear combination of the other.
As we’ll see below, the problem of existence of solutions to systems of linear equations comes down to whether or not a given point is contained in the span of a collection of vectors (which typically correspond to the columns of a matrix). This depends in general on the size of the span, and the size of the span in turn depends on whether or not the vectors are linearly independent.
Given that linear independence is the key condition for existence of solutions, it’s surprising at first to learn that linear independence is the key condition for uniqueness as well. As we’ll see, the connection between linear independence and uniqueness stems from the following result.
We will find it rewarding to study more closely the structure of spans generated by a collection of vectors. One of the defining features of the span of a set X is that it is “closed” under the linear operations of vector addition and scalar multiplication, in the sense that
x,y∈spanX⟹x+y∈spanX, and
y∈spanX and γ∈R⟹γy∈spanX.
For example, (i) holds because the sum of two linear combinations of elements of X is another linear combination of elements of X.
The notion of a set being closed under scalar multiplication and vector addition is important enough to have its own name: A nonempty subset S of RN is called a linear subspace (or just subspace) of RN if
To visualize subspaces in R3, think of lines and planes that pass through the origin. Here are some elementary facts about linear subspaces:
There’s also one deep result about linear subspaces we need to cover, which forms a cornerstone of many foundational results:
In other words, if there exists a set X={x1,…,xK} with S⊂spanX, then any subset of S with more than K vectors will be linearly dependent. The proof can be found in most texts on linear algebra (e.g., §3.5 of Jänich(1994)).
Figure 2.9:Any three vectors in P are linearly dependent
Consider again the pair x1,x2 shown in figure 2.5, and the four different vectors labeled y that we created from x1,x2 by way of linear combinations. Eyeballing the figure gives the impression that any y∈R2 could be constructed as a linear combination of x1,x2 with suitable choice of the scalars α1,α2. Indeed this is true. The reason is that the pair {x1,x2} is linearly independent (see example 2.1.6), and any pair of linearly independent vectors in R2 spans R2. Here’s a statement of this result for the general case:
We now come to a key definition. Let S be a linear subspace of RN and let B⊂S. The set B is called a basis of S if
B spans S and
B is linearly independent.
The plural of basis is bases. In view of theorem 2.1.2, when B is a basis of S, each point in S has exactly one representation as a linear combination of elements of B.
It follows immediately from theorem 2.1.4 that any N linearly independent vectors in RN form a basis of RN.
Here are the two most fundamental results about bases:
The proof of part (i) is not particularly hard. See, for example, section 3.2 of Jänich (1994). Part (ii) follows from theorem 2.1.3 and is left as an exercise (ex. 2.4.17).
If S is a linear subspace of RN, then the common number identified in theorem 2.1.5 is called the dimension of S, and written as dimS.
In RN the singleton subspace {0} is said to have zero dimension.
If we take a set of K vectors, then how large will its span be in terms of dimension? The next theorem answers this question.
The single most important class of functions in applied mathematics is the linear functions. In high school we are told that linear functions as those whose graph is a straight line. Here’s a better definition: A function T:RK→RN is linear if
(Following a common convention, we’ll write linear functions with uppercase letters and omit the parenthesis around the argument where no confusion arises. This convention has come about because the action of linear maps is essentially isomorphic to multiplication of vectors by matrices. More on that topic soon.)
The definition in (2.7) tells us directly that if T is linear then the exchange of order in T[∑k=1Kαkxk]=∑k=1KαkTxk will be valid whenever K=2. A simple inductive argument extends this to arbitrary K. As an application of this fact, consider the following: As discussed in example 2.1.4, any x∈RK can be expressed in terms of the basis vectors as ∑k=1Kαkek, for some suitable choice of scalars. Hence, for a linear function T, its range, denoted rngT, is the set of all points of the form
Tx=T[k=1∑Kαkek]=k=1∑KαkTek
as we vary α1,…,αK over all scalar combinations. (See Section 15.2 for the definition of range.) In other words, the range of a linear map is the span of the image of the canonical basis functions. This will prove to be important later on. The next fact summarizes.
Soon we’ll turn to the topic of determining when linear functions are bijections, an issue that is intimately related to invertibility of matrices. To this end it’s useful to note that, for linear functions, the property of being one-to-one can be determined by examining the set of points it maps to the origin. To express this idea, for any T:RK→RN, we define the null space or kernel of T as
nullT:={x∈RK:Tx=0}
The proofs are straightforward. For example, if Tx=Ty for some x,y∈RK, then T(x−y)=0, and hence x−y∈nullT. So if nullT={0}, then Tx=Ty implies x=y, which means that T is one-to-one.
Many statistical problems are "inverse" problems, in the sense that we observe outcomes and wish to determine what generated them. For example, we might want to know what consumer preferences led to observed market behavior, or what kinds of expectations led to a given shift in exchange rates.
Consider the generic inverse problem in figure 2.10, where F and y are given, and we seek to obtain the unknown object x. Two immediate questions are: Does this problem have a solution? and Is it unique? To provide general answers to these questions, we need to know whether F is one-to-one, onto, etc. (see Section 15.2 for definitions and further discussion). The best case is when F is a bijection, for then we know that a unique solution x exists for every possible y.
In general, functions can be onto, one-to-one, bijections, or none of the above. However, for linear functions from RN to RN, the first three properties are all equivalent! The next theorem gives details.
If any one of these conditions is true, then T is called nonsingular. (Equivalently, a nonsingular function is a linear bijection.) Otherwise T is called singular. The proof of theorem 2.1.7 is a solved exercise (ex. 2.4.21). Figure 2.11 provides intuition for the case of N=1. In the top panel all conditions in theorem 2.1.7 are satisfied. In the lower panel none are. In particular, we can see that the condition for T to be one-to-one and onto is exactly the same (i.e., α=0).
Figure 2.11:The case of N=1, nonsingular and singular
If T is nonsingular, then, being a bijection, it must have an inverse function T−1 that is also a bijection (fact 15.2.1). It turns out that this inverse function inherits the linearity of T (see ex. 2.4.20). In summary,
Theorem 2.1.7 only applies to linear maps between spaces of the same dimension. When linear functions map across distinct dimensions the situation changes:
The most important implication is that if N=K, then we can forget about bijections. The proof of theorem 2.1.8 is a solved exercise (ex. 2.4.22).
One of the core concepts in this book is orthogonality, not just of vectors but also of more complex objects such as random variables. Let’s begin with the vector definition and some key implications.
Let x and z be vectors in RN. If ⟨x,z⟩=0, then we write x⊥z and call x and zorthogonal. In R2, x and z are orthogonal when they are perpendicular to one another, as in figure 2.12. For x∈RN and S⊂RN, we say that x is orthogonal to S if x⊥z for all z∈S (figure 2.13), and we write x⊥S. A set of vectors {z1,…,zK}⊂RN is called an orthogonal set if its elements are mutually orthogonal, that is, if zj⊥zk whenever j and k are distinct.
Orthogonal sets and linear independence are closely related. For example,
While not every linearly independent set is orthogonal, an important partial converse to fact 2.2.2 is given in Section 2.2.4.
An orthogonal set O⊂RN is called an orthonormal set if ∥u∥=1 for all u∈O. An orthonormal set that lies in and spans a linear subspace S of RN is called an orthonormal basis of S. It is, necessarily, a basis of S. (Why?) The standard example of an orthonormal basis for all of RN is the canonical basis {e1,…,eN}.
By definition, if O={u1,…,uK} is any basis of S, then, for any x∈S, we can find unique scalars α1,…,αK such that x=∑k=1Kαkuk. While the values of these scalars are not always transparent, for an orthonormal basis they are easy to compute:
The proof is an exercise. Given S⊂RN, the orthogonal complement of S is defined as
A central problem in linear regression and many other applications is approximation of some y of RN by an element of a given subspace S of RN. Stated more precisely, the problem is, given y and S, to find the closest element y^ of S to y. Closeness is in terms of Euclidean norm, so y^ is the minimizer of ∥y−z∥ over all z∈S:
The next theorem tells us that a solution y^ to this minimization problem always exists, as well as providing a means to identify it.
The intuition is easy to grasp from a graphical presentation. Figure 2.15 illustrates. Looking at the figure, we can see that the closest point to y in S is the one point y^∈S such that y−y^ is orthogonal to S.
For a full proof see, for example, theorem 5.16 of Çinlar & Vanderbei (2013). Let’s just cover sufficiency of the conditions in part (ii): Let y∈RN and let S be a linear subspace of RN. Let y^ be a vector in S satisfying y−y^⊥S. Let z be any other point in S. We have
∥y−z∥2=∥(y−y^)+(y^−z)∥2=∥y−y^∥2+∥y^−z∥2
The second equality follows from y−y^⊥S (why?) and the Pythagorian law. Since z was an arbitrary point in S, we have ∥y−z∥⩾∥y−y^∥ for all z∈S. Hence (2.9) holds.
In view of theorem 2.2.1, for each fixed linear subspace S in RN, the operation
y↦ the orthogonal projection of y onto S
is a well-defined function from RN to RN. The function is typically denoted by P. For each y∈RN, the symbol Py represents the image of y under P, which is the orthogonal projection y^. P is called the orthogonal projection onto S, and we write
P=projS
Figure 2.16 illustrates the action of P on two different vectors.
Using this notation, we can restate the orthogonal projection theorem, as well as adding some properties of P:
These results are not difficult to prove, given theorem 2.2.1. Linearity of P is left as an exercise (ex. 2.4.29). Parts (ii)–(iii) follow directly from theorem 2.2.1. To see (iv), observe that y can be decomposed as y=Py+y−Py. Now apply the Pythagorean law. Part (v) follows from part (iv). Part (vi) follows from the definition of Py as the closest point to y in S. Part (vii) is an exercise.
Fact 2.2.6 is a fundamental result. It’s true because the right-hand side of (2.10) clearly lies in S (being a linear combination of basis functions) and, for any uj in the basis set
This is enough to confirm that y−Py⊥S (see ex. 2.4.14).
There’s one more essential property of P that we need to make note of: Suppose that we have two linear subspaces S1 and S2 of RN, where S1⊂S2. What then is the difference between (1) first projecting a point onto the bigger subspace S2, and then projecting the result onto the smaller subspace S1, and (2) projecting directly to the smaller subspace S1? The answer is none—we get the same result:
Consider the setting of the orthogonal projection theorem. Our interest is in projecting y onto S, where S is a linear subspace of RN. The closest point to y in S is y^:=Py where P=projS. Unless y was already in S, some error y−Py remains. Tracking and managing this residual will be important to us, so let’s introduce an operator M that takes y∈RN and returns the residual. We can define it as
where I is the identity mapping on RN. For any y we have My=Iy−Py=y−Py as required. In regression analysis M shows up as a matrix called the “annihilator.” This is a pretty cool name, but it’s also not a great description of its function. In what follows we will refer to M as the residual projection.
Part (v) means that PMy=MPy=0 for all y∈RN. Figure 2.17 illustrates the action of M. The results in fact 2.2.8 can be seen in the figure.
If S1 and S2 are two subspaces of RN with S1⊂S2, then S2⊥⊂S1⊥. This means that the result in fact 2.2.7 is reversed for M.
As an application of the ideas above, let’s now discuss a procedure called Gram–Schmidt orthogonalization, which provides a fundamental link between the two major concepts discussed in this chapter: linear independence and orthogonality. It can be considered as a partial converse to fact 2.2.2.
The proof of theorem 2.2.3 provides an important algorithm for generating the orthonormal set {u1,…,uK}. The first step is to construct orthogonal sets {v1,…,vk} with span identical to {b1,…,bk} for each k. The construction of {v1,…,vK} uses the so called Gram–Schmidt orthogonalization procedure. First, for each k=1,…,K, let
Bk:=span{b1,…,bk},
Pk:=projBk and Mk:=projBk⊥,
vk:=Mk−1bk where M0 is the identity mapping, and
Vk:=span{v1,…,vk}.
In step (iii) we map each successive element bk into a subspace orthogonal to the subspace generated by b1,…,bk−1. In the exercises you are asked to show that {v1,…,vK} is an orthogonal set and Vk=Bk for all k (ex. 2.4.34). To complete the argument, we introduce the vectors uk by uk:=vk/∥vk∥ and confirm that this set of vectors {u1,…,uk} is orthonormal with span equal to Vk. These results are also (solved) exercises.
In some instances, the notion of scalar multiplication includes multiplication of vectors by complex numbers. In what follows we will work almost entirely with real scalars. Hence scalar multiplication means real scalar multiplication unless otherwise stated.
Hint: There’s no need to go taking derivatives and setting them equal to zero. An easier proof exists. If you’re stuck, consider the Cauchy–Schwarz inequality.