Section 9.5 bounded the dot product by lengths, . This section asks a new
question: given a point and a line through the
origin, which point of the line is nearest to ? The answer splits
into a piece
along the line and a piece orthogonal to it. Divided by
lengths, the same split gives a number between and that measures how far
two directions agree, the cosine of the angle between
them.
The nearest
point on a line through the origin
Fix
with . The
multiples , for
, form the
line through the origin in the direction of
. Take a
point .
Among all , which
one is nearest to ? In the plane a picture
answers: drop a perpendicular from to the line, and its
foot is the nearest point. In there is no
picture, but the picture suggests a guess to test.
Try a concrete case first. Let and . The squared
distance from to
is The last form shows the answer at once: the
squared distance is at least , and it equals only at . So the nearest
point is , and the distance is . Now look at the
error: , and . The error is orthogonal to
the line, as the picture promised.
Completing the square worked but hid the reason. In
any we guess
that the error is orthogonal and check the guess with
Pythagoras.
Idea (Scratch work). We plan the
search with a table.
| ,
|
find with
for every |
| guess: the error is perpendicular, |
solve : , allowed since |
|
compare
with for
an arbitrary |
| , two orthogonal pieces |
Pythagoras: |
The last row closes the gap: the extra term is
never negative, so no beats . The picture supplied
only the guess; Pythagoras supplies the proof.
The number and the point come back in this
section and in Chapter 10, so they get a name.
Definition
9.6.1 (Projection onto a Line)
Let with . The projection of onto is the vector
The projection is the multiple of that leaves an error
orthogonal to .
In words:
is a vector, a scalar multiple of . The scalar is the
number
divided by the square of the length of
. Recall that
(Proposition 9.4.1
(c)). This number is positive exactly when (Proposition 9.3.1
(c)).
Examples.
- A unit vector. If , the
denominator is ,
and .
- A standard vector. The vector is a unit vector (Proposition 9.4.1
(e)). For
this gives , by Proposition 9.3.1
(d). Projecting onto the -th axis keeps the -th coordinate and sets
the others to .
For
and , it gives
.
- The opening example. For and , and
, so
, the point found above.
- Two extreme cases. If , the
coefficient is ,
and : the nearest point of the line to a point
orthogonal to it is the origin. At the other extreme, if
then : a point already
on the line is its own projection.
When . Keep and change to . The formula
now divides by , so it defines nothing. The question does not
survive either: every is , so all of them are at
the same distance from , and “the” nearest
point is no longer a single . This is why the
definition requires .
Why this definition. Dividing by
instead of
would
give for and , and its error is not orthogonal to . The square makes the
answer independent of the length of , as Exercise B2 (c)
shows: the projection depends on the line, not on the
vector chosen to name it.
Quick check. Compute and . Are they equal?
Solution. For : and , so the projection is . For
: and , so it is . They are equal, because and name the same
line.
The scratch work above is a proof method.
Example
(Method: subtract the projection)
How it goes. Given and , write The piece is orthogonal to , hence to every
multiple of . So
Pythagoras (Proposition 9.4.4)
splits the length of any vector of the form : its square
is .
When to use it. Distances from a
point to a line through the origin; inequalities between
and
lengths; any problem where a vector should be split into
“along ” and
“orthogonal to ”.
Common mistakes. It is easy to
forget that
is needed before anything is divided. It is also easy to
project onto the wrong vector:
and are different in general, as Exercise B2 (e)
shows. Finally, dividing by instead of leaves an
error that is not orthogonal to .
The closest-point theorem below is proved this way,
and Example (Distance to a line through the origin)
uses it on numbers.
The theorem turns the scratch work into a proof, and
adds an exact identity for the cost of a wrong choice of
.
Theorem
9.6.1 (The Projection Is the Closest
Point)
Let with , let , and let
.
- (a) , and is the
only with .
- (b) For
every , Hence , with equality if
and only if .
- (c) , and .
Try it first (ten minutes): for and we minimized
by
completing the square in . Do the same for
general and : expand as a
quadratic in and
complete the square.
Idea. The attempt succeeds.
Expanding gives , and
completing the square gives (b) with as the constant term.
What it does not show is why the
minimum sits at , or what the constant
term means. The scratch work answers both, as in Example (Method: subtract the projection):
the error at is
orthogonal to ,
and Pythagoras turns the split into the identity. The constant term is
then , the squared distance to the line.
Before reading on: in (a), why is the only such ? Which hypothesis does
that use?
Proof. Since , . In particular , so
is defined.
(a) Let . By linearity
in the first slot, This is
if and only if . Since , this
holds if and only if . So is orthogonal to , and no other has this
property.
(b) Let . By the vector
space laws, By (a) and linearity, , so the two pieces are
orthogonal. Pythagoras (Proposition 9.4.4)
and the rule give where . The last term
is a product of two non-negative reals, so it is . Hence . The last term is if and only if , because
and a field has no zero divisors. That is, it is if and only if , since a non-zero
real has a positive square. Both lengths are
non-negative, and for non-negative numbers comparing
squares compares the numbers. So , with equality exactly when the squares are
equal, that is, when .
(c) Take in (b): . Since , , so , which gives the first claim.
For the second, , since . Hence
. This proves the
theorem.
Uses: Proposition 9.4.1
(a)–(c) (rules for lengths); Proposition 9.3.1
(b), (c) (linearity, positivity); Definition 9.3.2,
Proposition 9.2.1,
Example (Method: expand the square)
(comparing squares). Number Systems: From to , Proposition 4.1.3
(b) (products, squares); Number Systems: From to , Proposition 2.4.3
(b), (e) (sums, non-zero squares); Number Systems: From to , Lemma 4.1.1
(d) (no zero divisors).
Why is the
only such ? By
(a),
is the linear equation , with exactly one solution because
.
Without the
theorem fails: for every
gives the same distance , so the nearest
point is not unique in .
Part (b) says more than “ is nearest”: it
measures exactly what a wrong costs.
Alternatively. Part (c) says ,
that is, . Multiplying by gives
. That is the
Cauchy–Schwarz inequality (Theorem 9.5.1
(a)) again, by a second route. More is true: (c) gives
so the gap between the two sides of
Cauchy–Schwarz is a squared distance, scaled by . Equality
holds exactly when , that is, when lies on the line
through . Exercise
C1 of Section 9.5 (Exercise (C1: Chapter check: Cauchy–Schwarz))
turns this route into a complete second proof of
Cauchy–Schwarz with its equality case.
Example
(Distance to a line through the origin)
Find the point of the line
nearest to , and
the distance from
to the line:
- (a) , ;
- (b) , ; also write
for
every .
Solution. We subtract the
projection, as in Example (Method: subtract the projection),
and use the theorem just proved.
(a)
and ,
so and
. Then
,
and indeed . The distance is , as the completed square at the start
of the section found.
(b) and , so and . Then ; its dot product with is , and . By
the theorem’s (b), for every , So the nearest point is and the
distance is . As a check, at the formula gives .
Lines that do not pass through the origin need one
more step, a translation; Chapter 10 takes them up.
Warning.
is a vector; is
a number. The two are easily confused,
because the number is, up to sign, the length of the
vector (1 (c)). They also behave differently when is rescaled. For : with the number is
, and with it is , while the
projection is both times.
The cosine
of an angle
The projection splits into a piece along
and a piece
orthogonal to it. In the plane picture, , and the origin are the
corners of a right triangle, and school trigonometry
would call the
cosine of the angle at the origin, “adjacent over
hypotenuse”. With the sign of kept, so that the
cosine is negative when points away from , that ratio is The picture is motivation only. The expression
on the right is defined in any as soon as and , and
Cauchy–Schwarz already tells us it lies between and . Before naming it,
compute it on a few cases where the answer is
guessable.
Quick check. Let . Compute
for , for
, and for
.
Solution. . For
: , so the
ratio is . For : and , so the ratio is . For : , so the ratio is . Same direction gives
, opposite
directions give ,
and orthogonal vectors give , as the school cosine
of , of a straight
angle and of a right angle would.
Definition
9.6.2 (Cosine of the Angle between Two
Vectors)
Let with and . The
cosine of the angle between and is the real number
The cosine of the angle is the dot product of the
two directions.
In words: divide the dot product by both lengths. The
symbol is read as one symbol, a
function of the pair . It is not the function
applied to a
number : this chapter defines no angle at all, and
alone means
nothing here.
Well-definedness. Both lengths are
positive, because and (Proposition 9.4.1
(a)), so the quotient exists. Its value lies in . Indeed,
Cauchy–Schwarz (Theorem 9.5.1
(a)) gives . Dividing by
gives , that is, , by the rule for
absolute values in an ordered field (Number Systems:
From to , Number Systems: From to , Proposition 4.1.3
(d)). Without Cauchy–Schwarz, we would not know that
this number lies between and , as a cosine
should.
The computation before the definition gives the first
examples: , , and for
orthogonal non-zero .
When one vector is zero. Keep and replace
by . The dot product is
still , but the
quotient is not
defined. The zero vector has no direction, and this is
why the definition requires . In particular,
“” and “” are not the same statement: the second
allows a zero vector, the first does not.
Why this definition. Dividing by
both lengths makes the number see only
directions, as part (b) below shows. Dividing by one
length, or by none, would let the size of or change the answer.
The properties below are what the name promises.
Proposition
9.6.2 (Properties of the Cosine of an
Angle)
Let be non-zero.
- (a) , and .
- (b) For all with : if , and if .
- (c) if
and only if
for some ;
if and only if for some ; and if
and only if .
- (d) (Law of
cosines.) .
Idea. Part (a) is the method of
normalizing (Example (Method: normalize))
in reverse: the cosine is the dot product of the unit
vectors
and .
Rescaling or
by a non-zero
factor changes the unit vector at most by a sign, which
is (b). Part (c) is the equality case of Cauchy–Schwarz,
and (d) is one expansion of a square.
Proof.
(a) The first
claim is the symmetry of the dot product. By linearity
in each slot, .
(b) Here and (Proposition 9.2.1
(j)), so the left side is defined. By linearity and the
rule , using . If then and the
factor is . If
then
and
the factor is .
(c) Multiplying
by , if and only if . By the equality case of
Cauchy–Schwarz (Theorem 9.5.1
(c)), this holds if and only if or with . Since , it holds if and
only if with
. Also because , so . The case is the same argument
with and part (c′) of the same
theorem, which gives , hence . Finally if
and only if , that is, .
(d) Expand the
square (Example (Method: expand the square)):
, and by the
definition.
Part (d) is the law of cosines of school
trigonometry, now with no triangle and no angle in it:
the “angle” is replaced by its cosine, and the cosine by
a quotient of dot products. When it is
Pythagoras again. Part (b) says that the cosine depends
only on the two lines through and , and on whether each
vector points along its line or against it.
Example
(Cosines of angles)
Compute:
- (a) ;
- (b) ;
- (c) three cosines in
the unit cube , with a corner at the origin. First,
between the body diagonal and the edge
. Second,
between the two body diagonals and ; the second
runs from the corner to the corner . Third, between
the body diagonal and the face diagonal .
Solution.
(a) The dot
product is , and
the lengths are
and , so the
cosine is .
(b) The dot
product is , and both lengths are , so
the cosine is .
(c) . Against : the dot product is
(Proposition 9.3.1
(d)), so the cosine is . Between the
body diagonals: the dot product is , and both
lengths are , so the cosine is . Against the face
diagonal: the dot product is and , so the cosine is .
Each answer is a cosine and nothing more. We do not
convert any of them into an angle, because that needs
the function
itself.
Quick check. What is ? Answer first with Proposition 9.6.2,
then by computing.
Solution. with
, so
the cosine is by
(c). Computing: the dot product is , and both lengths are
, so the
cosine is .
Exercises
A. Check your
understanding
Exercise
(A1)
These questions are about 1 and its proof.
- (a) Why does the
theorem assume ? What goes wrong for ?
- (b) Where in the
proof of (b) is used?
- (c) Check the
identity of (b) for , , at and at .
- (d) Compute , and check that the error is
orthogonal to .
- (e) State the idea
of the proof of (b) in two sentences.
Solution.
(a) The
definition of
divides by , which is
exactly when
. For the statement also
fails: every is
, so
for every , and the minimizing
is not
unique.
(b) In applying
Pythagoras to : Pythagoras needs the two
pieces orthogonal, and uses (a). In the terms
of Example (Method: expand the square),
it makes the cross term zero.
(c) Here , , and
. At
: and . At : and .
(d) and , so the projection is . The error is , and
its dot product with is .
(e) Choose so that the error
is
orthogonal to .
Then any other is that error plus a multiple of , and Pythagoras shows
the extra multiple can only add length.
B. Practice
Exercise
(B1: The median identity)
Let and . Prove that You are given the first half: where the second holds because .
Say which method this is, then complete
it.
Solution. The method is
expand the square (Example (Method: expand the square)).
Write and . Then using (Proposition 9.4.1
(b)) and linearity for . Adding, the cross terms cancel:
the sum is . Finally , so by Proposition 9.4.1
(b), and . This proves the identity. It is the
parallelogram law (Proposition 9.4.5)
applied to and
, read as a
statement about a triangle and the midpoint
of one side.
Exercise
(B2: Prove or disprove)
Let with . Prove or disprove each statement.
- (a) .
- (b) .
- (c) for every with .
- (d) .
- (e) for all non-zero .
- (f) If , then .
Solution. Write .
(a)
True. , and , by
linearity. A point on the line is its own
projection.
(b)
True. By linearity, ; divide by and multiply
by , using the
distributive law (h) of Proposition 9.2.1.
(c)
True. because and (Proposition 9.2.1
(j)). Then and , so
(d)
True. By 1 (c), , and both lengths are
non-negative, so .
(e)
False. Take and . Then , while . The first lies on the line of
, the second on
the line of .
(f)
True. means , so
and (Proposition 9.2.1
(i)).
Exercise
(B3)
- (a) Find the point
of the line nearest to , and the
distance from to the line.
- (b) Let with . Show that there
are at most two real numbers with .
Solution.
(a) With and : and , so , and the
nearest point is (1 (b)). By (c) of the theorem,
since . The distance
is . As
a check, , with , and .
(b) Suppose .
Squaring and expanding (Example (Method: expand the square)),
Consider the polynomial in , with the
indeterminate of
Chapters 6 and 7. Its coefficient of is , since
, so and (Definition 6.3.1).
By Theorem 6.4.1,
the value is
the left side of the display, so every with is a
root of in . By Theorem 7.4.1,
has at most distinct roots. Hence
there are at most two such . (Geometrically: a line
meets a sphere of radius in at most two
points.)
C. Going deeper
Exercise
(C1: Chapter check: the projection theorem)
Let with . Prove that exactly one minimizes , that this
is , and that . Write
the proof from the definitions and the results of
Sections 9.2–9.4, without quoting 1.
Solution (Hint 1). Look for the
that makes the
error
orthogonal to .
Solution (Hint 2). For an arbitrary
, compare with : what is their
difference?
Solution. Since , , so
is defined. By linearity, so . Let . Then , and . By Pythagoras and the
rule , The last term is , and it is only if , because and a
square of a non-zero real is positive. So for every , with equality only at
. Lengths
are non-negative, so the same holds for the lengths
themselves. Hence minimizes , and every
gives a
strictly larger value, so the minimizer is unique.
Completing the square in is an acceptable second
route for the identity: . It
receives the points for the identity, minimality and
uniqueness; the orthogonality must still be checked
separately.
What a complete answer needs. (10
points)
- 2: finds
from the orthogonality condition (or states it), and
justifies dividing by through .
- 2: verifies .
- 3: proves the identity for
every (by Pythagoras or by
completing the square).
- 2: deduces minimality and uniqueness, using for the
strict inequality when .
- 1: concludes, passing from squares to lengths with
non-negativity.
Slips that lose the step (0 for the
step):
- a division by with no
mention of ;
- derivatives, which are not available in this
book;
- “the vertex of a parabola is the minimum” without
the identity that proves it.
Exercise
(C2: The distance to a line in the plane)
Let with , and .
- (a) Prove that
- (b) Deduce that for
the distance
from to the line
is .
Solution (Hint 1). Both sides of
(a) are equal to the same third expression, which
involves only , and .
Solution (Hint 2). For (a), start
from and multiply by . For (b), list
the four terms of the double sum when .
Solution.
(a) By 1 (c),
. Multiplying by , By Lagrange’s identity (Exercise (C2: Lagrange’s identity)),
the right side is , since
, and .
(b) For , the terms with
are . The terms with and are and
, which are equal. So the right side
of (a) is . By
1 (b), the distance from to the line is . Taking
non-negative square roots gives , since and
the root of a product is the product of the roots.
Dividing by gives the claim. For and it gives , as in Example (Distance to a line through the origin).
The number is the base times the height
: in
the picture, the area of the parallelogram spanned by
and . Area is not defined in
this book; later volumes meet this number again as a
determinant.
R. Review
Exercise
(R1)
Let with , let , let , and
let for . Prove that is strictly increasing
on .
Solution. Let . By 1
(b), , and likewise for . Factoring out (Example (Method: factor out y − x))
gives Here and . Also , since
and
. The
sum is strict because one summand is. So . Both
and are non-negative, so
.
This is the definition of strictly increasing on (Definition 8.2.1).
By the same factorization, is strictly decreasing
on .
Exercise
(R2)
Fix ,
and define by . Show that is a homomorphism
from to
, find its
kernel, and decide for which and it is injective.
Solution. The brackets here are the
dot product of Definition 9.3.1,
not a subgroup generated by an element.
is a
group (Definition 5.1.1).
Associativity, the identity and the inverse are laws (a), (c) and
(d) of Proposition 9.2.1,
and law (b) makes it abelian. So is . By linearity of
the dot product, , so is a homomorphism
(Definition 5.3.1).
Its kernel is .
If , the
kernel is all of . Let . If , , and
forces ; the kernel is
. If , the kernel
contains a non-zero vector: if , take ,
with and second coordinate ; if , take , with .
By Proposition 5.3.3,
is
injective if and only if and .
Exercise
(R3)
Let
with . Prove
that is a
non-negative real number if and only if for some real
.
Solution. If with , , then , because the
imaginary part of
is . So by Theorem 3.2.2 (b)
and (c), , a
non-negative real.
Let
with ,
. By Theorem 3.2.2 (a)
and (b), . Since , (Theorem 3.2.2 (c),
(e)), so With , a non-negative real, . The product of
the real number with
in is the
scalar multiple
in , by Proposition 9.4.3
(a).
Chapter 3 found the first condition as the equality
case of (Exercise (B1: The equality case)).
Then Theorem 9.5.3
(a) found the second, “ or with ”, for . For this exercise shows the two conditions agree,
and for both
hold. So the two chapters’ equality cases are one
statement.
Exercise
(R4)
Find all with and .
Solution. The only solution is
. It works, since both sums are . Let , so . The two conditions say and
.
By Cauchy–Schwarz (Theorem 9.5.1
(a)), so equality holds: . By Theorem 9.5.1
(c), or with ; since , . Then , so
and .
A second route expands a square (Example (Method: expand the square)):
.
So , because
only the zero vector has length (Proposition 9.4.1
(a)).
The tool is Cauchy–Schwarz with its equality case,
because each condition mixes all the coordinates. The
look-alike tool, working coordinatewise (Example (Method: work coordinatewise)),
finds nothing to hold on to: neither condition says
anything about a single .