Linear Algebra/Orthogonal Projection Onto a Line/Solutions

Solutions

This exercise is recommended for all readers.
Problem 1

Project the first vector orthogonally onto the line spanned by the second vector.

1. ${\displaystyle {\begin{pmatrix}2\\1\end{pmatrix}}}$, ${\displaystyle {\begin{pmatrix}3\\-2\end{pmatrix}}}$
2. ${\displaystyle {\begin{pmatrix}2\\1\end{pmatrix}}}$, ${\displaystyle {\begin{pmatrix}3\\0\end{pmatrix}}}$
3. ${\displaystyle {\begin{pmatrix}1\\1\\4\end{pmatrix}}}$, ${\displaystyle {\begin{pmatrix}1\\2\\-1\end{pmatrix}}}$
4. ${\displaystyle {\begin{pmatrix}1\\1\\4\end{pmatrix}}}$, ${\displaystyle {\begin{pmatrix}3\\3\\12\end{pmatrix}}}$

Each is a straightforward application of the formula from Definition 1.1.

1. ${\displaystyle \displaystyle {\frac {{\begin{pmatrix}2\\1\end{pmatrix}}\cdot {\begin{pmatrix}3\\-2\end{pmatrix}}}{{\begin{pmatrix}3\\-2\end{pmatrix}}\cdot {\begin{pmatrix}3\\-2\end{pmatrix}}}}\cdot {\begin{pmatrix}3\\-2\end{pmatrix}}={\frac {4}{13}}\cdot {\begin{pmatrix}3\\-2\end{pmatrix}}={\begin{pmatrix}12/13\\-8/13\end{pmatrix}}}$
2. ${\displaystyle \displaystyle {\frac {{\begin{pmatrix}2\\1\end{pmatrix}}\cdot {\begin{pmatrix}3\\0\end{pmatrix}}}{{\begin{pmatrix}3\\0\end{pmatrix}}\cdot {\begin{pmatrix}3\\0\end{pmatrix}}}}\cdot {\begin{pmatrix}3\\0\end{pmatrix}}={\frac {2}{3}}\cdot {\begin{pmatrix}3\\0\end{pmatrix}}={\begin{pmatrix}2\\0\end{pmatrix}}}$
3. ${\displaystyle \displaystyle {\frac {{\begin{pmatrix}1\\1\\4\end{pmatrix}}\cdot {\begin{pmatrix}1\\2\\-1\end{pmatrix}}}{{\begin{pmatrix}1\\2\\-1\end{pmatrix}}\cdot {\begin{pmatrix}1\\2\\-1\end{pmatrix}}}}\cdot {\begin{pmatrix}1\\2\\-1\end{pmatrix}}={\frac {-1}{6}}\cdot {\begin{pmatrix}1\\2\\-1\end{pmatrix}}={\begin{pmatrix}-1/6\\-1/3\\1/6\end{pmatrix}}}$
4. ${\displaystyle \displaystyle {\frac {{\begin{pmatrix}1\\1\\4\end{pmatrix}}\cdot {\begin{pmatrix}3\\3\\12\end{pmatrix}}}{{\begin{pmatrix}3\\3\\12\end{pmatrix}}\cdot {\begin{pmatrix}3\\3\\12\end{pmatrix}}}}\cdot {\begin{pmatrix}3\\3\\12\end{pmatrix}}={\frac {1}{3}}\cdot {\begin{pmatrix}3\\3\\12\end{pmatrix}}={\begin{pmatrix}1\\1\\4\end{pmatrix}}}$
This exercise is recommended for all readers.
Problem 2

Project the vector orthogonally onto the line.

1. ${\displaystyle {\begin{pmatrix}2\\-1\\4\end{pmatrix}},\{c{\begin{pmatrix}-3\\1\\-3\end{pmatrix}}\,{\big |}\,c\in \mathbb {R} \}}$
2. ${\displaystyle {\begin{pmatrix}-1\\-1\end{pmatrix}}}$, the line ${\displaystyle y=3x}$
1. ${\displaystyle \displaystyle {\frac {{\begin{pmatrix}2\\-1\\4\end{pmatrix}}\cdot {\begin{pmatrix}-3\\1\\-3\end{pmatrix}}}{{\begin{pmatrix}-3\\1\\-3\end{pmatrix}}\cdot {\begin{pmatrix}-3\\1\\-3\end{pmatrix}}}}\cdot {\begin{pmatrix}-3\\1\\-3\end{pmatrix}}={\frac {-19}{19}}\cdot {\begin{pmatrix}-3\\1\\-3\end{pmatrix}}={\begin{pmatrix}3\\-1\\3\end{pmatrix}}}$
2. Writing the line as ${\displaystyle \{c\cdot {\begin{pmatrix}1\\3\end{pmatrix}}\,{\big |}\,c\in \mathbb {R} \}}$ gives this projection.
${\displaystyle {\frac {{\begin{pmatrix}-1\\-1\end{pmatrix}}\cdot {\begin{pmatrix}1\\3\end{pmatrix}}}{{\begin{pmatrix}1\\3\end{pmatrix}}\cdot {\begin{pmatrix}1\\3\end{pmatrix}}}}\cdot {\begin{pmatrix}1\\3\end{pmatrix}}={\frac {-4}{10}}\cdot {\begin{pmatrix}1\\3\end{pmatrix}}={\begin{pmatrix}-2/5\\-6/5\end{pmatrix}}}$
Problem 3

Although the development of Definition 1.1 is guided by the pictures, we are not restricted to spaces that we can draw. In ${\displaystyle \mathbb {R} ^{4}}$ project this vector onto this line.

${\displaystyle {\vec {v}}={\begin{pmatrix}1\\2\\1\\3\end{pmatrix}}\qquad \ell =\{c\cdot {\begin{pmatrix}-1\\1\\-1\\1\end{pmatrix}}\,{\big |}\,c\in \mathbb {R} \}}$

${\displaystyle \displaystyle {\frac {{\begin{pmatrix}1\\2\\1\\3\end{pmatrix}}\cdot {\begin{pmatrix}-1\\1\\-1\\1\end{pmatrix}}}{{\begin{pmatrix}-1\\1\\-1\\1\end{pmatrix}}\cdot {\begin{pmatrix}-1\\1\\-1\\1\end{pmatrix}}}}\cdot {\begin{pmatrix}-1\\1\\-1\\1\end{pmatrix}}={\frac {3}{4}}\cdot {\begin{pmatrix}-1\\1\\-1\\1\end{pmatrix}}={\begin{pmatrix}-3/4\\3/4\\-3/4\\3/4\end{pmatrix}}}$

This exercise is recommended for all readers.
Problem 4

Definition 1.1 uses two vectors ${\displaystyle {\vec {s}}}$ and ${\displaystyle {\vec {v}}}$. Consider the transformation of ${\displaystyle \mathbb {R} ^{2}}$ resulting from fixing

${\displaystyle {\vec {s}}={\begin{pmatrix}3\\1\end{pmatrix}}}$

and projecting ${\displaystyle {\vec {v}}}$ onto the line that is the span of ${\displaystyle {\vec {s}}}$. Apply it to these vectors.

1. ${\displaystyle {\begin{pmatrix}1\\2\end{pmatrix}}}$
2. ${\displaystyle {\begin{pmatrix}0\\4\end{pmatrix}}}$

Show that in general the projection tranformation is this.

${\displaystyle {\begin{pmatrix}x_{1}\\x_{2}\end{pmatrix}}\mapsto {\begin{pmatrix}(x_{1}+3x_{2})/10\\(3x_{1}+9x_{2})/10\end{pmatrix}}}$

Express the action of this transformation with a matrix.

1. ${\displaystyle \displaystyle {\frac {{\begin{pmatrix}1\\2\end{pmatrix}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}}{{\begin{pmatrix}3\\1\end{pmatrix}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}={\frac {1}{2}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}={\begin{pmatrix}3/2\\1/2\end{pmatrix}}}$
2. ${\displaystyle \displaystyle {\frac {{\begin{pmatrix}0\\4\end{pmatrix}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}}{{\begin{pmatrix}3\\1\end{pmatrix}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}={\frac {2}{5}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}={\begin{pmatrix}6/5\\2/5\end{pmatrix}}}$

In general the projection is this.

${\displaystyle {\frac {{\begin{pmatrix}x_{1}\\x_{2}\end{pmatrix}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}}{{\begin{pmatrix}3\\1\end{pmatrix}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}={\frac {3x_{1}+x_{2}}{10}}\cdot {\begin{pmatrix}3\\1\end{pmatrix}}={\begin{pmatrix}(9x_{1}+3x_{2})/10\\(3x_{1}+x_{2})/10\end{pmatrix}}}$

The appropriate matrix is this.

${\displaystyle {\begin{pmatrix}9/10&3/10\\3/10&1/10\end{pmatrix}}}$
Problem 5

Example 1.5 suggests that projection breaks ${\displaystyle {\vec {v}}}$ into two parts, ${\displaystyle {\mbox{proj}}_{[{\vec {s}}\,]}({{\vec {v}}\,})}$ and ${\displaystyle {\vec {v}}-{\mbox{proj}}_{[{\vec {s}}\,]}({{\vec {v}}\,})}$, that are "not interacting". Recall that the two are orthogonal. Show that any two nonzero orthogonal vectors make up a linearly independent set.

Suppose that ${\displaystyle {\vec {v}}_{1}}$ and ${\displaystyle {\vec {v}}_{2}}$ are nonzero and orthogonal. Consider the linear relationship ${\displaystyle c_{1}{\vec {v}}_{1}+c_{2}{\vec {v}}_{2}={\vec {0}}}$. Take the dot product of both sides of the equation with ${\displaystyle {\vec {v}}_{1}}$ to get that

${\displaystyle {\vec {v}}_{1}\cdot (c_{1}{\vec {v}}_{1}+c_{2}{\vec {v}}_{2})=c_{1}\cdot ({\vec {v}}_{1}\cdot {\vec {v}}_{1})+c_{2}\cdot ({\vec {v}}_{1}\cdot {\vec {v}}_{2})=c_{1}\cdot ({\vec {v}}_{1}\cdot {\vec {v}}_{1})+c_{2}\cdot 0=c_{1}\cdot ({\vec {v}}_{1}\cdot {\vec {v}}_{1})}$

is equal to ${\displaystyle {\vec {v}}_{1}\cdot {\vec {0}}={\vec {0}}}$. With the assumption that ${\displaystyle {\vec {v}}_{1}}$ is nonzero, this gives that ${\displaystyle c_{1}}$ is zero. Showing that ${\displaystyle c_{2}}$ is zero is similar.

Problem 6
1. What is the orthogonal projection of ${\displaystyle {\vec {v}}}$ onto a line if ${\displaystyle {\vec {v}}}$ is a member of that line?
2. Show that if ${\displaystyle {\vec {v}}}$ is not a member of the line then the set ${\displaystyle \{{\vec {v}},{\vec {v}}-{\mbox{proj}}_{[{\vec {s}}\,]}({{\vec {v}}\,})\}}$ is linearly independent.
1. If the vector ${\displaystyle {\vec {v}}\,}$ is in the line then the orthogonal projection is ${\displaystyle {\vec {v}}}$. To verify this by calculation, note that since ${\displaystyle {\vec {v}}\,}$ is in the line we have that ${\displaystyle {\vec {v}}=c_{\vec {v}}\cdot {\vec {s}}\,}$ for some scalar ${\displaystyle c_{\vec {v}}}$.
${\displaystyle {\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}={\frac {c_{\vec {v}}\cdot {\vec {s}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}=c_{\vec {v}}\cdot {\frac {{\vec {s}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}=c_{\vec {v}}\cdot 1\cdot {\vec {s}}={\vec {v}}}$
(Remark. If we assume that ${\displaystyle {\vec {v}}\,}$ is nonzero then the above is simplified on taking ${\displaystyle {\vec {s}}\,}$ to be ${\displaystyle {\vec {v}}}$.)
2. Write ${\displaystyle c_{\vec {p}}{\vec {s}}\,}$ for the projection ${\displaystyle {\mbox{proj}}_{[{\vec {s}}\,]}({\vec {v}})}$. Note that, by the assumption that ${\displaystyle {\vec {v}}}$ is not in the line, both ${\displaystyle {\vec {v}}}$ and ${\displaystyle {\vec {v}}-c_{\vec {p}}{\vec {s}}\,}$ are nonzero. Note also that if ${\displaystyle c_{\vec {p}}\,}$ is zero then we are actually considering the one-element set ${\displaystyle \{{\vec {v}}\,\}}$, and with ${\displaystyle {\vec {v}}}$ nonzero, this set is necessarily linearly independent. Therefore, we are left considering the case that ${\displaystyle c_{\vec {p}}}$ is nonzero. Setting up a linear relationship
${\displaystyle a_{1}({\vec {v}})+a_{2}({\vec {v}}-c_{\vec {p}}{\vec {s}})={\vec {0}}}$
leads to the equation ${\displaystyle (a_{1}+a_{2})\cdot {\vec {v}}=a_{2}c_{\vec {p}}\cdot {\vec {s}}}$. Because ${\displaystyle {\vec {v}}\,}$ isn't in the line, the scalars ${\displaystyle a_{1}+a_{2}}$ and ${\displaystyle a_{2}c_{\vec {p}}}$ must both be zero. The ${\displaystyle c_{\vec {p}}=0}$ case is handled above, so the remaining case is that ${\displaystyle a_{2}=0}$, and this gives that ${\displaystyle a_{1}=0}$ also. Hence the set is linearly independent.
Problem 7

Definition 1.1 requires that ${\displaystyle {\vec {s}}\,}$ be nonzero. Why? What is the right definition of the orthogonal projection of a vector onto the (degenerate) line spanned by the zero vector?

If ${\displaystyle {\vec {s}}\,}$ is the zero vector then the expression

${\displaystyle {\mbox{proj}}_{[{\vec {s}}\,]}({\vec {v}})={\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}}$

contains a division by zero, and so is undefined. As for the right definition, for the projection to lie in the span of the zero vector, it must be defined to be ${\displaystyle {\vec {0}}}$.

Problem 8

Are all vectors the projection of some other vector onto some line?

Any vector in ${\displaystyle \mathbb {R} ^{n}}$ is the projection of some other onto a line, provided that the dimension ${\displaystyle n}$ is greater than one. (Clearly, any vector is the projection of itself into a line containing itself; the question is to produce some vector other than ${\displaystyle {\vec {v}}}$ that projects to ${\displaystyle {\vec {v}}}$.)

Suppose that ${\displaystyle {\vec {v}}\in \mathbb {R} ^{n}}$ with ${\displaystyle n>1}$. If ${\displaystyle {\vec {v}}\neq {\vec {0}}}$ then we consider the line ${\displaystyle \ell =\{c{\vec {v}}\,{\big |}\,c\in \mathbb {R} \}}$ and if ${\displaystyle {\vec {v}}={\vec {0}}}$ we take ${\displaystyle \ell }$ to be any (nondegenerate) line at all (actually, we needn't distinguish between these two cases— see the prior exercise). Let ${\displaystyle v_{1},\dots ,v_{n}}$ be the components of ${\displaystyle {\vec {v}}}$; since ${\displaystyle n>1}$, there are at least two. If some ${\displaystyle v_{i}}$ is zero then the vector ${\displaystyle {\vec {w}}={\vec {e}}_{i}}$ is perpendicular to ${\displaystyle {\vec {v}}}$. If none of the components is zero then the vector ${\displaystyle {\vec {w}}\,}$ whose components are ${\displaystyle v_{2},-v_{1},0,\dots ,0}$ is perpendicular to ${\displaystyle {\vec {v}}}$. In either case, observe that ${\displaystyle {\vec {v}}+{\vec {w}}}$ does not equal ${\displaystyle {\vec {v}}}$, and that ${\displaystyle {\vec {v}}}$ is the projection of ${\displaystyle {\vec {v}}+{\vec {w}}}$ onto ${\displaystyle \ell }$.

${\displaystyle {\frac {({\vec {v}}+{\vec {w}})\cdot {\vec {v}}}{{\vec {v}}\cdot {\vec {v}}}}\cdot {\vec {v}}={\bigl (}{\frac {{\vec {v}}\cdot {\vec {v}}}{{\vec {v}}\cdot {\vec {v}}}}+{\frac {{\vec {w}}\cdot {\vec {v}}}{{\vec {v}}\cdot {\vec {v}}}}{\bigr )}\cdot {\vec {v}}={\frac {{\vec {v}}\cdot {\vec {v}}}{{\vec {v}}\cdot {\vec {v}}}}\cdot {\vec {v}}={\vec {v}}}$

We can dispose of the remaining ${\displaystyle n=0}$ and ${\displaystyle n=1}$ cases. The dimension ${\displaystyle n=0}$ case is the trivial vector space, here there is only one vector and so it cannot be expressed as the projection of a different vector. In the dimension ${\displaystyle n=1}$ case there is only one (nondegenerate) line, and every vector is in it, hence every vector is the projection only of itself.

This exercise is recommended for all readers.
Problem 9

Show that the projection of ${\displaystyle {\vec {v}}}$ onto the line spanned by ${\displaystyle {\vec {s}}}$ has length equal to the absolute value of the number ${\displaystyle {\vec {v}}\cdot {\vec {s}}}$ divided by the length of the vector ${\displaystyle {\vec {s}}}$.

The proof is simply a calculation.

${\displaystyle |{\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}\,|=|{\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}|\cdot |{\vec {s}}\,|={\frac {|{\vec {v}}\cdot {\vec {s}}\,|}{|{\vec {s}}\,|^{2}}}\cdot |{\vec {s}}\,|={\frac {|{\vec {v}}\cdot {\vec {s}}\,|}{|{\vec {s}}\,|}}}$
Problem 10

Find the formula for the distance from a point to a line.

Because the projection of ${\displaystyle {\vec {v}}}$ onto the line spanned by ${\displaystyle {\vec {s}}}$ is

${\displaystyle {\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}}$

the distance squared from the point to the line is this (a vector dotted with itself ${\displaystyle {\vec {w}}\cdot {\vec {w}}}$ is written ${\displaystyle {\vec {w}}^{2}}$).

${\displaystyle {\begin{array}{rl}|{\vec {v}}-{\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}\,|^{2}&={\vec {v}}\cdot {\vec {v}}-{\vec {v}}\cdot ({\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}})-({\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}\,)\cdot {\vec {v}}+({\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}\,)^{2}\\&={\vec {v}}\cdot {\vec {v}}-2\cdot ({\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}})\cdot {\vec {v}}\cdot {\vec {s}}+({\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}})\cdot {\vec {s}}\cdot {\vec {s}}\\&={\frac {({\vec {v}}\cdot {\vec {v}}\,)\cdot ({\vec {s}}\cdot {\vec {s}}\,)-2\cdot ({\vec {v}}\cdot {\vec {s}}\,)^{2}+({\vec {v}}\cdot {\vec {s}}\,)^{2}}{{\vec {s}}\cdot {\vec {s}}}}\\&={\frac {({\vec {v}}\cdot {\vec {v}}\,)({\vec {s}}\cdot {\vec {s}}\,)-({\vec {v}}\cdot {\vec {s}}\,)^{2}}{{\vec {s}}\cdot {\vec {s}}}}\end{array}}}$
Problem 11

Find the scalar ${\displaystyle c}$ such that ${\displaystyle (cs_{1},cs_{2})}$ is a minimum distance from the point ${\displaystyle (v_{1},v_{2})}$ by using calculus (i.e., consider the distance function, set the first derivative equal to zero, and solve). Generalize to ${\displaystyle \mathbb {R} ^{n}}$.

Because square root is a strictly increasing function, we can minimize ${\displaystyle d(c)=(cs_{1}-v_{1})^{2}+(cs_{2}-v_{2})^{2}}$ instead of the square root of ${\displaystyle d}$. The derivative is ${\displaystyle dd/dc=2(cs_{1}-v_{1})\cdot s_{1}+2(cs_{2}-v_{2})\cdot s_{2}}$. Setting it equal to zero ${\displaystyle 2(cs_{1}-v_{1})\cdot s_{1}+2(cs_{2}-v_{2})\cdot s_{2}=c\cdot (2s_{1}^{2}+2s_{2}^{2})-(v_{1}s_{1}+v_{2}s_{2})=0}$ gives the only critical point.

${\displaystyle c={\frac {v_{1}s_{1}+v_{2}s_{2}}{{s_{1}}^{2}+{s_{2}}^{2}}}={\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}}$

Now the second derivative with respect to ${\displaystyle c}$

${\displaystyle {\frac {d^{2}\,d}{dc^{2}}}=2{s_{1}}^{2}+2{s_{2}}^{2}}$

is strictly positive (as long as neither ${\displaystyle s_{1}}$ nor ${\displaystyle s_{2}}$ is zero, in which case the question is trivial) and so the critical point is a minimum.

The generalization to ${\displaystyle \mathbb {R} ^{n}}$ is straightforward. Consider ${\displaystyle d_{n}(c)=(cs_{1}-v_{1})^{2}+\dots +(cs_{n}-v_{n})^{2}}$, take the derivative, etc.

This exercise is recommended for all readers.
Problem 12

Prove that the orthogonal projection of a vector onto a line is shorter than the vector.

The Cauchy-Schwarz inequality ${\displaystyle |{\vec {v}}\cdot {\vec {s}}\,|\leq |{\vec {v}}\,|\cdot |{\vec {s}}\,|}$ gives that this fraction

${\displaystyle |{\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}\cdot {\vec {s}}\,|=|{\frac {{\vec {v}}\cdot {\vec {s}}}{{\vec {s}}\cdot {\vec {s}}}}|\cdot |{\vec {s}}\,|={\frac {|{\vec {v}}\cdot {\vec {s}}\,|}{|{\vec {s}}\,|^{2}}}\cdot |{\vec {s}}\,|={\frac {|{\vec {v}}\cdot {\vec {s}}\,|}{|{\vec {s}}\,|}}}$

when divided by ${\displaystyle |{\vec {v}}\,|}$ is less than or equal to one. That is, ${\displaystyle |{\vec {v}}\,|}$ is larger than or equal to the fraction.

This exercise is recommended for all readers.
Problem 13

Show that the definition of orthogonal projection onto a line does not depend on the spanning vector: if ${\displaystyle {\vec {s}}}$ is a nonzero multiple of ${\displaystyle {\vec {q}}}$ then ${\displaystyle ({\vec {v}}\cdot {\vec {s}}/{\vec {s}}\cdot {\vec {s}}\,)\cdot {\vec {s}}}$ equals ${\displaystyle ({\vec {v}}\cdot {\vec {q}}/{\vec {q}}\cdot {\vec {q}}\,)\cdot {\vec {q}}}$.

Write ${\displaystyle c{\vec {s}}}$ for ${\displaystyle {\vec {q}}}$, and calculate: ${\displaystyle ({\vec {v}}\cdot c{\vec {s}}/c{\vec {s}}\cdot c{\vec {s}}\,)\cdot c{\vec {s}}=({\vec {v}}\cdot {\vec {s}}/{\vec {s}}\cdot {\vec {s}}\,)\cdot {\vec {s}}}$.

This exercise is recommended for all readers.
Problem 14

Consider the function mapping to plane to itself that takes a vector to its projection onto the line ${\displaystyle y=x}$. These two each show that the map is linear, the first one in a way that is bound to the coordinates (that is, it fixes a basis and then computes) and the second in a way that is more conceptual.

1. Produce a matrix that describes the function's action.
2. Show also that this map can be obtained by first rotating everything in the plane ${\displaystyle \pi /4}$ radians clockwise, then projecting onto the ${\displaystyle x}$-axis, and then rotating ${\displaystyle \pi /4}$ radians counterclockwise.
1. Fixing
${\displaystyle {\vec {s}}={\begin{pmatrix}1\\1\end{pmatrix}}}$
as the vector whose span is the line, the formula gives this action,
${\displaystyle {\begin{pmatrix}x\\y\end{pmatrix}}\mapsto {\frac {{\begin{pmatrix}x\\y\end{pmatrix}}\cdot {\begin{pmatrix}1\\1\end{pmatrix}}}{{\begin{pmatrix}1\\1\end{pmatrix}}\cdot {\begin{pmatrix}1\\1\end{pmatrix}}}}\cdot {\begin{pmatrix}1\\1\end{pmatrix}}={\frac {x+y}{2}}\cdot {\begin{pmatrix}1\\1\end{pmatrix}}={\begin{pmatrix}(x+y)/2\\(x+y)/2\end{pmatrix}}}$
which is the effect of this matrix.
${\displaystyle {\begin{pmatrix}1/2&1/2\\1/2&1/2\end{pmatrix}}}$
2. Rotating the entire plane ${\displaystyle \pi /4}$ radians clockwise brings the ${\displaystyle y=x}$ line to lie on the ${\displaystyle x}$-axis. Now projecting and then rotating back has the desired effect.
Problem 15

For ${\displaystyle {\vec {a}},{\vec {b}}\in \mathbb {R} ^{n}}$ let ${\displaystyle {\vec {v}}_{1}}$ be the projection of ${\displaystyle {\vec {a}}}$ onto the line spanned by ${\displaystyle {\vec {b}}}$, let ${\displaystyle {\vec {v}}_{2}}$ be the projection of ${\displaystyle {\vec {v}}_{1}}$ onto the line spanned by ${\displaystyle {\vec {a}}}$, let ${\displaystyle {\vec {v}}_{3}}$ be the projection of ${\displaystyle {\vec {v}}_{2}}$ onto the line spanned by ${\displaystyle {\vec {b}}}$, etc., back and forth between the spans of ${\displaystyle {\vec {a}}}$ and ${\displaystyle {\vec {b}}}$. That is, ${\displaystyle {\vec {v}}_{i+1}}$ is the projection of ${\displaystyle {\vec {v}}_{i}}$ onto the span of ${\displaystyle {\vec {a}}}$ if ${\displaystyle i+1}$ is even, and onto the span of ${\displaystyle {\vec {b}}}$ if ${\displaystyle i+1}$ is odd. Must that sequence of vectors eventually settle down— must there be a sufficiently large ${\displaystyle i}$ such that ${\displaystyle {\vec {v}}_{i+2}}$ equals ${\displaystyle {\vec {v}}_{i}}$ and ${\displaystyle {\vec {v}}_{i+3}}$ equals ${\displaystyle {\vec {v}}_{i+1}}$? If so, what is the earliest such ${\displaystyle i}$?

${\displaystyle {\vec {a}}={\begin{pmatrix}1\\0\end{pmatrix}}\qquad {\vec {b}}={\begin{pmatrix}1\\1\end{pmatrix}}}$
${\displaystyle {\vec {v}}_{1}={\begin{pmatrix}1/2\\1/2\end{pmatrix}},\quad {\vec {v}}_{2}={\begin{pmatrix}1/2\\0\end{pmatrix}},\quad {\vec {v}}_{3}={\begin{pmatrix}1/4\\1/4\end{pmatrix}},\quad \ldots }$