\(\newcommand{\augmatrix}[2]{\left(\begin{array}{@{}#1 |c@{}} #2 \end{array}\right)} \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)

Section1.3The Dot Product

SubsectionThe Assignment

  • Read section 1.2 of Strang
  • Watch another video or two from 3Blue1Brown's YouTube series The Essence of Linear Algebra.
  • Read the following and complete the exercises below.

SubsectionLearning Objectives

Before class, a student should be able to

  • Compute the dot product of two given vectors.
  • Compute the length of a given vector.
  • Normalize a given vector.
  • Recognize that \(u \cdot v =0\) is the same as "\(u\) and \( v\) are orthogonal."
  • Compute the angle between two given vectors using the cosine formula.
At some point, a student should be able to
  • Interpret the statements \(u\cdot v < 0 \) and \(u \cdot v > 0\) geometrically.
  • Pass back and forth between linear equations and equations involving dot products.
  • Make pictures of level sets of the dot product operation.

SubsectionDiscussion

The dot product is a wonderful tool for encoding the geometry of Euclidean space, but it can be a bit mysterious at first. As Strang shows, it somehow holds all of the information you need to measure lengths and angles.

What does this weird thing have to do with linear algebra? A dot product with a "variable vector" is a way of writing a linear equation. For example, \begin{gather*} \begin{pmatrix} 7 \\ 3 \\ -2 \end{pmatrix} \cdot \begin{pmatrix} x \\ y \\ z \end{pmatrix} = 7x+3y-2z. \end{gather*} Sometimes this will allow us to connect linear algebra to geometry, and use geometric thinking to answer algebraic questions.

SubsectionSageMath and the dot product

SubsubsectionBasic Commands

SageMath has a built-in dot product command u.dot_product(v). This will return the dot product of the vectors \(u\) and \(v\).

It also has a built-in command for computing lengths. Here SageMath uses the synonym "norm": u.norm(). Of course, you can also call this like a function instead of like a method: norm(u).

There is no built-in command for angles. You just have to compute them using the cosine formula, like below. (I will break up the computation, but it is easy to do it all with one line.)

Of course, SageMath's arccos command returns a result in radians. To switch to degrees, you must convert.

Often, it is helpful to normalize a vector. You can do this with the normalized method like this:

SubsectionExercises about the Dot Product

Task7

What shape is the set of solutions \(\left(\begin{smallmatrix} x \\ y \end{smallmatrix}\right)\) to the equation\begin{equation*} \begin{pmatrix} 3 \\ 7\end{pmatrix} \cdot \begin{pmatrix} x \\ y \end{pmatrix} = 5? \end{equation*}

That is, if we look at all possible vectors \(\left(\begin{smallmatrix} x \\ y \end{smallmatrix}\right)\) which make the equation true, what shape does this make in the plane?

What happens if we change the vector \(\left(\begin{smallmatrix} 3 \\ 7 \end{smallmatrix}\right)\) to some other vector? What happens if we change the number \(5\) to some other number?

Task8

  1. Find an example of two \(2\)-vectors \(v\) and \(w\) so that \(\left(\begin{smallmatrix}1 \\ 2 \end{smallmatrix}\right)\cdot v =0\) and \(\left(\begin{smallmatrix}1 \\ 2 \end{smallmatrix}\right)\cdot w = 0\), or explain why such an example is not possible.
  2. Let \(v = \left(\begin{smallmatrix}3\\-1 \end{smallmatrix}\right)\). Find an example of a pair of vectors \(u\) and \(w\) such that \(v \cdot u < 0\) and \(v \cdot w < 0\) and \(w \cdot u = 0\), or explain why no such pair of vectors can exist.
  3. Find an example of three \(2\)-vectors \(u\), \(v\), and \(w\) so that \( u \cdot v < 0\) and \(u\cdot w < 0 \) and \(v \cdot w < 0\), or explain why no such example exists.

Task9

  1. Find an example of a number \(c\) so that \begin{equation*} \begin{pmatrix} 1 \\ -1 \end{pmatrix} \cdot \begin{pmatrix} x \\ y \end{pmatrix} = c \end{equation*} has the vector \(\left(\begin{smallmatrix}4 \\ 7 \end{smallmatrix}\right)\) as a solution, or explain why no such number exists.
  2. Let \(v = \left(\begin{smallmatrix}2\\1\end{smallmatrix}\right)\) and \(w=\left(\begin{smallmatrix}-3\\4\end{smallmatrix}\right)\). Find an example of a number \(c\) so that \begin{gather*} v \cdot \begin{pmatrix}1\\-1\end{pmatrix} = c \quad\text{ and } \quad w \cdot \begin{pmatrix}1\\-1\end{pmatrix} = c, \end{gather*} or explain why this is not possible.
  3. Let \(P = \left(\begin{smallmatrix}-3\\4\end{smallmatrix}\right)\). Find an example of numbers \(c\) and \(d\) so that \begin{gather*} \begin{pmatrix} 2\\-1\end{pmatrix}\cdot P = c \quad\text{ and } \quad \begin{pmatrix} 1\\-1\end{pmatrix}\cdot P = d, \end{gather*} or explain why no such example is possible.

Now we move to three dimensions!

Task10
Let \(V = \left(\begin{smallmatrix}1\\1\\1\end{smallmatrix}\right)\). Find a unit vector of the form \(X = \left(\begin{smallmatrix}x\\y\\0 \end{smallmatrix}\right)\) so that \(V\cdot X = \sqrt{2}\), or explain why no such vector exists.
Task11
Find an example of numbers \(c\), \(d\), and \(e\) so that there is no solution vector \(X = \left(\begin{smallmatrix}x\\y\\z \end{smallmatrix}\right)\) which simultaneously satisfies the three equations \begin{gather*} \begin{pmatrix} 1\\1\\1\end{pmatrix}\cdot X = c, \qquad \begin{pmatrix} 2\\2\\2\end{pmatrix}\cdot X = d, \qquad \begin{pmatrix} 0\\0\\1\end{pmatrix}\cdot X = e, \end{gather*} or explain why no such numbers exist.
Task12
Find an example of numbers \(c\), \(d\), and \(e\) so that there is no solution vector \(X = \left(\begin{smallmatrix}x\\y\\z \end{smallmatrix}\right)\) which simultaneously satisfies the three equations \begin{gather*} \begin{pmatrix} 1\\1\\1\end{pmatrix}\cdot X = c, \qquad \begin{pmatrix} 0\\1\\1\end{pmatrix}\cdot X = d, \qquad \begin{pmatrix} 0\\0\\1\end{pmatrix}\cdot X = e, \end{gather*} or explain why no such numbers exist.