Skip to main content

Section 12 The Structure of Rn

Subsection Application: Connecting GDP and Consumption in Romania

It is common practice in the sciences to run experiments and collect data. Once data is collected it is necessary to find some way to analyze the data and predict future behavior from the data. One method is to find a curve that best “fits” the data, and one widely used method for curve fitting is called the least squares method.

For example, economists are often interested in consumption, which is the purchase of goods and services for use by households. In “A Statistical Analysis of GDP and Final Consumption Using Simple Linear Regression, the Case of Romania 1990-2010”, 27  the authors collect data and then use simple linear regression to compare GDP (gross domestic product) to consumption in Romania. The data they used is seen in Table 12.1, with a corresponding scatterplot of the data (with consumption as independent variable and GDP as dependent variable). The units for GDP and consumption are milliions of leu (the currency of Romania is the leu — on December 21, 2018, one leu was worth approximately $0.25 U.S.) The authors conclude their paper with the following statement:

However, we can appreciate that linear regression model describes the correlation between the value of gross domestic product and the value of final consumption and may be transcribed following form: PIB = -3127.51+ 1.22 CF. Analysis of correlation between GDP and final consumption (private consumption and public consumption) will result in an increase of 1.22 units of monetary value of gross domestic product. We can conclude that the Gross Domestic Product of our country is strongly influenced by the private and public consumption.
Table 12.1. GDP and consumption in Romania
Year GDP Consumption
1990 85.8 68.0
1991 220.4 167.3
1992 602.9 464.3
1993 2003.9 1523.6
1994 4977.3 3845.2
1995 7648.9 6257.7
1996 11384.2 9713.8
1997 25529.8 21972.2
1998 37055.1 33311.2
1999 55191.4 49311.9
2000 80984.6 69587.4
2001 117945.8 100731.7
2002 152017.0 127118.8
2003 197427.6 168818.7
2004 247368.0 211054.6
2005 288954.6 251038.1
2006 344650.6 294867.6
2007 416006.8 344937.0
2008 514700.0 420917.5
2009 498007.5 402246.0
2010 513640.8 405422.4
Figure 12.2. GDP and consumption data plot.

As we can see from the scatterplot, the relationship between the GDP and consumption is not exactly linear, but looks to be very close. To make correlations between GDP and consumption as the authors did, we need to understand how they determined their approximate linear relationship between the variables. With a good approximation function we can then compare the variables, extrapolate from the data, and make predictions or interpolate and estimate between data points. For example, we could use our approximation function to predict, as the authors did, how changes in consumption affect GDP (or vice versa). Later in this section we will see how to find the least squares line to fit this data — the best linear approximation to the data. This involves finding a vector in a certain subspace of R2 that is closest to a given vector. Linear least squares approximation is a special case of a more general process that we will encounter in later sections where we learn how to project sets onto subspaces.

Subsection Introduction

The set Rn with vector addition and scalar multiplication has a nice algebraic structure. These operations satisfy a number of properties, such as associativity and commutativity of vector addition, the existence of an additive identity and additive inverse, distribution of scalar multiplication over vector addition, and others. These properties make it easier to work with the whole space since we can express the vectors as linear combinations of basis vectors in a unique way. This algebraic structure makes Rn a vector space.

There are many subsets of Rn that have this same structure. These subsets are called subspaces of Rn. These are the sets of vectors for which the addition of any two vectors is defined within the set, the scalar multiple of any vector by any scalar is defined within the set and the set contains the zero vector. One type of subset with this structure is the span of a set of vectors.

Recall that the span of a set of vectors {v1,v2,,vk} in Rn is the set of all linear combinations of the vectors. For example, if v1=[110] and v2=[101], then a linear combination of these two vectors is of the form

c1v1+c2v2=c1[110]+c2[101]=[c1+c2c1c2].

One linear combination can be obtained by letting c1=2,c2=3, which gives the vector 2v13v2=[132]. All such linear combinations form the span of the vectors v! and v2. In this case, these vectors will form a plane through the origin in R3.

Now we will investigate if the span of two vectors form a subspace, i.e. if it has the same structure as a vector space.

Preview Activity 12.1.

Let w1 and w2 be two vectors in Rn. Let W=Span{w1,w2}.

(a)

For W to be a subspace of Rn, the sum of any two vectors in W must also be in W.

(i)

Pick two specific examples of vectors u,y in W (keeping w1,w2 unknown/general vectors). For example, one specific u would be 2w13w2 as we used in the above example. Find the sum of u,y. Is the sum also in W? Explain.

Hint.

What does it mean for a vector to be in W?

(ii)

Now let u and y be arbitrary vectors in W. Explain why u+y is in W.

(b)

For W to be a subspace of Rn, any scalar multiple of any vector in W must also be in W.

(i)

Pick a specific example u in W. Explain why 2u,3u,πu are all also in W.

(ii)

Now let a be an arbitrary scalar and let u be an arbitrary vector in W. Explain why the vector au is in W.

(c)

For W to be a subspace of Rn, the zero vector must also be in W. Explain why the zero vector is in W.

(d)

Does vector addition being commutative for vectors in Rn imply that vector addition is also commutative for vectors in W? Explain your reasoning.

(e)

Suppose we have an arbitrary u in W. There is an additive inverse of u in Rn. In other words, there is a u such that u+u=0. Should this u be also in W? If so, explain why. If not, give a counterexample.

(f)

Look at the other properties of vector addition and scalar multiplication of vectors in Rn listed in Theorem 4.4 in Section 4. Which of these properties should also hold for vectors in W?

Subsection Vector Spaces

The set of n-dimensional vectors with the vector addition and scalar multiplication satisfy many properties, such as addition being commutative and associative, existence of an additive identity, and others. The set Rn with these properties is an example of a vector space, a general structure examples of which include many other algebraic structures as we will see later.

Definition 12.3.

A set V on which an operation of addition and a multiplication by scalars is defined is a vector space if for all u, v, and w in V and all scalars a and b:

  1. u+v is an element of V (we say that V is closed under the addition in V),

  2. u+v=v+u (we say that the addition in V is commutative),

  3. (u+v)+w=u+(v+w) (we say that the addition in V is associative),

  4. there is a vector 0 in V so that u+0=u (we say that V contains an additive identity or zero vector 0),

  5. for each x in V there is an element y in V so that x+y=0 (we say that V contains an additive inverse y for each element x in V),

  6. au is an element of V (we say that V is closed under multiplication by scalars),

  7. (a+b)u=au+bu (we say that multiplication by scalars distributes over scalar addition),

  8. a(u+v)=au+av (we say that multiplication by scalars distributes over addition in V),

  9. (ab)u=a(bu),

  10. 1u=u.

Theorem 4.4 in Section 4 shows that Rn is itself a vector space. As we will see, there are many other sets that have the same algebraic structure. By focusing on this structure and the properties of these operations, we can extend the theory of vectors we developed so far to a broad range of objects, making it easier to work with them. For example, we can consider linear combinations of functions or matrices, or define a basis for different types of sets of objects. Such algebraic tools provide us with new ways of looking at these sets of objects, including a geometric intuition when working with these sets. In this section, we will analyze subsets of Rn which behave similar to Rn algebraically. We will call such sets subspaces. In a later chapter we will encounter different kinds of sets that are also vector spaces.

Definition 12.4.

A subset W of Rn is a subspace of Rn if W itself is a vector space using the same operations as in Rn.

The following example illustrates the process for demonstrating that a subset of Rn is a subspace of Rn.

Example 12.5.

There are many subsets of Rn that are themselves vector spaces. Consider as an example the set W of vectors in R2 defined by

W={[x0]|x is a real number }.

In other words, W is the set of vectors in R2 whose second component is 0. To see that W is itself a vector space, we need to demonstrate that W satisfies all of the properties listed in Definition 12.3.

To prove the first property, we need to show that the sum of any two vectors in W is again in W. So we need to choose two arbitrary vectors in W. Let u=[x0] and v=[y0] be vectors in W. Note that

u+v=[x0]+[y0]=[x+y0].

Since the second component of u+v is 0, it follows that u+v is in W. Thus, the set W is closed under addition.

For the second property, that addition is commutative in W, we can just use the fact that if u and v are in W, they are also vectors in R2 and u+v=v+u is satisfied in R2. So the property also holds in W.

A similar argument can be made for property (3).

Property (4) states the existence of the additive identity in W. Note that 0 is an additive identity in R2 and if it is also an element in W, then it will automatically be the additive identity of W. Since the zero vector can be written as 0=[x0] with x=0, 0 is in W. Thus, W satisfies property 4.

We will postpone property (5) for a bit since we can show that other properties imply property (5).

Property (6) is a closure property, just like property (1). We need to verify that any scalar multiple of any vector in W is again in W. Consider an arbitrary vector u and an arbitrary scalar a. Now

au=a[x0]=[ax0].

Since the vector au has a 0 as its second component, we see that au is in W. Thus, W is closed under scalar multiplication.

Properties (7), (8), (9) and (10) only depend on the operations of addition and multiplication by scalars in R2. Since these properties depend on the operations and not the vectors, these properties will transfer to W.

We still have to justify property (5) though. Note that since 11=0 in real numbers, by applying property (7) with a=1, b=1, we find that

0=0u=(a+b)u=au+bu=u+(1)u.

Therefore, (1)u is an additive inverse for u. Therefore, to show that the additive inverse of any u in W is also in W, we simply note that any multiple of u is also in W and hence (1)u must also be in W.

Since W satisfies all of the properties of a vector space, W is a vector space. Any subset of Rn that is itself a vector space using the same operations as in Rn is called a subspace of Rn.

Example 12.5 and our work Preview Activity 12.1 bring out some important ideas. When checking that a subset W of a vector space Rn is also a vector space, we can use the fact that all of the properties of the operations in Rn are transferred to any closed subset W. This implies that properties (2), (3), (7)-(10) are all automatically satisfied for W as well. Property (5) follows from the others. So we only need to check properties (1), (4) and (6). In fact, as we argued in the above example, property (4) also needs to be checked by simply checking that 0 of Rn is in W. We summarize this result in the following theorem.

The next activity provides some practice using Theorem 12.6.

Activity 12.2.

Use Theorem 12.6 to answer the following questions. Justify your responses. For sets which lie inside R2, sketch a pictorial representation of the set and explain why your picture confirms your answer.

(a)

Is the set W={[xy]|y=2x} a subspace of R2?

(b)

Is the set W={[x01]|x is a scalar } a subspace of R3?

(c)

Is the set W={[xx+y]|x,y are scalars } a subspace of R2?

(d)

Is the set W={[xy]|y=2x+1} a subspace of R2?

(e)

Is the set W={[xy]|y=x2} a subspace of R2?

(f)

Is the set W={[0000]} a subspace of R4?

(g)

Is the set W={[xyz]|x2+y2+z21} a subspace of R3? Note that W is the unit sphere (a.k.a. unit ball) in R3.

(h)

Is the set W=R2 a subspace of R3?

There are several important points that we can glean from Activity 12.2.

  • A subspace is a vector space within a larger vector space, similar to a subset being a set within a larger set.

  • The set containing the zero vector in Rn is a subspace of Rn, and it is the only finite subspace of Rn.

  • Every subspace of Rn must contain the zero vector.

  • No nonzero subspace is bounded — since a subspace must include all scalar multiples of its vectors, a subspace cannot be contained in a finite sphere or box.

  • Since vectors in Rk have k components, vectors in Rk are not contained in Rn when nk. However, if n>k, then we can think of Rn as containing a copy (what we call an isomorphic image) of Rk as the set of vectors with zeros as the last nk components.

Subsection The Subspace Spanned by a Set of Vectors

One of the most convenient ways to represent a subspace of Rn is as the span of a set of vectors. In Preview Activity 12.1 we saw that the span of two vectors is a subspace of Rn. In the next theorem we verify this result for the span of an arbitrary number of vectors, extending the ideas you used in Preview Activity 12.1. Expressing a set of vectors as the span of some number of vectors is a quick way of justifying that this set is a subspace and it also provides us a geometric intuition for the set of vectors.

Proof.

Let v1, v2, , vk be vectors in Rn. Let W=Span{v1,v2,,vk}. To show that W is a subspace of Rn we need to show that W is closed under addition and multiplication by scalars and that 0 is in W.

First we show that W is closed under addition. Let u and w be vectors in W. This means that u and w are linear combinations of v1, v2, , vk. So there are scalars a1, a2, , ak and b1, b2, , bk so that

u=a1v1+a2v2++akvk      and      w=b1v1+b2v2++bkvk.

To demonstrate that u+w is in W, we need to show that u+w is a linear combination of v1, v2, , vk. Using the properties of vector addition and scalar multiplication, we find

u+w=(a1v1+a2v2++akvk)+(b1v1+b2v2++bkvk)=(a1+b1)v1+(a2+b2)v2++(ak+bk)vk.

Thus u+w is a linear combination of v1, v2, , vk and W is closed under vector addition.

Next we show that W is closed under scalar multiplication. Let u be in W and c be a scalar. Then

cu=c(a1v1+a2v2++akvk)=(ca1)v1+(ca2)v2++(cak)vk

and cu is a linear combination of v1, v2, , vk and W is closed under multiplication by scalars.

Finally, we show that 0 is in W. Since

0=0v1+0v2++0vk,

0 is in W.

Since W satisfies all of the properties of a subspace as given in definition of a subspace, we conclude that W is a subspace of Rn.

The subspace W=Span{v1,v2,,vk} is called the subspace of Rn spanned by v1,v2,,vk. We also use the phrase “subspace generated by v1,v2,,vk” since the vectors v1,v2,,vk are the building blocks of all vectors in W.

Activity 12.3.

(a)

Describe geometrically as best as you can the subspaces of R3 spanned by the following sets of vectors. {[100]} {[100],[010]}

(b)

Express the following set of vectors as the span of some vectors to show that this set is a subspace. Can you give a geometric description of the set?

W={[2x+yzyzx+3z]:x,y,z real numbers }

One additional conclusion we can draw from Activity 12.2 and Activity 12.3 is that subspaces of Rn are made up of “flat” subsets. The span of a single nonzero vector is a line (which is flat), and the span of a set of two distinct nonzero vectors is a plane (which is also flat). So subspaces of Rn are linear (or “flat”) subsets of Rn. That is why we can recognize that the non-flat parabola in Activity 12.2 is not a subspace of R2.

Subsection Examples

What follows are worked examples that use the concepts from this section.

Example 12.8.

Let W={[2r+s+tr+tr+s]:r,s,tR}.

(a)

Show that W is a subspace of R3.

Solution.

Every vector in W has the form

[2r+s+tr+tr+s]=r[211]+s[101]+t[110]

for some real numbers r, s, and t. Thus,

W=Span{[211],[101],[110]}.

As a span of a set of vectors, we know that W is a subspace of R3.

(b)

Describe in detail the geometry of the subspace W (e.g., is it a line, a union of lines, a plane, a union of planes, etc.)

Solution.

Let v1=[211], v2=[101], and v3=[110]. The reduced row echelon form of [v1 v2 v3] is [101011000]. The pivot columns of [v1 v2 v3] form a linearly independent set with the same span as {v1,v2,v3}, So W=Span{v1,v2} and W forms the plane in R3 through the origin and the points (2,1,1) and (1,0,1).

Example 12.9.

(a)

Let X=Span{[100]} and let Y=Span{[010]}. That is, X is the x-axis and Y the y-axis in three-space. Let

X+Y={x+y:xX and yY}.
(i)

Is [230] in X+Y? Justify your answer.

Solution.

We let X=Span{[100]} and Y=Span{[010]}. T

Let w=[230], x=2[100], and y=3[010]. Since w=x+y with xX and yY we conclude that wX+Y.

(ii)

Is [111] in X+Y? Justify your answer.

Solution.

We let X=Span{[100]} and Y=Span{[010]}. T

Every vector in X has the form ae1 for some scalar a (where e1=[100], and every vector in Y has the form be2 for some scalar b (where e2=[010]). So every vector in X+Y is of the form ae1+be2=[ab0]. Since the vector [111] does not have a 0 in the third component, we conclude that in [111] is not in X+Y.

(iii)

Assume that X+Y is a subspace of R3. Describe in detail the geometry of this subspace.

Solution.

We let X=Span{[100]} and Y=Span{[010]}. T

As we just argued, every vector in X+Y has the form ae1+be2. So X+Y=Span{e1,e2}, which is the xy-plane in R3.

(b)

Now let W1 and W2 be arbitrary subspaces of Rn for some positive integer n. Let

W1+W2={w1+w2:w1W1 and w2W2}.

Show that W1+W2 is a subspace of Rn. The set W1+W2 is called the sum of the subspaces W1 and W2.

Solution.

To see why the set W1+W2 is a subspace of R3, suppose that x and y are in W1+W2. Then x=u1+u2 and y=z1+z2 for some u1,z1 in W1 and some u2,z2 in W2. Then

x+y=(u1+u2)+(z1+z2)=(u1+z1)+(u2+z2).

Since W1 is a subspace of R3 it follows that u1+z1W1. Similarly, u2+z2W2. This makes x+y an element of W1+W2. Also, suppose that a is a scalar. Then

ax=a(u1+u2)=au1+au2.

Since W1 is a subspace of R3 it follows that au1W1. Similarly, au2W2. This makes ax an element of W1+W2. Finally, since 0 is in both W1 and W2, and 0=0+0, it follows that 0 is an element of W1+W2. We conclude that W1+W2 is a subspace of R3.

Subsection Summary

  • A vector space is a set V with operations of addition and scalar multiplication defined on V such that for all u, v, and w in V and all scalars a and b:

    1. u+v is an element of V (we say that V is closed under the addition in V),

    2. u+v=v+u (we say that the addition in V is commutative),

    3. (u+v)+w=u+(v+w) (we say that the addition in V is associative),

    4. there is a vector 0 in V so that u+0=u (we say that V contains an additive identity or zero vector 0),

    5. for each x in V there is an element y in V so that x+y=0 (we say that V contains an additive inverse y for each element x in V),

    6. au is an element of V (we say that V is closed under multiplication by scalars),

    7. (a+b)u=au+bu (we say that multiplication by scalars distributes over scalar addition),

    8. a(u+v)=au+av (we say that multiplication by scalars distributes over addition in V),

    9. (ab)u=a(bu),

    10. 1u=u.

  • For every n, Rn is a vector space.

  • A subset W of Rn is a subspace of Rn if W is a vector space using the same operations as in Rn.

  • To show that a subset W of Rn is a subspace of Rn, we need to prove the following:

    1. u+v is in W whenever u and v are in W (when this property is satisfied we say that W is closed under addition),

    2. au is in W whenever a is a scalar and u is in W (when this property is satisfied we say that W is closed under multiplication by scalars),

    3. 0 is in W.

    The remaining properties of a vector space are properties of the operation, and as long as we use the same operations as in Rn, the operation properties follow the operations.

  • The span of any set of vectors in Rn is a subspace of Rn.

Exercises Exercises

1.

Each of the following regions or graphs determines a ≈subset W of R2. For each region, discuss each of the subspace properties of Theorem 12.4 and explain with justification if the set W satisfies each property or not.

2.

Determine which of the following sets W is a subspace of Rn for the indicated value of n. Justify your answer.

(a)

W={[x 0]T:x is a scalar }

(b)

W={[2x+y xy x+y]T:x,y are scalars }

(c)

W={[x+1 x1]T:x is a scalar }

(d)

W={[xy xz yz]T:x,y,z are scalars }

3.

Find a subset of R2 that is closed under addition and scalar multiplication, but that does not contain the zero vector, or explain why no such subset exists.

4.

Let v be a vector in R2. What is the smallest subspace of R2 that contains v? Explain. Describe this space geometrically.

5.

What is the smallest subspace of R2 containing the first quadrant? Justify your answer.

6.

Let u, v, and w be vectors in R3 with w=u+v. Let W1=Span{u,v} and W2=Span{u,v,w}.

(a)

If x is in W1, must x be in W2? Explain.

(b)

If y is in W2, must y be in W1? Explain.

(c)

What is the relationship between Span{u,v} and Span{u,v,w}? Be specific.

7.

Let m and n be positive integers, and let v be in Rn. Let W={Av:AMm×n}.

(a)

As an example, let v=[2 1]T in R2 with W={Av:AM2×2}.

(i)

Show that the vector [2 1]T is in W by finding a matrix A that places [2 1]T in W.

(ii)

Show that the the vector [4 2]T is in W by finding a matrix A that places [4 2]T in W.

(iii)

Show that the vector [6 1]T is in W by finding a matrix A that places [6 1]T in W.

(iv)

Show that W=R2.

(b)

Show that, regardless of the vector v selected, W is a subspace of Rm.

(c)

Characterize all of the possibilities for what the subspace W can be.

Hint.

There is more than one possibility.

8.

Let S1 and S2 be subsets of R3 such that Span S1=Span S2. Must it be the case that S1 and S2 contain at least one vector in common? Justify your answer.

9.

Assume W1 and W2 are two subspaces of Rn. Is W1W2 also a subspace of Rn? Is W1W2 also a subspace of Rn? Justify your answer. (Note: The notation W1W2 refers to the vectors common to both W1,W2, while the notation W1W2 refers to the vectors that are in at least one of W1,W2.)

10.

Determine whether the plane defined by the equation 5x+3y2z=0 is a subspace in R3.

11.

If W is a subspace of Rn and u is a vector in Rn not in W, determine whether

u+W={u+v:v is a vector in W}

is a subspace of Rn.

12.

Two students are talking about examples of subspaces.

Student 1: The x-axis in R2 is a subspace. It is generated by the vector [10].
Student 2: Similarly R2 is a subspace of R3.
Student 1: I'm not sure if that will work. Can we fit R2 inside R3? Don't we need W to be a subset of R3 if it is a subspace of R3?
Student 2: Of course we can fit R2 inside R3. We can think of R2 as vectors [ab0]. That's the xy-plane.
Student 1: I don't know. The vector [ab0] is not exactly same as [ab].
Student 2: Well, R2 is a plane and so is the xy-plane. So they must be equal, shouldn't they?
Student 1: But there are infinitely many planes in R3. They can't all be equal to R2. They all “look like”R2 but I don't think we can say they are equal.
Which student is correct? Is R2 a subspace of R3, or not? Justify your answer.

13.

Given two subspaces H1,H2 of Rn, define

H1+H2={ww=u+v where u in H1,v in H2}.

Show that H1+H2 is a subspace of Rn containing both H1,H2 as subspaces. The space H1+H2 is the sum of the subspaces H1 and H2.

14.

Label each of the following statements as True or False. Provide justification for your response.

(a) True/False.

Any line in Rn is a subspace in Rn.

(b) True/False.

Any line through the origin in Rn is a subspace in Rn.

(c) True/False.

Any plane through the origin in Rn is a subspace in Rn.

(d) True/False.

In R4, the points satisfying xy=2t+z form a subspace.

(e) True/False.

In R4, the points satisfying x+3y=2z form a subspace.

(f) True/False.

Any two nonzero vectors generate a plane subspace in R3.

(g) True/False.

The space R2 is a subspace of R3.

(h) True/False.

If W is a subspace of Rn and u is in W, then the line through the origin and u is in W.

(i) True/False.

There are four types of subspaces in R3: {0}, line through origin, plane through origin and the whole space R3.

(j) True/False.

There are four types of subspaces in R4: {0}, line through origin, plane through origin and the whole space R4.

(k) True/False.

The vectors [111], [121] and [232] form a subspace in R3.

(l) True/False.

The vectors [111] and [121] form a basis of a subspace in R3.

Subsection Project: Least Squares Linear Approximation

We return to the problem of finding the least squares line to fit the GDP-consumption data. We will start our work in a more general setting, determining the method for fitting a linear function to fit any data set, like the GDP-consumption data, in the least squares sense. Then we will apply our result to the GDP-consumption data.

Project Activity 12.4.

Suppose we want to fit a linear function p(x)=mx+b to our data. For the sake of our argument, let us assume the general case where we have ndata points labeled as (x1,y1), (x2,y2), (x3,y3), , (xn,yn). (In the GDP-consumption data n=21.) In the unlikely event that the graph of p(x) actually passes through these data points, then we would have the system of equations

y1=b+mx1y2=b+mx2(12.1)y3=b+mx3yn=b+mxn

in the unknowns b and m.

(a)

As a small example to illustrate, write the system (\ref{eq:LS_system}) using the threepoints (x1,y1)=(1,2), (x2,y2)=(3,4), and (x3,y3)=(5,6). Identify the unknowns and then write this system in the form Ma=y. Explicitly identify thematrix M and the the vectors a and y.

(b)

Identify the specific matrix M and the specific vectors a and y using the data inTable \ref{T:GDP_consumption}. Explain why the system Ma=y is inconsistent.(Remember, we are treating consumption as the independent variable and GDP as the dependentvariable.) What does the result tell us about the data?

Project Activity 12.4 shows that the GDP-consumption data does not lie on a line. So instead of attempting to find coefficients b and m that give a solution to this system, which may be impossible, we instead look for a vector a that provides us with something that is “close” to a solution.

If we could find b and m that give a solution to the system Ma=y, then May would be zero. If we can't make May exactly equal to the vector 0, we could instead try to minimize May in some way. One way is to minimize the length ||May|| of the vector May.

If we minimize the quantity ||May||, then we will have minimized a function given by a sum of squares. That is, ||May|| is calculated to be

(12.2)(b+mx1y1)2+(b+mx2y2)2++(b+mxnyn)2.

This is why the method we will derive is called the method of least squares. This method provides us with a vector “solution” in a subspace that is related to M. We can visualize ||May|| as in Figure 12.10. In this figure the data points are shown along with a linear approximation (not the best for illustrative purposes). The lengths of the vertical line segments are the summands (b+mxiyi) in (12.2). So we are trying to minimize the sum of the squares of these line segments.

Figure 12.10. Error in the linear approximation.

Suppose that a minimizes ||May||. Then the vector Ma is the vector that is closest to y of all of the vectors of the form Mx. The fact that the vectors of the form Mx make a subspace will be useful in what follows. We verify that fact in the next project activity.

Project Activity 12.5.

Let A be an arbitrary m×k matrix. Explain why the set C={Ax:xRk} is a subspace of Rm.

Project Activity 12.5 shows us that even though the GDP-consumption system Ma=y does not have a solution, we can find a vector that is close to a solution in the subspace {Mx:xR2}. That is, find a vector a in R2 such that Ma is as close (in the least squares sense) to y as we can get. In other words, the error ||May|| is as small as possible. In the following activity we see how to find a.

Project Activity 12.6.

Let

S=(b+mx1y1)2+(b+mx2y2)2++(b+mxnyn)2,

the quantity we want to minimize. The variables in S are m and b, so we can think of S as a function of the two independent variables m and b. The square root makes calculations more complicated, so it is helpful to notice that S will be a minimum when S2 is a minimum. Since S2 is also function of the two variables b and m, the minimum value of S2 will occur when the partial derivatives of S2 with respect to b and m are both 0 (if you haven't yet taken a multivariable calculus course, you can just assume that this is correct). This yields the equations

(12.3)0=i=1n(mxi+byi)xi(12.4)0=i=1n(mxi+byi).

In this activity we solve equations (12.3) and (12.4) for the unknowns b and m. (Do this in a general setting without using specific values for the xi and yi.)

(a)

Let r=i=1nxi2, s=i=1nxi, t=i=1nyi, and u=i=1nxiyi. Show that the equations (12.3) and (12.4) can be written in the form

0=bs+mru0=bn+mst.

Note that this is a system of two linear equations in the unknowns b and m.

(b)

Write the system from part (a) in matrix form Ax=b. Then use techniques from linear algebra to solve the linear system to show that

(12.5)b=trusnrs2=(i=1nyi)(i=1nxi2)(i=1nxi)(i=1nxiyi)n(i=1nxi2)(i=1nxi)2

and

(12.6)m=nutsnrs2=n(i=1nxiyi)(i=1nxi)(i=1nyi)n(i=1nxi2)(i=1nxi)2.

Project Activity 12.7.

Use the formulas (12.5) and (12.6) to find the values of b and m for the regression line to fit the GDP-consumption data in Table 12.1. You may use the fact that the sum of the GDP data is 3.5164030×106, the sum of the consumption data is 2.9233750×106, the sum of the squares of the consumption data is 8.806564894×1011, and the sum of the products of the GDP and consumption data is 1.069946378×1012. Compare to the results the authors obtained in the paper “A Statistical Analysis of GDP and Final Consumption Using Simple Linear Regression, the Case of Romania 1990-2010”.
Bălăcescu, Aniela & Zaharia, Marian. (2012). A STATISTICAL ANALYSIS OF GDP AND FINAL CONSUMPTION USING SIMPLE LINEAR REGRESSION. THE CASE OF ROMANIA 1990?2010. Annals - Economy Series. 4. 26-31. Available from: Research Gate 28 .
researchgate.net/publication/227382939_A_STATISTICAL_ANALYSIS_OF_GDP_AND_FINAL_CONSUMPTION_USING_SIMPLE_LINEAR_REGRESSION_THE_CASE_OF_ROMANIA_1990-2010