Back to the on-screen lesson ·

Length, angle and the dot product

The dot product and its three defining properties, length and unit vectors, the angle formula and Cauchy-Schwarz, $u \cdot v$ as the matrix product $u^{T}v$, and inner products other than the dot product.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to compute dot products and the table of them that becomes $A^{T}A$, find lengths and unit vectors, decide orthogonality from the sign of one number, use the angle formula and know why Cauchy-Schwarz is what makes it legitimate, prove Pythagoras and the triangle inequality from the expansion of $|u+v|^2$, read $u \cdot v$ as the matrix product $u^{T}v$ and use it to move a matrix across a dot product as its transpose, and recognise an inner product that is not the dot product.

2. What a vector space has not had until now

Everything so far — span, independence, basis, dimension, rank — was settled without ever asking how long a vector is or whether two of them are perpendicular. Those questions are not answerable from the axioms of a vector space, because the axioms say nothing about lengths. This lesson adds one extra piece of structure, a way of multiplying two vectors to get a number, and every metric idea in the rest of the course follows from it.

3. The words of this unit

The dot product of $u, v \in \mathbb{R}^n$ is $u \cdot v = u_1v_1 + \dots + u_nv_n$, also written $u^{T}v$. The length or norm is $|u| = \sqrt{u \cdot u}$, and $u$ is a unit vector when $|u| = 1$. Two vectors are orthogonal when $u \cdot v = 0$. An inner product $\langle u, v\rangle$ on a real vector space is any rule that is symmetric, linear in each slot, and strictly positive on non-zero vectors; the dot product is one, and it is not the only one.

4. One number, and all of geometry

The dot product multiplies two vectors of the same size and returns a single number: multiply matching components and add. $(1, 3, -2) \cdot (4, 0, 5) = 4 + 0 - 10 = -6$.

Three rules make it usable, and all three are immediate from the definition:

Positivity is what lets us define $|u| = \sqrt{u \cdot u}$ — a sum of squares is never negative, so the root is always real — and Pythagoras identifies this with the ordinary distance from the origin. Symmetry and linearity together give the identity everything else rests on:

$$|u + v|^2 = (u+v)\cdot(u+v) = |u|^2 + 2(u \cdot v) + |v|^2.$$

Read that from right to left. If $u \cdot v = 0$ the middle term vanishes and $|u+v|^2 = |u|^2 + |v|^2$: Pythagoras, in $n$ dimensions, proved in one line. And if $u \cdot v$ is not zero it is precisely the correction term that measures how far from perpendicular the two vectors are.

The angle is then defined, not discovered: $\cos\theta = \dfrac{u \cdot v}{|u||v|}$. The definition is only legitimate because the right-hand side never leaves $[-1, 1]$, which is the Cauchy-Schwarz inequality $|u \cdot v| \le |u||v|$. Orthogonality is the case $\theta = 90°$, and since the denominator is positive, that is exactly the case $u \cdot v = 0$.

Another way: picture

Draw $u$ and $v$ from the same point and complete the triangle with $v - u$. The law of cosines says $|v-u|^2 = |u|^2 + |v|^2 - 2|u||v|\cos\theta$; expanding the left side with the identity above gives $|u|^2 - 2(u\cdot v) + |v|^2$. Comparing the two, $u \cdot v = |u||v|\cos\theta$. So the angle formula is not a new definition dropped in from outside — it is the law of cosines, rearranged, and that is why the dot product deserves to be called geometric at all.

Another way: steps

  1. To test perpendicularity: compute $u \cdot v$ and ask whether it is zero. No lengths, no roots.
  2. To find a length: dot the vector with itself, then take the square root.
  3. To make a unit vector: divide by the length. The direction is unchanged.
  4. To find an angle: divide the dot product by the two lengths and take the inverse cosine — and check the sign first, because the sign alone answers most questions.

5. The dot product is a matrix product

Write vectors as columns. Then $u^{T}$ is a $1 \times n$ row, $v$ is an $n \times 1$ column, and the matrix product $u^{T}v$ is $1 \times 1$ — a single number, and exactly the dot product. So $u \cdot v = u^{T}v$, and the whole of matrix algebra becomes available for reasoning about angles.

This is not a notational curiosity; it is how the rest of the unit is written. Three consequences are used constantly:

One trap: $u^{T}v$ is a number, while $uv^{T}$ is an $n \times n$ matrix. Same two vectors, opposite order, and the sizes make it impossible to confuse them once the shapes are written down.

6. Inner products that are not the dot product

Nothing above used the particular formula $\sum u_iv_i$; it used symmetry, linearity and positivity. Any rule with those three properties is an inner product, and every result of this unit holds for it.

Weighted. $\langle u, v\rangle = 2u_1v_1 + 3u_2v_2$ is one. Positivity holds because the weights are positive; with a weight of $-3$ it would fail, since $(0,1)$ would have negative squared length, and then $|u|$ could not be defined at all.

Integral. On polynomials, $\langle f, g \rangle = \int_0^1 f(x)g(x)\,dx$ is an inner product. Symmetry and linearity are properties of the integral; positivity holds because $\int_0^1 f^2 \ge 0$, with equality only when $f$ is identically zero. So two polynomials have an angle between them, $1$ and $x - \tfrac{1}{2}$ turn out to be orthogonal on $[0,1]$, and a function has a projection onto a subspace of functions. Fourier series are what this becomes on a larger space.

The point is worth stating plainly: geometry in this course is not about arrows. It is about a bilinear, symmetric, positive rule, and anything carrying one has lengths and angles whether it looks like space or not.

7. Where the dot product goes wrong

$u \cdot v$ is a number, not a vector. It has no components and cannot be added to a vector. Writing $u \cdot v + w$ is a type error, and spotting those on sight saves a great deal of time later in the unit.

$|u + v| \ne |u| + |v|$ in general. The identity above shows why: the cross term $2(u\cdot v)$ is what is missing. Equality holds only when the vectors point the same way, and the general inequality $|u+v| \le |u| + |v|$ — the triangle inequality — follows from Cauchy-Schwarz applied to that cross term.

Orthogonal is not a property of one vector. It is a relation between two. A vector is not "orthogonal"; it is orthogonal to something.

The zero vector is orthogonal to everything, including itself, since $0 \cdot v = 0$ always. That is a convention that costs nothing and saves stating exceptions, but it does mean "$u \cdot v = 0$" alone never proves either vector non-zero.

Squaring and adding do not commute. $|(3,4)| = 5$, not $7$. The order in $\sqrt{\sum u_i^2}$ is not negotiable.

8. A right angle, found without a picture

  1. Are $u = (2, -1, 3)$ and $v = (4, 5, -1)$ orthogonal? Compute $u \cdot v = 8 - 5 - 3 = 0$.

    One sum decides it.

  2. Yes. Check with Pythagoras: $|u|^2 = 14$, $|v|^2 = 42$, and $u + v = (6, 4, 2)$ has $|u+v|^2 = 36 + 16 + 4 = 56 = 14 + 42$.

    The cross term vanished, as it must.

  3. In three dimensions no drawing would have settled this, and in ten none is available. The arithmetic is indifferent to the dimension.

    This is why the algebra is worth having.

9. Cauchy-Schwarz doing real work

  1. $u = (1, 1, 1)$ and $v = (a, b, c)$. Then $u \cdot v = a + b + c$ and $|u| = \sqrt{3}$, $|v| = \sqrt{a^2+b^2+c^2}$.

    Set the inequality up.

  2. Cauchy-Schwarz gives $(a+b+c)^2 \le 3(a^2+b^2+c^2)$.

    Square both sides of the bound.

  3. Dividing by $9$: the square of the mean is at most the mean of the squares. A standard inequality about averages, and it is a statement about an angle.

    Geometry proving arithmetic.

10. Your turn: find a unit vector in the direction of $(6, -8)$

  1. Its length is $\sqrt{36 + 64} = \sqrt{100} = 10$.

    Dot it with itself first.

  2. Divide each component by $10$: $\left(\tfrac{3}{5}, -\tfrac{4}{5}\right)$.

    Dividing does not turn the vector.

  3. Your turn: work this step out. Its working is at the end of the packet.

    Check: $\tfrac{9}{25} + \tfrac{16}{25} = 1$, so the length is indeed $1$.

11. Guided practice

For $u = (3, 5)$ and $v = (1, 4)$, fill in the table of dot products $\begin{pmatrix} u \cdot u & u \cdot v \\ v \cdot u & v \cdot v \end{pmatrix}$.

This task has no paper form; do it on a device.

12. Guided practice

How long is the vector $(6, 8)$?

Answer:

13. Practice

Match each pair of vectors to the angle between them.

A right angleAn acute angleAn obtuse angle
$(3, 1)$ and $(1, -3)$
$(3, 1)$ and $(1, 3)$
$(3, 1)$ and $(-1, -3)$

14. Practice

$|u| = 9$ and $|v| = 4$, and nothing else is known about them. Give the set of values $t = u \cdot v$ can take.

This task has no paper form; do it on a device.

15. Practice

$u$ and $v$ lie in $\mathbb{R}^{5}$, neither is the zero vector, and $u \cdot v = 0$. What follows?

16. Somewhere new

On polynomials, $\langle f, g \rangle = \int_{0}^{1} f(x)g(x)\,dx$ is an inner product. Fill in the three values for $f = 1$ and $g = x^{3}$.

Value
$\langle 1, 1 \rangle$
$\langle 1, x^{3} \rangle$
$\langle x^{3}, x^{3} \rangle$

17. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

18. Test question

For $u = (1, 6)$ and $v = (3, 5)$, fill in the table of dot products $\begin{pmatrix} u \cdot u & u \cdot v \\ v \cdot u & v \cdot v \end{pmatrix}$.

This task has no paper form; do it on a device.

19. What you can do now

You can compute dot products, lengths and angles, and say which rules on a vector space make one of these possible at all. Say in your own words why $u \cdot v = 0$ says nothing about either vector on its own. Next: what the dot product lets you build — projections, and bases whose coordinates cost no work.

Working for the steps left to you

10. Your turn: find a unit vector in the direction of $(6, -8)$, step 3

Always worth the ten seconds.