## Dot product and projections

I’m finally getting to the end of the material on vectors in my first year course: 6 planned lectures turned into 8.5. My original plan was to make systematic use of the following lemma: if $\mathbf{n}$ is a unit length vector then $\mathbf{v} = (\mathbf{n} \cdot \mathbf{v}) \mathbf{n} + \bigl( \mathbf{v} - (\mathbf{n} \cdot \mathbf{v}) \mathbf{n})$ expresses $\mathbf{v} \in \mathbb{R}^n$ as a linear combination of a vector parallel to $\mathbf{n}$ and a vector perpendicular to $\mathbf{n}$. In particular, the length of $\mathbf{v}$ in the direction of $\mathbf{n}$‘ is $\mathbf{n} \cdot \mathbf{v}$.

Typed out here this still seems to make good sense, and I find it very helpful to think primarily in terms of the projection map $\mathbf{v} \mapsto (\mathbf{n} \cdot \mathbf{v})\mathbf{n}$. But I think the lemma was found to be unmotivated and so people switched off for the proof; it then never seemed right to use it in lectures. Perhaps the problem was introducing it too soon after the definition of the dot product. Anyway, instead I ended up running the argument to prove the lemma each time. My conclusion, for the moment, is that this wasn’t such a bad thing.

Today (a double billing, I started writing this between lectures) the lemma was used to find the distance between two skew-lines and the volume of a parallelepiped. For the latter, I made a fresh attempt at isolating the idea, in a new, more specialized lemma, and I think it went down much better.

#### Lemma

Let $OPC$ be a right-angled triangle with hypotenuse $OC$. Let $\mathbf{n}$ be a vector of unit length parallel to $PC$. The length of $PC$ is $\mathbf{n} \cdot \vec{OP}$.

It’s easy to complicate the proof by juggling with scaling factors. Of course any ‘extra’ lines are utter trivialities, but when every step halves the chance of the students getting anywhere …

#### Proof

We have $\vec{OC} = \vec{OP} + \vec{PC}$. Here $\vec{PC}$ is parallel to $\mathbf{n}$ and $\vec{OP}$ is perpendicular. Hence

$\mathbf{n} \cdot \vec{OC} = \mathbf{n} \cdot \vec{OP} + \mathbf{n} \cdot \vec{PC} = \mathbf{n} \cdot \vec{PC}.$

Let $\vec{PC} = \mu \mathbf{n}$, so (1) $||\vec{PC}|| = \mu$ and (2)
$\mathbf{n} \cdot \vec{PC} = \mathbf{n} \cdot (\mu \mathbf{n}) = \mu \mathbf{n} \cdot \mathbf{n} = \mu$. By (1), then (2), then the displayed equation, we get

$||\vec{PC}|| = \mu = \mathbf{n} \cdot \vec{PC} = \mathbf{n} \cdot \vec{OC}$

as required. $\Box$

### Applications of the new-style lemma.

#### Distance of point $C$ from plane through origin with unit normal $\mathbf{n}$

The closest point $P$ makes a right-angled triangle exactly as in the lemma.

#### Volume of parallelepiped formed by $\mathbf{a}$, $\mathbf{b}$, $\mathbf{c}$

The volume of the base is $|| \mathbf{a} \times \mathbf{b}||$, and the height is $|| \vec{PC}||$ where $\vec{OC} = \mathbf{c}$ and $P$ is the closest point in the plane through the origin with normal $\mathbf{a} \times \mathbf{b}$.

#### Interpretation of $\alpha$ in $\Pi = \{ \mathbf{v} \in \mathbb{R}^3 : \mathbf{n} \cdot \mathbf{v} = \alpha \}$

No triangle is necessary, but the idea is close to the proof: if $P$ is the closest point in $\Pi$ to the origin then, since $\vec{OP}$ is parallel to $\mathbf{n}$, we have $||\vec{OP}|| = \mathbf{n} \cdot \vec{OP} = \alpha$.

### Problems that do not fit

#### Distance of point $C$ from a line through the origin

If $P$ is the closest point then we now know the direction of $\vec{OP}$ (since $\vec{OP}$ is in the direction of the line) rather than $\vec{CP}$. So it’s just sufficiently different from the lemma to be potentially confusing.

#### Distance between two non-parallel lines

If the lines go through $\mathbf{a}$ and $\mathbf{a}'$ and have directions $\mathbf{c}$ and $\mathbf{c}'$ then the vector between the two closest points is in direction $\mathbf{n} = (\mathbf{c} \times \mathbf{c}')/||\mathbf{c} \times \mathbf{c}'||$, and the shortest distance is

$\mathbf{n} \cdot \bigl( (\mathbf{a}' + \lambda' \mathbf{c}') - (\mathbf{a} + \lambda \mathbf{c}) \bigr) = \mathbf{n} \cdot (\mathbf{a'} - \mathbf{a} ) = \frac{\mathbf{c} \times \mathbf{c}'}{||\mathbf{c} \times \mathbf{c}'||} \cdot (\mathbf{a}'-\mathbf{a}).$

The final cancellation is nice to see, so I wouldn’t even want to use the lemma here.

Advertisements

### 2 Responses to Dot product and projections

1. George Wellen says:

My short (3-year) experience of teaching vector algebra to 17 year-olds taking “Further Maths” A-level taught me that intuition on the absolute basics seems to make a huge difference here. After some trial-and-error and some google searches on how to explain, I found that simply explaining the vector equation of a line as a train track often caused a “penny drop” moment with resulting immediate cascade of understanding in the child’s mind.

$\underline{v} = \underline{a} + k\underline{b}.$

First note I use $k$ instead of $\lambda$. As trivial as it is, some kids immediately switch off if they see something unfamiliar, like a Greek letter.

Second, what does this mean? Draw a picture. It’s a train track. How do you go along a train track? Well, first you get onto the track (walk along \underline{a} from your starting position at the origin), and then you walk the distance you want ($k$) along the track ($\underline{b}$).

Note that this explanation clearly explains why the same line can be defined by different choices of $\underline{a}$ and different choices of $\underline{b}$ (scalings). (I am convinced this last point confuses them badly. How can the same object be represented in so many arbitrary ways?) The train track analogy (with picture) makes it absurdly trivial, because it’s always the same train track; I even had some feedback from a kid who had been hopelessly lost, saying something like, “but sir that is so obvious, I thought there was more to it, why are we even learning it?”, to which I of course replied, “yes you are right, it is obvious.”

Educators reading this can take it or live it. I am convinced in my own mind of two things:

1. elementary vector calculus is indeed elementary, more so than many other things that kids learn before vector algebra; and

2. kids are not stupid – if they don’t get it, we aren’t telling the story right.

2. mwildon says:

Thank you for a very insightful and helpful comment! I agree especially with 1: it feels like I’m lecturing a much more basic course than my old first year course, which was more a general introduction to pure mathematics.

The most common error on my most recent problem sheet was to assume that if lines $\{ \mathbf{a} + \lambda \mathbf{c} : \lambda \in \mathbb{R}\}$ and $\{ \mathbf{a}' + \lambda \mathbf{c}' : \lambda \in \mathbb{R} \}$ meet, then they meet at a point $\mathbf{a} + \lambda \mathbf{c} = \mathbf{a}' + \lambda \mathbf{c}'$. I had already planned an example with a cyclist and a car, but changed it to your railway tracks (where the line actually makes sense) and it went down well. I think one underlying issue is the blind insistence many students have on plugging in numbers into memorized formulae: since the memorized formula has $\lambda$ (or $k$), they have to use the same $\lambda$ both times, and of course this causes problems.

The other common error — or failure to achieve anything much — came in translating a plane and point so that the plane went through the origin. (Then a method from lectures can be used to find the distance between them.) Probably this kind of reduction’ was/is not taught at A-level? I’m planning to revisit it by using conjugation to reduce finding the matrix of a general reflection in a line in $\mathbb{R}^2$ to the same problem for the $x$-axis. Again, the interesting thing is the technique, not the result.