Math 1600 Lecture 4, Section 2, 12 Sept 2014

$ \newcommand{\bdmat}[1]{\left|\begin{array}{#1}} \newcommand{\edmat}{\end{array}\right|} \newcommand{\bmat}[1]{\left[\begin{array}{#1}} \newcommand{\emat}{\end{array}\right]} \newcommand{\coll}[2]{\bmat{r} #1 \\ #2 \emat} \newcommand{\ccoll}[2]{\bmat{c} #1 \\ #2 \emat} \newcommand{\colll}[3]{\bmat{r} #1 \\ #2 \\ #3 \emat} \newcommand{\ccolll}[3]{\bmat{c} #1 \\ #2 \\ #3 \emat} \newcommand{\collll}[4]{\bmat{r} #1 \\ #2 \\ #3 \\ #4 \emat} \newcommand{\ccollll}[4]{\bmat{c} #1 \\ #2 \\ #3 \\ #4 \emat} \newcommand{\colllll}[5]{\bmat{r} #1 \\ #2 \\ #3 \\ #4 \\ #5 \emat} \newcommand{\ccolllll}[5]{\bmat{c} #1 \\ #2 \\ #3 \\ #4 \\ #5 \emat} \newcommand{\red}[1]{{\color{red}#1}} \newcommand{\lra}[1]{\mbox{$\xrightarrow{#1}$}} \newcommand{\rank}{\textrm{rank}} \newcommand{\row}{\textrm{row}} \newcommand{\col}{\textrm{col}} \newcommand{\null}{\textrm{null}} \newcommand{\nullity}{\textrm{nullity}} \renewcommand{\Re}{\operatorname{Re}} \renewcommand{\Im}{\operatorname{Im}} \renewcommand{\Arg}{\operatorname{Arg}} \renewcommand{\arg}{\operatorname{arg}} \newcommand{\adj}{\textrm{adj}} \newcommand{\mystack}[2]{\genfrac{}{}{0}{0}{#1}{#2}} \newcommand{\mystackthree}[3]{\mystack{\mystack{#1}{#2}}{#3}} \newcommand{\qimplies}{\quad\implies\quad} \newcommand{\qtext}[1]{\quad\text{#1}\quad} \newcommand{\qqtext}[1]{\qquad\text{#1}\qquad} \newcommand{\svec}[1]{\,\vec{#1}} \newcommand{\query}[1]{\toggle{\text{?}\vphantom{#1}}{#1}\endtoggle} \newcommand{\smallquery}[1]{\toggle{\text{?}}{#1}\endtoggle} \newcommand{\bv}{\mathbf{v}} %\require{AMScd} $

Announcements:

Read Section 1.3 for next class. Work through recommended homework questions.

Tutorials start next week, and include a quiz covering Sections 1.1, 1.2 and the code vectors part of 1.4. It does not cover the Exploration after Section 1.2.
Questions are similar to homework questions, but may be slightly different. There will be two true/false questions, for which you must explain your answers.
The quizzes last 20 minutes, and are at the end of the tutorial, so you have time for questions at the beginning. You must write in the tutorial you are registered in. Different sections have different quizzes, but it is still considered an academic offense to share information about quizzes.
No calculators or other aids are permitted on quizzes or exams.

Today is the last day you can switch tutorial sections. This must be done via paper add/drop in MC104, 9:30-3:30. No line ups! Updated counts:

003  W   9:30AM   KB-K103     40 !
009  W   9:30AM   UCC-65      17 *
008  W  11:30AM   UCC-60      40 !
006  W   3:30PM   UC-202      35
005  Th 11:30AM   SSC-3010    39 !
007  Th 12:30PM   MC-17       35
004  Th  2:30PM   UC-202      34

Office hours: Monday, 3:00-3:30 and Wednesday, 11:30-noon, MC103B.

Help Centers: Monday-Friday 2:30-6:30 in MC 106 starting Wednesday, September 17.

Lecture notes (this page) available from course web page.

A copy of the Solutions Manual has been put on reserve in Taylor Library.

The midterm is in 6 weeks!

Partial review of last lecture:

Section 1.2: Length and Angle: The Dot Product

Definition: The dot product or scalar product of vectors $\vu$ and $\vv$ in $\R^n$ is the real number defined by $$ \vu \cdot \vv := u_1 v_1 + \cdots + u_n v_n . $$

This has familiar properties; see Theorem 1.2.

Definition: The length or norm of $\vv$ is the scalar $\|\vv\|$ defined by $$ \|\vv\| := \sqrt{\vv \cdot \vv} = \sqrt{v_1^2 + \cdots + v_n^2} . $$ A vector of length 1 is called a unit vector.

Theorem 1.5: The Triangle Inequality: For all $\vu$ and $\vv$ in $\R^n$, $$ \| \vu + \vv \| \leq \| \vu \| + \| \vv \| . $$

We define the distance between vectors $\vu$ and $\vv$ by the formula $$ d(\vu, \vv) := \| \vu - \vv \| = \sqrt{(u_1 - v_1)^2 + \cdots + (u_n - v_n)^2}. $$

Angles from dot product

Theorem 1.4: The Cauchy-Schwarz Inequality: For all $\vu$ and $\vv$ in $\R^n$, $$ | \vu \cdot \vv | \leq \| \vu \| \, \| \vv \| . $$

We can therefore use the dot product to define the angle between two vectors $\vu$ and $\vv$ in $\R^n$ by the formula $$ \cos \theta = \frac{\vu \cdot \vv}{\| \vu \| \, \| \vv \|}, \quad \text{i.e.,} \quad \theta := \arccos \left( \frac{\vu \cdot \vv}{\| \vu \| \, \| \vv \|} \right), $$ where we choose $0 \leq \theta \leq 180^\circ$. This makes sense because the fraction is between -1 and 1.

To help remember the formula for $\cos \theta$, note that the denominator normalizes the two vectors to be unit vectors. The formula can also be written $$ \vu \cdot \vv = \| \vu \| \, \| \vv \| \, \cos \theta . $$

New material

On board: Angle between $\vu = [1, 2, 1, 1, 1]$ and $\vv = [0, 3, 0, 0, 0]$.

For a random example, you'll need a calculator, but for hand calculations you can remember these cosines: $$ \small\kern-8ex \begin{aligned} \cos 0^\circ &= \frac{\sqrt{4}}{2} = 1, & \cos 30^\circ &= \frac{\sqrt{3}}{2} , & \cos 45^\circ &= \frac{\sqrt{2}}{2} = \frac{1}{\sqrt{2}}, \\ \cos 60^\circ &= \frac{\sqrt{1}}{2} = \frac{1}{2}, & \cos 90^\circ &= \frac{\sqrt{0}}{2} = 0 , \end{aligned} $$ using the usual triangles.

Orthogonal Vectors

How can we tell whether two vectors are orthogonal / perpendicular?

Example: If $\vu = [1, 2, 3]$ and $\vv = [1, 1, -1]$ in $\R^3$, then $\vu \cdot \vv = 1 \cdot 1 + 2 \cdot 1 + 3 \cdot (-1) = 1 + 2 - 3 = 0$, so $\vu$ and $\vv$ are orthogonal.

Also, $\vu = [1, 2, 3]$ and $\vv = [1, 1, 1]$ in $\Z_3^3$ are orthogonal, since $\vu \cdot \vv = 1 + 2 + 3 = 6 = 0 \pmod{3}$.

An applet illustrating the dot product. (Another one: javascript, and java.)

Pythagorean theorem in $\R^n$: If $\vu$ and $\vv$ are orthogonal, then $$ \| \vu + \vv \|^2 = \| \vu \|^2 + \| \vv \|^2 . $$

Explain on board, using Theorem 1.2.

Projections

Use board to derive formula for the projection of $\vv$ onto $\vu$:

This applet is useful for understanding projections as well. Java version.

Example: If $\vu = [-1, 1, 0]$ and $\vv = [1,2,3]$ then $$ \kern-4ex \begin{aligned} \proj_\vu(\vv) = \frac{\vu \cdot \vv}{\vu \cdot \vu} \vu &= \frac{-1+2+0}{1+1+0} [-1, 1, 0] \\ &= \frac{1}{2} [-1,1,0] = [-\!\frac{1}{2}, \frac{1}{2}, 0] \end{aligned} $$

Questions

True/false: If $\vu$, $\vv$ and $\vw$ are vectors in $\R^n$ such that $\vu \cdot \vv = \vu \cdot \vw$ and $\vu \neq \vec 0$, then $\vv = \vw$.

True/false: If $\vu$ is orthogonal to both $\vv$ and $\vw$, then $\vu$ is orthogonal to $2 \vv + 3 \vw$.

You only answer true if a statement is always true. You justify this answer by giving a general explanation of why it is always true, not just an example where it happens to be true.

You answer false if a statement can in some case be false. You justify this answer by giving an explicit example where the statement is false.

Question: Suppose I tell you that $\vu \cdot \vv = 1/2$ and $\vu \cdot \vw = -1$. What is $\vu \cdot (2 \vv + 3 \vw)$?

Question: Does $\proj_{\vu}(\vv)$ always point in the same direction as $\vu$?

Section 1.4: Applications: Code Vectors (we aren't covering force vectors)

We're going to study a way to encode data that allows us to detect transmission errors. Used on CDs, UPC codes, ISBN numbers, credit card numbers, etc.

Example 1.37: Suppose we want to send the four commands "forward", "back", "left" and "right" as a sequence of 0s and 1s. We could use the following code: $$ \small\kern-8ex \textrm{forward} = [0,0], \quad \textrm{back} = [0,1], \quad \textrm{left} = [1,0], \quad \textrm{right} = [1,1]. $$ But if there is an error in our transmission, the Mars rover will get the wrong message and will drive off of a cliff, wasting billions of dollars of taxpayer money (but making for some good NASA jokes).

Here's a more clever code: $$ \small\kern-8ex \textrm{forward} = [0,0,0], \quad \textrm{back} = [0,1,1], \quad \textrm{left} = [1,0,1], \quad \textrm{right} = [1,1,0]. $$ If any single bit (binary digit, a 0 or a 1) is flipped during transmission, the Mars rover will notice the error, since all of the code vectors have an even number of 1s. It could then ask for retransmission of the command.

This is called an error-detecting code. Note that it is formed by adding a bit to the end of each of the original code vectors so that the total number of 1s is even.

In vector notation, we replace a vector $\vb = [v_1, v_2, \ldots, v_n]$ with the vector $\vv = [v_1, v_2, \ldots, v_n, d]$ such that $\vec 1 \cdot \vv = 0 \pmod{2}$, where $\vec 1 = [1, 1, \ldots, 1]$.

Exactly the same idea works for vectors in $\Z_3^n$; see Example 1.39 in the text.

Note: One problem with the above scheme is that transposition errors are not detected: if we want to send $[0, 1, 1]$ but the first two bits are exchanged, the rover receives $[1, 0, 1]$, which is also a valid command. We'll see codes that can detect transpositions.