Mathematics RU

Part III · Geometry Chapter 22 of 60

Vectors and coordinates

The engine pulls the boat one way, the current another, the wind blows a third. The navigator adds all this up as arrows, and calculates with arrows as confidently as with numbers.

Ages 16–18 45 minutes

Builds on: 21 · Trigonometry

You will learn

  • add, subtract and decompose vectors, on a drawing and in coordinates
  • find lengths, angles and projections with the dot product
  • write the equation of a line through its normal, find the distance from a point to a line and an area through the cross product

In the last chapter we measured the inaccessible: the width of a river, the height of a mountain, the size of the Earth. On the water that isn’t enough. A motorboat goes at $4$ km/h in still water. Its bow is pointed straight across the river, and the current is $3$ km/h. How fast will the boat go? Not $7$, and not $1$. The engine and the water carry the boat at the same time, and it goes diagonally at $5$ km/h: the hypotenuse of a right triangle with legs $3$ and $4$.

Three plus four is five, if you add not numbers but arrows. Velocity, force, displacement, wind: each of these quantities has not only a size but a direction, and they add by rules of their own. A navigator uses these rules every day: deciding where to point the bow so the current doesn’t carry the boat off, how to reach a buoy against the wind, how far the ship has strayed from a safe line. This chapter is navigation practice: each section has a problem from the water and a new operation on arrows without which it can’t be solved.

An arrow instead of a number

A hiker walked $3$ km east, then $4$ km north. Where are they now? The answer “they walked $7$ km” is true but useless: it describes the route, not where the hiker ended up. The useful answer is “$5$ km from the start, roughly north-east”. To describe such a displacement you need two pieces of information at once: how far and in which direction. It’s drawn as an arrow from start to finish.

The arrow isn’t tied to a place. The shift “$5$ km north-east” is the same wherever the hiker stands, in London or in Leeds. So two arrows of the same length and direction are regarded as one and the same object.

A vector is a directed segment, one whose start and end are distinguished. Two vectors are equal if they have the same length and direction: one is obtained from the other by a parallel shift. The vector with start $A$ and end $B$ is written $\overrightarrow{AB}$, and a vector whose start doesn’t matter is written as a single letter with an arrow: $\vec a$. The length of a vector (also called its magnitude) is written $|\vec a|$.

There’s also a vector with no length, the zero vector $\vec 0$: its start and end coincide. It has no direction. The vector $\overrightarrow{BA}$ has the same length as $\overrightarrow{AB}$ but points the opposite way; it’s called the opposite vector and written $-\overrightarrow{AB}$.

Collinear vectors are vectors that lie on one line or on parallel lines. They point either the same way or opposite ways. The zero vector is considered collinear with any vector.

Quantities described by a single number (mass, temperature, time, the volume of a tank) are called scalar. Velocity, force, displacement, field strength are vector quantities. With vectors you have to agree both on the direction and on how it’s reckoned. The forecast “north-westerly wind, $5$ m/s” means the wind blows from the north-west. Oceanographers do the opposite: a “north-westerly current” flows towards the north-west. A navigator with both wind and current on the chart had better remember the difference.

The engine and the current

Back to the boat. In a quarter of an hour the engine would take it $1$ km across the river, and in the same time the current would carry it $0.75$ km downstream. You can imagine the boat first sailing across still water and then being carried downstream by the water: the result is the same. Two displacements in a row give a third: from the start of the first to the end of the second.

The first displacement: from $A$ to $B$. The second displacement starts where the first ended. The sum is the arrow from the start of the first vector to the end of the second. Example: $1$ km across the river and $0.75$ km downstream add up to a displacement of length $\sqrt{1^2 + 0.75^2} = \sqrt{1.5625} = 1.25$ km. In an hour, $5$ km: a speed of $4$ km/h across and $3$ km/h along give $5$ km/h.

When two vectors act at the same time, the engine and the current, two forces on one rope, another rule is handier. Lay both vectors off from one point and complete the parallelogram; the sum is its diagonal from the common vertex. It’s the same triangle rule, just written symmetrically: why both rules give the same thing is shown by the proof below.

Add two vectors and compare the length of the sum with the sum of the lengths. Try making them point the same way and opposite ways.

With numbers we’re used to the sum not changing when the terms are swapped. For arrows this has to be checked: we add them not by the familiar rules of arithmetic but by a drawing.

For any vectors $\vec a$, $\vec b$, $\vec c$

$$\vec a + \vec b = \vec b + \vec a, \qquad (\vec a + \vec b) + \vec c = \vec a + (\vec b + \vec c).$$

A sum is the end of a chain of arrows. It’s enough to show that when the terms are swapped or regrouped, the chain arrives at the same point.

Lay off from the point $O$ the vector $\vec a$ with end $A$, and from $A$ the vector $\vec b$ with end $S$. By the triangle rule $\vec a + \vec b = \overrightarrow{OS}$. Now start with $\vec b$: lay it off from $O$, with end $B$. The vectors $\overrightarrow{OB}$ and $\overrightarrow{AS}$ are equal (both are $\vec b$), that is, the segments $OB$ and $AS$ are parallel, equal and pointing the same way. A quadrilateral with two opposite sides equal and parallel is a parallelogram (that’s proposition I.33 of the Elements). So $\overrightarrow{BS} = \overrightarrow{OA} = \vec a$ as well: the vector $\vec a$ laid off from $B$ leads to the same point $S$. We get $\vec b + \vec a = \overrightarrow{OS} = \vec a + \vec b$. Add a third vector $\vec c$ from the point $S$, with end $T$. The sum $(\vec a + \vec b) + \vec c = \overrightarrow{OS} + \overrightarrow{ST} = \overrightarrow{OT}$. On the other hand, $\vec b + \vec c = \overrightarrow{AS} + \overrightarrow{ST} = \overrightarrow{AT}$, and $\vec a + (\vec b + \vec c) = \overrightarrow{OA} + \overrightarrow{AT} = \overrightarrow{OT}$. The same arrow. Both laws hold. If the vectors are collinear, the parallelogram flattens into a segment, but the chain still arrives at one point: on a line, signed lengths add like numbers. So a sum of any number of vectors can be computed in any order, and if a route comes back to where it started, the sum of all its displacements is the zero vector.

Lengths, though, add up in only one case.

$|\vec a + \vec b| \le |\vec a| + |\vec b|$, with equality only when the vectors point the same way or one of them is zero.

Lay off $\vec a$ and $\vec b$ as a chain, as in the triangle rule. If they’re not collinear, the three arrows $\vec a$, $\vec b$ and $\vec a + \vec b$ are the sides of a real triangle, and by the triangle inequality one of its sides is strictly less than the sum of the other two. If the vectors point the same way, the chain runs along a line in one direction and the lengths simply add. If they point opposite ways and both are non-zero, the length of the sum is the difference of the lengths, which is less than the sum.

A boat carried in different directions by the engine and the current always goes slower than the sum of the two numbers.

The vectors $\vec a$ and $\vec b$ have lengths $5$ and $3$. Which length can’t their sum have?

The length of the sum lies between $5 - 3 = 2$ (the vectors point opposite ways) and $5 + 3 = 8$ (the same way). Every value in between is reached at some angle between the vectors. Nine is impossible: the sum of the lengths is the ceiling.

The apparent wind

On a windless day a motorboat speeds up to $20$ knots, and the skipper feels a $20$-knot wind in the face. The air is standing still; it’s the boat rushing through it. The wind felt on board, shown by the pennant at the masthead, sailors call the apparent wind. A sail works in exactly this wind, not in the “true” wind of the weather station.

To find the apparent wind you have to subtract vectors. Subtraction undoes addition: $\vec a - \vec b$ is the vector that has to be added to $\vec b$ to get $\vec a$. On a drawing it runs from the end of $\vec b$ to the end of $\vec a$, if both are laid off from one point. You can look at it another way too: subtracting $\vec b$ means adding the opposite vector, $\vec a - \vec b = \vec a + (-\vec b)$.

The difference $\vec a - \vec b$ is the arrow between the ends. When is it zero? When is it longer than both $\vec a$ and $\vec b$?

If the true wind is the vector $\vec w$ and the yacht moves with velocity $\vec v$, then relative to the yacht the air moves with velocity $\vec w - \vec v$. Let an $8$-knot wind blow from the east while the yacht heads north at $6$ knots. The vector $-\vec v$ points south, $\vec w$ west; they’re perpendicular, and the apparent wind is the hypotenuse: $\sqrt{8^2 + 6^2} = 10$ knots. On board it blows harder than on shore, and not from the side but from ahead and to the side, from the north-east. Ice yachts, sailing sledges on ice, make use of this: the faster they go, the stronger the apparent wind, and on good days they reach several times the speed of the wind.

A vector can be added to itself many times: $\vec a + \vec a = 2\vec a$, twice as long, in the same direction. From this comes multiplying a vector by a number $k$: the length is multiplied by $|k|$, and the direction is kept when $k > 0$ and reversed when $k < 0$; with $k = 0$ we get the zero vector. A boat that travelled for an hour with velocity $\vec v$ has moved by $1 \cdot \vec v$, and in an hour and a half by $1.5\,\vec v$. Collinear vectors can now be described in one phrase: one is obtained from the other by multiplying by a number (if the other isn’t zero).

Multiplying by a number gets on with addition just as it does for numbers: brackets can be expanded. For arrows this is again a theorem, not a convention.

For any vectors $\vec a$, $\vec b$ and numbers $k$, $m$

$$k(\vec a + \vec b) = k\vec a + k\vec b, \qquad (k + m)\,\vec a = k\vec a + m\vec a.$$

The first law is similarity of triangles, the second is adding segments on one line.

Lay off from $O$ the vector $\vec a$ with end $A$, and from $A$ the vector $\vec b$ with end $S$. In triangle $OAS$ the side $\overrightarrow{OS} = \vec a + \vec b$. Let $k > 0$. Lay off from $O$ the vectors $k\vec a$ and $k(\vec a + \vec b)$; their ends $A'$ and $S'$ lie on the rays $OA$ and $OS$, with $OA' = k \cdot OA$ and $OS' = k \cdot OS$. Triangles $OAS$ and $OA'S'$ are similar by the second similarity test: they share the angle at $O$, and the sides at it are proportional with factor $k$. By similarity $A'S' = k \cdot AS$ and the angles $OAS$ and $OA'S'$ are equal. These are corresponding angles for the lines $AS$ and $A'S'$ and the transversal $OA$, so $A'S' \parallel AS$, and the segments point the same way. So $\overrightarrow{A'S'} = k\vec b$. By the triangle rule $k\vec a + k\vec b = \overrightarrow{OA'} + \overrightarrow{A'S'} = \overrightarrow{OS'} = k(\vec a + \vec b)$. When $k < 0$ the whole picture is also rotated by $180^\circ$ about $O$, when $k = 0$ both sides are zero, and for collinear $\vec a$ and $\vec b$ everything happens on one line. The second law is simpler: $k\vec a$, $m\vec a$ and $(k + m)\,\vec a$ lie on the line of the vector $\vec a$, and their signed lengths add like numbers on the number line.

A motorboat heads east at $12$ knots, and the wind blows from the north at $5$ knots. What is the speed of the apparent wind in knots?

A wind from the north blows south: $\vec w$ is $5$ knots south. The vector $-\vec v$ is $12$ knots west. They’re perpendicular, so $|\vec w - \vec v| = \sqrt{5^2 + 12^2} = \sqrt{169} = 13$ knots.

A grid on the chart

On a nautical chart arrows are drawn in pencil, but numbers are easier to calculate with. Choose two unit vectors in the plane: $\vec i$, one mile east, and $\vec j$, one mile north. Any displacement is made up of a shift east and a shift north: $\vec a = x\,\vec i + y\,\vec j$. The numbers $x$ and $y$, how many miles further east and how many further north, describe the vector completely.

The coordinates of a vector are the numbers $x$ and $y$ in the decomposition $\vec a = x\,\vec i + y\,\vec j$ along the unit vectors of the axes. We write $\vec a = (x, y)$. In space a third axis and a third coordinate are added: $\vec a = (x, y, z)$.

In chapter 9 coordinates described points: that’s how René Descartes taught the plane to work in the Geometry (1637), and independently of him Pierre de Fermat in a manuscript that circulated from the mid-1630s but was printed only in 1679. A vector has the same coordinates as the point at its end, if its start is placed at the origin. But a vector can be laid off from anywhere, and its coordinates don’t change.

The coordinates are uniquely determined: $x$ is the signed length of the vector’s shadow on the axis running west to east, and $y$ on the axis running south to north. And all operations on vectors turn into operations on numbers, coordinate by coordinate.

If $\vec a = (x_1, y_1)$, $\vec b = (x_2, y_2)$ and $k$ is a number, then

$$\vec a + \vec b = (x_1 + x_2,\; y_1 + y_2), \qquad k\vec a = (kx_1,\; ky_1).$$

Write $\vec a = x_1\vec i + y_1\vec j$ and $\vec b = x_2\vec i + y_2\vec j$. By the laws of addition the terms can be rearranged and grouped: $\vec a + \vec b = (x_1\vec i + x_2\vec i) + (y_1\vec j + y_2\vec j)$. By the second distributive law $x_1\vec i + x_2\vec i = (x_1 + x_2)\,\vec i$, and likewise for $\vec j$. We get $(x_1 + x_2)\,\vec i + (y_1 + y_2)\,\vec j$, which is the vector with coordinates $(x_1 + x_2,\; y_1 + y_2)$. For multiplication, by the first distributive law $k(x_1\vec i + y_1\vec j) = k(x_1\vec i) + k(y_1\vec j)$, and $k(x_1\vec i) = (kx_1)\,\vec i$: both vectors point along $\vec i$ and have the same signed length.

For example, $3\vec i + 2\vec j$ plus $\vec i - 5\vec j$ is $4\vec i - 3\vec j$: four miles east and three south. Another consequence: $\overrightarrow{OA} + \overrightarrow{AB} = \overrightarrow{OB}$, so $\overrightarrow{AB} = \overrightarrow{OB} - \overrightarrow{OA}$, and the coordinates of the vectors $\overrightarrow{OA}$ and $\overrightarrow{OB}$ are the coordinates of the points $A$ and $B$.

How much further east the end is than the start. How much further north the end is than the start. The rule is short: “end minus start”. Example: for $A(1, -2)$ and $B(4, 2)$ we get $\overrightarrow{AB} = (4 - 1,\; 2 - (-2)) = (3, 4)$. Its length by Pythagoras’ theorem is $|\overrightarrow{AB}| = \sqrt{3^2 + 4^2} = 5$. In general $|(x, y)| = \sqrt{x^2 + y^2}$, and in space $\sqrt{x^2 + y^2 + z^2}$.

For centuries navigators kept what’s called dead reckoning: with no satellites or radio, from the course, speed and time, they marked on the chart where the ship should be. Each leg of the voyage is a vector, and the ship’s position is the sum of all the vectors. Only sailors measure angles their own way: a course is the angle from north, clockwise. So a leg of $d$ miles on course $K$ gives the shift

$$\bigl(d\sin K,\;\; d\cos K\bigr),$$

not $(d\cos K,\, d\sin K)$ as in trigonometry, where the angle is measured from the $x$-axis anticlockwise. Sine and cosine have swapped places because the axes the angle is measured from have swapped places. For example, $6$ miles on course $90^\circ$ (due east) and then $4$ miles on course $30^\circ$ give $(6, 0) + (2,\; 3.46) = (8,\; 3.46)$: the ship is $\sqrt{64 + 12} \approx 8.72$ miles from the harbour.

A boat set out from the point $A(-1, 3)$ and landed at the point $B(2, 7)$ (coordinates in kilometres). Find the coordinates of the displacement vector $\overrightarrow{AB}$.

End minus start: $\overrightarrow{AB} = (2 - (-1),\; 7 - 3) = (3, 4)$. The boat moved $3$ km east and $4$ km north, and $5$ km in a straight line.

Tacking

A sailing yacht can’t sail straight into the wind. A good cruising yacht holds a course of about $45^\circ$ to the wind; old square-rigged ships, $60$–$70^\circ$ at best. To reach a buoy lying upwind, the yacht goes in a zigzag: now with the wind on the port side (on the port tack), now on the starboard. It has only two directions, $\vec e_1$ and $\vec e_2$, and the navigator’s question is: how many miles on one tack and how many on the other?

In the language of vectors we need numbers $u$ and $v$ with

$$\overrightarrow{SB} = u\,\vec e_1 + v\,\vec e_2,$$

where $S$ is the start and $B$ the buoy. Such an expression is called a linear combination.

A linear combination of the vectors $\vec a$ and $\vec b$ is a vector $s\,\vec a + t\,\vec b$, where $s$ and $t$ are any numbers. A combination of three or more vectors is defined the same way.

If the vectors $\vec e_1$ and $\vec e_2$ in the plane aren’t collinear, any vector $\vec a$ can be written as $\vec a = u\,\vec e_1 + v\,\vec e_2$, and the numbers $u$, $v$ are uniquely determined.

The parallelogram we need is built with two lines.

Lay off $\vec e_1$, $\vec e_2$ and $\vec a$ from one point $O$; let $A$ be the end of $\vec a$. Draw through $O$ the line along $\vec e_1$, and through $A$ the line parallel to $\vec e_2$. These lines meet at a point $P$: they aren’t parallel, because $\vec e_1$ and $\vec e_2$ aren’t collinear. The vector $\overrightarrow{OP}$ lies on the line of the vector $\vec e_1$, that is, it’s collinear with it. So $\overrightarrow{OP} = u\,\vec e_1$, where $|u| = \frac{OP}{|\vec e_1|}$, with a plus sign if $P$ lies on the same side of $O$ as the end of $\vec e_1$. The vector $\overrightarrow{PA}$ is parallel to $\vec e_2$ by construction, so in the same way $\overrightarrow{PA} = v\,\vec e_2$. By the triangle rule $\vec a = \overrightarrow{OP} + \overrightarrow{PA} = u\,\vec e_1 + v\,\vec e_2$. There are no other numbers: if also $\vec a = u'\vec e_1 + v'\vec e_2$, subtracting would give $(u - u')\,\vec e_1 = (v' - v)\,\vec e_2$. On the left is a vector along $\vec e_1$, on the right one along $\vec e_2$; they can coincide only if both are zero. So $u' = u$ and $v' = v$.

The numbers $u$ and $v$ are the coordinates of the buoy in a “slanted grid” whose lines run along the two tacks. Ordinary coordinates are the special case where the grid is rectangular and the step is one unit both ways: $\vec e_1 = \vec i$, $\vec e_2 = \vec j$. A pair of non-collinear vectors along which all others are decomposed is called a basis; rigorously, and for any number of dimensions, in chapter 37.

Move the buoy and change the angle at which the yacht can sail to the wind. However many tacks you make, the total distance is the same.

The experiment shows something unexpected: the number of turns doesn’t affect the length of the route. The whole distance on the port tack is $u$ miles, however it’s broken into pieces, and on the starboard tack $v$ miles. A sum of vectors doesn’t depend on the order, so all the legs on one tack can be mentally rearranged to follow one another. Sailors tack more or less often for other reasons: coastlines, shallows, and the fact that every turn costs time.

If the buoy lies dead upwind at a distance $L$, the two tacks are equal, and each mile sailed brings the yacht $\cos\beta$ miles closer to the buoy, where $\beta$ is the smallest angle to the wind at which the yacht can sail.

The distance to the target in a straight line, dead upwind. The closest angle to the wind at which the yacht still sails. The distance doesn’t depend on the number of tacks. Example: the buoy is $10$ miles away. A yacht sailing at $45^\circ$ to the wind covers $\frac{10}{\cos 45^\circ} = 10\sqrt2 \approx 14.1$ miles. An old sailing ship that can’t point higher than $60^\circ$ covers $\frac{10}{\cos 60^\circ} = 20$ miles, twice the direct distance. At $\beta = 90^\circ$ the formula loses its meaning: a ship that can’t sail closer than a beam reach won’t make any headway upwind at all.

Barge haulers and the dot product

Before steamships, barges were hauled up the Volga against the current by burlaks, teams of barge haulers. The team walked along a towpath beside the bank. In Ilya Repin’s painting Barge Haulers on the Volga (1870–1873) you can see clearly that the rope runs to the barge not along the river but at an angle. The barge, though, moves along the river. What part of the effort goes to good use?

Split the rope’s tension $\vec F$ into two forces: along the river and across it. The cross force pulls the barge towards the bank; the helmsman cancels it, and it does no useful work. Only the component along the river, of length $|\vec F|\cos\varphi$, where $\varphi$ is the angle between the rope and the river, does work. That’s how physicists define the work done by a force: $A = |\vec F|\,|\vec s|\cos\varphi$, where $\vec s$ is the displacement. Say the rope is pulled with a force of $6000$ N at $20^\circ$ to the river, and the barge moves a kilometre. The work is $6000 \cdot 1000 \cdot \cos 20^\circ \approx 5.64$ MJ; about $6\%$ of the effort was lost. At $60^\circ$ half would be lost: $\cos 60^\circ = \frac12$.

The dot product (scalar product) of the vectors $\vec a$ and $\vec b$ is the number $\vec a \cdot \vec b = |\vec a|\,|\vec b|\cos\varphi$, where $\varphi$ is the angle between the vectors laid off from one point ($0^\circ \le \varphi \le 180^\circ$). If one of the vectors is zero, the product is taken to be zero.

The result is a number, not a vector; hence the name “scalar product”. The factor $|\vec b|\cos\varphi$ has a vivid meaning. Shine light on $\vec b$ perpendicular to the line of the vector $\vec a$: the shadow of $\vec b$ on that line is exactly $|\vec b|\cos\varphi$. When the angle is acute, the shadow falls forward, along $\vec a$; when it’s obtuse, backward, and then its length is counted with a minus sign.

The projection of the vector $\vec b$ onto the direction of the vector $\vec a$ is the number $|\vec b|\cos\varphi = \dfrac{\vec a \cdot \vec b}{|\vec a|}$: the length of the shadow of $\vec b$ on the line of $\vec a$, with a minus sign if the angle between the vectors is obtuse.

Turn $\vec b$ about the start: where does the shadow change sign? The two lines under the drawing compute the same number in two different ways.

The sign of the dot product shows the angle at once: positive means acute, negative obtuse. The product of a vector with itself is the square of its length: $\vec a \cdot \vec a = |\vec a|^2$, since the angle between a vector and itself is zero, and $\cos 0^\circ = 1$. And zero means a right angle, which is the main way of checking perpendicularity.

Non-zero vectors are perpendicular if and only if their dot product is zero.

The lengths of non-zero vectors are positive, so the product $|\vec a|\,|\vec b|\cos\varphi$ is zero exactly when $\cos\varphi = 0$. On the interval $0^\circ \le \varphi \le 180^\circ$ the cosine vanishes at a single point, $\varphi = 90^\circ$: on the unit circle it’s the only point of the upper half with $x$-coordinate zero.

By the definition, finding the dot product requires knowing the angle. But in coordinates it isn’t needed at all, and this is one of the most useful formulas in the chapter.

The definition: lengths and angle. The same number from the coordinates $\vec a = (a_1, a_2)$, $\vec b = (b_1, b_2)$: the products of matching coordinates, added up. In space, $a_3 b_3$ is added. Example: $\vec a = (4, 1)$, $\vec b = (2, 3)$. From the coordinates $\vec a \cdot \vec b = 4 \cdot 2 + 1 \cdot 3 = 11$. The lengths are $|\vec a| = \sqrt{17}$, $|\vec b| = \sqrt{13}$, so $\cos\varphi = \frac{11}{\sqrt{221}} \approx 0.740$ and $\varphi \approx 42.3^\circ$. We didn’t know the angle, and we’ve found it.

Compute the third side of a triangle in two ways: by the law of cosines and from coordinates.

Lay off $\vec a$ and $\vec b$ from the point $O$. From the end of $\vec b$ to the end of $\vec a$ runs the vector $\vec a - \vec b$: by the definition of the difference, together with $\vec b$ it gives $\vec a$. We get a triangle with sides $|\vec a|$, $|\vec b|$, $|\vec a - \vec b|$ and the angle $\varphi$ between the first two. By the law of cosines the square of the third side is $|\vec a - \vec b|^2 = |\vec a|^2 + |\vec b|^2 - 2|\vec a|\,|\vec b|\cos\varphi$. The same side in coordinates. The vector $\vec a - \vec b$ has coordinates $(a_1 - b_1,\; a_2 - b_2)$: these are the legs of a right triangle with hypotenuse $|\vec a - \vec b|$, and by Pythagoras’ theorem $|\vec a - \vec b|^2 = (a_1 - b_1)^2 + (a_2 - b_2)^2$. Expand the squares of the differences: $a_1^2 - 2a_1b_1 + b_1^2 + a_2^2 - 2a_2b_2 + b_2^2$. Here $a_1^2 + a_2^2 = |\vec a|^2$ and $b_1^2 + b_2^2 = |\vec b|^2$, so we get $|\vec a|^2 + |\vec b|^2 - 2(a_1b_1 + a_2b_2)$. Two expressions for the same length are equal. Subtract $|\vec a|^2 + |\vec b|^2$ from both and divide by $-2$: $|\vec a|\,|\vec b|\cos\varphi = a_1b_1 + a_2b_2$. If the vectors are collinear there’s no triangle, but the equation can be checked directly: for $\vec b = k\vec a$ both sides equal $k\,|\vec a|^2$.

Now the angle between any two vectors can be found without a protractor:

$$\cos\varphi = \frac{\vec a \cdot \vec b}{|\vec a|\,|\vec b|} = \frac{a_1 b_1 + a_2 b_2}{\sqrt{a_1^2 + a_2^2}\,\sqrt{b_1^2 + b_2^2}}.$$

We’re told: $|\vec a| = 3$, $|\vec b| = 5$, $\vec a \cdot \vec b = 20$. What can be said about the angle between them?

A cosine is never more than one, so $|\vec a \cdot \vec b| \le |\vec a|\,|\vec b| = 15$. The number $20$ can’t come out: it would give $\cos\varphi = \frac43$. In absolute value the dot product is at most the product of the lengths, and equals it only for collinear vectors.

For which $m$ are the vectors $\vec a = (2, m)$ and $\vec b = (3, -4)$ perpendicular?

Perpendicular means the dot product is zero: $2 \cdot 3 + m \cdot (-4) = 0$, $6 = 4m$, $m = \frac32$.

The leading line

The way into a harbour often runs along a narrow channel between shoals. So that ships don’t stray, two marks or two lights are set up on shore: the front one lower, the rear one higher and further back. As long as the ship keeps to the line through both marks (sailors say “on the leading line”), the lights are seen one above the other. Leave the line and the lights “separate”. The navigator needs to know more: how far the ship has strayed and to which side. For that the line needs an equation.

A line can be given not only by two points but by a point and a direction perpendicular to it.

A normal (normal vector) of a line is any non-zero vector perpendicular to it. The same is said of a normal to a plane.

The line through the point $M_0(x_0, y_0)$ perpendicular to the vector $\vec n = (a, b) \ne \vec 0$ consists of the points $M(x, y)$ for which

$$ax + by + c = 0, \qquad c = -(ax_0 + by_0).$$

Conversely, if $a$ and $b$ aren’t both zero, the equation $ax + by + c = 0$ defines a line with normal $(a, b)$.

The line is all the points you can reach from $M_0$ at right angles to the normal.

Through the point $M_0$ there passes exactly one line perpendicular to $\vec n$. A point $M$ lies on this line if and only if the vector $\overrightarrow{M_0M}$ is perpendicular to $\vec n$ or zero ($M = M_0$). Move the point $M$: the right angle appears exactly on the line. By the test for perpendicularity this condition is $\vec n \cdot \overrightarrow{M_0M} = 0$ (it also holds for the zero vector). In coordinates $\overrightarrow{M_0M} = (x - x_0,\; y - y_0)$, and the condition becomes $a(x - x_0) + b(y - y_0) = 0$. Expanding the brackets gives $ax + by + c = 0$ with $c = -(ax_0 + by_0)$. Conversely: let the equation $ax + by + c = 0$ be given and, say, $a \ne 0$. The point $M_0\bigl(-\frac ca,\;0\bigr)$ satisfies it, that is, $c = -(ax_0 + by_0)$, and the equation can be rewritten as $a(x - x_0) + b(y - y_0) = 0$: the line through $M_0$ with normal $(a, b)$. When $a = 0$ the point $M_0\bigl(0,\;-\frac cb\bigr)$ will do.
The first coordinate of the normal $\vec n = (a, b)$. The second coordinate of the normal; $a$ and $b$ aren’t both zero. The constant term $c = -(a x_0 + b y_0)$: with the same normal, it shifts the line parallel to itself. Example: the line through the point $(2, 1)$ perpendicular to $\vec n = (3, -4)$: $3x - 4y + c = 0$, and $c = -(3 \cdot 2 - 4 \cdot 1) = -2$. We get $3x - 4y - 2 = 0$. The vector $(4, 3)$ runs along the line: it’s perpendicular to the normal, $3 \cdot 4 + (-4) \cdot 3 = 0$.

The equation $y = kx + m$ from the chapter on functions is the special case $b \ne 0$: $kx - y + m = 0$, with normal $(k, -1)$. But the vertical line $x = 5$ can’t be written as “$y$ in terms of $x$”, while the general equation handles it easily: $1 \cdot x + 0 \cdot y - 5 = 0$.

Now the distance from the ship to the leading line.

The left side of the line’s equation at the point $P(x_1, y_1)$. On the line itself it’s zero; on the side the normal points to, positive; on the other side, negative. The length of the normal. If the equation is multiplied by a non-zero number, the numerator and denominator are multiplied by its absolute value, and the distance doesn’t change. Example: from the point $(5, 3)$ to the line $3x + 4y - 12 = 0$ we get $d = \frac{|15 + 12 - 12|}{\sqrt{9 + 16}} = \frac{15}{5} = 3$.

The distance is the shadow of a vector on the direction of the normal.

The distance $d$ from the point $P(x_1, y_1)$ to the line is the length of the perpendicular $PH$ dropped onto the line. Take any point of the line $M_0(x_0, y_0)$ and the vector $\overrightarrow{M_0P}$. Move $M_0$ along the line: what follows doesn’t depend on the choice of point. Draw through $M_0$ the line along the normal and drop a perpendicular onto it from $P$, with foot $F$. The quadrilateral $M_0HPF$ has three right angles, at $H$, $M_0$ and $F$, so it’s a rectangle, and $M_0F = HP = d$. And the segment $M_0F$ is the shadow of the vector $\overrightarrow{M_0P}$ on the direction of $\vec n$. The length of the shadow is the absolute value of the projection, and the projection onto the direction of $\vec n$ is $\frac{\vec n \cdot \overrightarrow{M_0P}}{|\vec n|}$. So $d = \frac{|\vec n \cdot \overrightarrow{M_0P}|}{|\vec n|}$, and the sign of the projection shows which side of the line $P$ is on. In coordinates $\vec n \cdot \overrightarrow{M_0P} = a(x_1 - x_0) + b(y_1 - y_0) = ax_1 + by_1 - (ax_0 + by_0)$. The point $M_0$ lies on the line, so $-(ax_0 + by_0) = c$, and the numerator is $ax_1 + by_1 + c$. What’s left is $|\vec n| = \sqrt{a^2 + b^2}$.

The sign of the numerator tells the navigator which way to turn: positive values are on the side of the line the normal points to, negative ones on the other.

Set up the lights $A$ and $B$, and take the ship $P$ off the leading line. The shaded half-plane is where the left side of the equation is positive.

In space it all repeats with one addition. The equation $ax + by + cz + d = 0$ defines a plane with normal $(a, b, c)$, and the distance from a point to it is $\frac{|a x_1 + b y_1 + c z_1 + d|}{\sqrt{a^2 + b^2 + c^2}}$. A line in space can no longer be given by one such equation: there are infinitely many directions perpendicular to it.

Find the distance from the point $(1, -1)$ to the line $5x - 12y + 9 = 0$.

Substitute the point: $5 \cdot 1 - 12 \cdot (-1) + 9 = 26$. The length of the normal is $\sqrt{25 + 144} = 13$. The distance is $d = \frac{26}{13} = 2$.

The tiller and the right hand

Which side of the leading line: that’s a question of left or right. The dot product can’t answer it: it’s the same for vectors symmetric about $\vec a$. Another quantity is needed.

The quantity we need is a signed area.

The area of the parallelogram built on the vectors $\vec a = (a_1, a_2)$ and $\vec b = (b_1, b_2)$ is

$$S = |a_1 b_2 - a_2 b_1|.$$

The number $a_1 b_2 - a_2 b_1$ itself is positive if $\vec b$ points to the left of $\vec a$ (the shortest turn from $\vec a$ to $\vec b$ is anticlockwise), and negative if to the right.

Turn $\vec a$ through a right angle, and the height of the parallelogram turns out to be the shadow of the vector $\vec b$, and we already know how to compute shadows with the dot product.

The area of a parallelogram is base times height (chapter 20): $S = |\vec a| \cdot h$, where $h$ is the distance from the end of $\vec b$ to the line of the vector $\vec a$. Rotate $\vec a$ by $90^\circ$ anticlockwise. We get the vector $\vec a^{\perp} = (-a_2, a_1)$. It has the same length: $\sqrt{a_2^2 + a_1^2} = |\vec a|$. It’s perpendicular to $\vec a$: $\vec a \cdot \vec a^{\perp} = -a_1a_2 + a_2a_1 = 0$. And it’s turned anticlockwise: this substitution takes $\vec i = (1, 0)$ to $\vec j = (0, 1)$. The line of the vector $\vec a^{\perp}$ is perpendicular to the base, so the shadow of the vector $\vec b$ on it is exactly the height $h$. The projection is taken with a sign: plus if $\vec b$ points to the same side of the line of $\vec a$ as $\vec a^{\perp}$, that is, to the left, and minus if to the right. The projection is $\frac{\vec a^{\perp} \cdot \vec b}{|\vec a^{\perp}|} = \frac{-a_2 b_1 + a_1 b_2}{|\vec a|}$. So $a_1 b_2 - a_2 b_1 = \pm\,|\vec a| \cdot h = \pm S$, with a plus sign when $\vec b$ points to the left of $\vec a$.

In chapter 35 the expression $a_1 b_2 - a_2 b_1$ will be called a determinant, and it’ll become clear there why it measures the factor by which areas change under a linear transformation. The navigator uses it without that word: if $\vec k$ is the ship’s course and $\vec m$ the vector from the ship to a lighthouse, then when $k_1 m_2 - k_2 m_1 > 0$ the lighthouse is on the left, to port, and when it’s negative, on the right. The same sign is a standard test in computational geometry: a program uses it to tell which side of a line a point lies on.

Find the area of the triangle with vertices $(0, 0)$, $(4, 1)$ and $(1, 3)$.

The triangle is half the parallelogram on the vectors $(4, 1)$ and $(1, 3)$. The parallelogram’s area is $|4 \cdot 3 - 1 \cdot 1| = 11$, and the triangle’s $\frac{11}{2} = 5.5$.

In space the words “left” and “right” aren’t enough: the plane containing $\vec a$ and $\vec b$ can be viewed from either side. The way out is to answer with a vector perpendicular to that plane, and agree which way it points.

The cross product (vector product) of the vectors $\vec a$ and $\vec b$ in space is the vector $\vec a \times \vec b$ that is perpendicular to both $\vec a$ and $\vec b$, has length $|\vec a|\,|\vec b|\sin\varphi$ (the area of the parallelogram on $\vec a$ and $\vec b$), and points by the right-hand rule: if the fingers of the right hand curl from $\vec a$ towards $\vec b$, the thumb shows the direction of $\vec a \times \vec b$. For collinear vectors the product is the zero vector.

In physics the same rule is also called the corkscrew rule: a right-handed screw turned from $\vec a$ towards $\vec b$ drives in the direction of $\vec a \times \vec b$. A lot depends on the order of the factors here: $\vec b \times \vec a = -\,\vec a \times \vec b$, the arrow reverses.

The first coordinate: the “signed area” of the parallelogram’s shadow on the $yz$-plane. The second: the same for the $zx$-plane. The indices go round in a circle: $2, 3 \to 3, 1 \to 1, 2$. The third: the familiar plane formula $a_1 b_2 - a_2 b_1$ for the $xy$-plane. Example: $\vec a = (1, 0, 2)$, $\vec b = (0, 3, 1)$ give $\vec a \times \vec b = (0 \cdot 1 - 2 \cdot 3,\;\; 2 \cdot 0 - 1 \cdot 1,\;\; 1 \cdot 3 - 0 \cdot 0) = (-6, -1, 3)$. Check: $(1, 0, 2) \cdot (-6, -1, 3) = -6 + 0 + 6 = 0$ and $(0, 3, 1) \cdot (-6, -1, 3) = 0 - 3 + 3 = 0$. The area of the parallelogram is $\sqrt{36 + 1 + 9} = \sqrt{46} \approx 6.78$.

Let’s check that the vector $\vec c = (a_2 b_3 - a_3 b_2,\;\; a_3 b_1 - a_1 b_3,\;\; a_1 b_2 - a_2 b_1)$ has all three properties from the definition: it’s perpendicular to both factors, has the right length and points by the right-hand rule.

Perpendicularity. $\vec a \cdot \vec c = a_1(a_2 b_3 - a_3 b_2) + a_2(a_3 b_1 - a_1 b_3) + a_3(a_1 b_2 - a_2 b_1)$. After expanding the brackets, the six terms cancel in pairs: $a_1a_2b_3$ with $-a_2a_1b_3$, $-a_1a_3b_2$ with $a_3a_1b_2$, $a_2a_3b_1$ with $-a_3a_2b_1$. The result is zero, and by the test $\vec c \perp \vec a$. In the same way $\vec b \cdot \vec c = 0$. Length. Each coordinate of $\vec c$ has the form $a_ib_j - a_jb_i$ for one of the index pairs $(2, 3)$, $(3, 1)$, $(1, 2)$, and its square is $a_i^2b_j^2 + a_j^2b_i^2 - 2a_ib_ia_jb_j$. Compare with $|\vec a|^2|\vec b|^2 - (\vec a \cdot \vec b)^2$. The product $(a_1^2 + a_2^2 + a_3^2)(b_1^2 + b_2^2 + b_3^2)$ contains all nine terms $a_i^2b_j^2$, and the square $(a_1b_1 + a_2b_2 + a_3b_3)^2$ consists of the three terms $a_i^2b_i^2$ and the doubled products $2a_ib_ia_jb_j$. After subtracting, what’s left is the six terms $a_i^2b_j^2$ with $i \ne j$ minus the doubled products: exactly the sum of the squares of the coordinates of $\vec c$. So $|\vec c|^2 = |\vec a|^2|\vec b|^2 - |\vec a|^2|\vec b|^2\cos^2\varphi = |\vec a|^2|\vec b|^2\sin^2\varphi$, and $|\vec c| = |\vec a|\,|\vec b|\sin\varphi$. Direction. There are two vectors of the right length perpendicular to the plane, and they’re opposite. For $\vec a = \vec i$, $\vec b = \vec j$ the formula gives $(0, 0, 1) = \vec k$, as does the right-hand rule: the axes are always drawn so that the turn from $x$ to $y$, seen from the $z$-axis, looks anticlockwise. Now continuously rotate and stretch the pair $\vec i$, $\vec j$, never letting the vectors become collinear: any pair of non-collinear vectors in space can be reached this way. The arrow $\vec c$ given by the formula changes continuously and never becomes zero: its length $|\vec a|\,|\vec b|\sin\varphi$ is positive. It can’t jump to the other side of the plane, and the direction given by the right-hand rule also changes continuously during such a motion. So they always coincide. The formula gives a vector perpendicular to $\vec a$ and $\vec b$, of length $|\vec a|\,|\vec b|\sin\varphi$, pointing by the right-hand rule: that’s exactly $\vec a \times \vec b$.
Change the angle from $\vec a$ to $\vec b$: when it passes through $180^\circ$, the product flips over. The switch changes the order of the factors.

On a yacht the cross product sits in the helmsman’s hand. The tiller is a lever that turns the rudder about a vertical axis. If $\vec r$ is the vector from the axis to the palm and $\vec F$ the force with which the helmsman pushes the tiller, what turns the rudder is the torque $\vec M = \vec r \times \vec F$. It points along the rudder’s axis, up or down, and by the right-hand rule shows which way the rudder blade will swing. Its length $|\vec r|\,|\vec F|\sin\varphi$ explains why the tiller should be pushed across rather than along: at $\varphi = 0$ the torque is zero however hard you push. And why a long tiller is easier to push: the same torque is built up with less force.

The crossing

Now we have everything we need to deal with the river from the start of the chapter to the end. The river is $60$ m wide, the boat goes at $v = 2$ m/s in still water, and the current is $u = 1$ m/s. The boat’s velocity relative to the bank is the sum $\vec w = \vec v + \vec u$, where $\vec v$ points where the bow is pointed. Let the bow be turned by an angle $\theta$ from “straight across” against the current. Decompose $\vec v$ into two directions: across the river, $v\cos\theta$; along it, against the current, $v\sin\theta$. Only the first component carries the boat across the river; along it, the boat is carried by the current minus the second component.

How to cross fastest? The crossing time is $\frac{60}{v\cos\theta}$, and it’s smallest at $\theta = 0$: the bow straight across, $30$ s. The current doesn’t delay the boat, it only carries it downstream, by $1 \cdot 30 = 30$ m.

How to land exactly opposite? The boat must not be carried along the river: the component $v\sin\theta$ has to cancel the current.

How far to turn the bow against the current from “straight across”. The speed of the current. The boat’s speed in still water. There’s a solution only when $u < v$: a sine is never more than one. Example: $\sin\theta = \frac{1}{2}$, $\theta = 30^\circ$. Across the river the boat goes at $2\cos 30^\circ = \sqrt3 \approx 1.73$ m/s and crosses in $\frac{60}{\sqrt3} \approx 34.6$ s: $4.6$ s longer, but to the right place.

And if the current is faster than the boat? Let $u = 3$ m/s. Landing exactly opposite is impossible, but where should the bow point so the boat is carried downstream least? Straight across, it’ll be carried $3 \cdot 30 = 90$ m. Turn the bow straight against the current and the boat won’t cross the river at all. The best course is somewhere in between, and a circle helps to find it.

If the current is faster than the boat ($u > v$), the drift is least when the boat’s own velocity $\vec v$ is perpendicular to the resulting velocity $\vec w$. Then $\sin\theta = \frac vu$, and for a river of width $d$ the drift is $d\,\frac{\sqrt{u^2 - v^2}}{v}$.

All possible resulting velocities end on one circle. The best is the one that touches it.

Lay off the current vector $\vec u$ from the starting point $S$. Whatever course is chosen, the boat’s own velocity $\vec v$ has the same length $v$, so the end of the vector $\vec w = \vec u + \vec v$ lies on the circle of radius $v$ centred at the end of $\vec u$. The boat moves in a straight line along $\vec w$. While it crosses a river of width $d$, it’s carried along the bank by $d \cot\alpha$, where $\alpha$ is the angle between $\vec w$ and the bank. The larger $\alpha$, the smaller the drift. The steepest ray from $S$ that still touches the circle is the tangent $ST$: steeper rays miss it. A tangent is perpendicular to the radius drawn to the point of contact (chapter 19). The radius here is the vector $\vec v$, so on the best course $\vec v \perp \vec w$. We get a right triangle with hypotenuse $u$ and legs $v$ and $|\vec w| = \sqrt{u^2 - v^2}$. The angle $\alpha$ is opposite the leg $v$, so $\sin\alpha = \frac vu$ and $\cot\alpha = \frac{\sqrt{u^2 - v^2}}{v}$. The boat’s bow is perpendicular to $\vec w$, and “straight across” is perpendicular to the bank, so the angle between them is the same: $\theta = \alpha$.

For our river $\sin\theta = \frac23$, $\theta \approx 41.8^\circ$, and the drift is $60 \cdot \frac{\sqrt{9 - 4}}{2} = 30\sqrt5 \approx 67.1$ m: about a quarter less than on the straight-across course.

Turn the boat’s bow with the handle at the end of its arrow or with the slider, and press “Cast off”. The hints set the best course for each goal.

The navigator’s exam is in the trainer. The first level is coordinates and operations on vectors, the second the dot product and angles, the third lines, distances and areas.

Where next

During the crossing every point of the boat shifted by the same vector $\vec w$, from bow to stern. Such a shift moves a figure without changing a single distance. The boat can also turn round, and its reflection in still water repeats all its dimensions, only turned inside out. What other motions move a figure without distorting it? How many are there? And what do a butterfly, a pattern on a border and floor tiles have in common? That’s chapter 23.