Continue reading Section 1.3 and also the Exploration on cross products for next class. Work through recommended homework questions.

Quiz 1 this week in tutorials. Quiz 1 will cover Sections 1.1, 1.2 and the code vectors part of 1.4. It does not cover the Exploration after Section 1.2. See last lecture for how they run.

**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. Extra Help Centers: Today and
tomorrow (Sept 15 and 16), 4-5pm, MC106.

**Example 1.37:** A code for rover commands:
$$
\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**.

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, \red{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.

**Example 1.40 (UPC Codes):**
The Univeral Product Code (bar code) on a product is a vector in $\Z_{10}^{12}$,
such as $$\vu = [6,7,1,8,6,0,0,1,3,6,2,4].$$
Instead of using $\vec 1$ as the **check vector**, UPC uses
$$ \vc = [ 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1] .$$
The last digit is chosen so that $\vc \cdot \vu = 0 \pmod{10}$.

For example, if we didn't know the last digit of $\vu$, we could compute $$ \vc \cdot [6,7,1,8,6,0,0,1,3,6,2,d] = \cdots = 6 + d \pmod{10} $$ and so we would find that we need to take $d = 4$, since $6 + 4 = 0 \pmod{10}$.

This detects any single error. The pattern in $\vc$ was chosen so that it detects many transpositions, but it doesn't detect when digits whose difference is 5 are transposed. For example, $3 \cdot 5 + 1 \cdot 0 = 15$ and $3 \cdot 0 + 1 \cdot 5 = 5$, and these are the same modulo $10$.

**Example 1.41 (ISBN Codes):**
ISBN codes use vectors in $\Z_{11}^{10}$.
The check vector is $\vc = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]$.
Because 11 is a prime number, this code detects all single errors
and *all* single transposition errors.
**See text** for a worked example.

**Summary:** To create a code, you choose $m$ (which determines the allowed digits),
$n$ (the number of digits in a code word), and a **check vector** $\vc \in \Z_m^n$.
Then the **valid words** $\vv$ are those with $\vc \cdot \vv = 0$.
If $\vc$ ends in a $1$, then you can always choose the last digit of $\vv$
to make it valid.

**Note:** This kind of code can only reliably detect one error, but more sophisticated
codes can detect multiple errors.
There are even **error-correcting codes**, which can *correct* multiple
errors in a transmission without needing it to be resent.
In fact, you can
drill small holes
in a CD, and it will still play the entire content perfectly.

**Question:**
The Dan code uses vectors in $\Z_4^3$ with check vector
$\vc = [3,2,1]$.
Find the check digit $d$ in the code word $\vv = [2, 2, d]$.

**Solution:** We compute
$$
\kern-4ex
\begin{aligned}
\vc \cdot \vv = [3,2,1]\cdot [2,2,d] &= 3 \cdot 2 + 2 \cdot 2 + 1 \cdot d \\
&= 10 + d = 2 + d \pmod{4}
\end{aligned}
$$
To make $\vc \cdot \vv = 0 \pmod{4}$, we choose $d = 2$.

This is the end of the material for quiz 1. (We aren't covering force vectors.)

We study lines and planes because they come up directly in applications, but also because the solutions to many other types of problems can be expressed using the language of lines and planes.

The **vector form** of the equation for $\ell$ is:
$$
\vx = \vp + t \vd
$$
where $\vp$ is the position vector of a point on the line,
$\vd$ is a vector parallel to the line, and $t \in \R$.
This is concise and works in $\R^2$ and $\R^3$.

There are additional ways to describe a line in $\R^2$.

The **normal form** of the equation for $\ell$ is:
$$
\vn \cdot (\vx - \vp) = 0 \quad\text{or}\quad \vn \cdot \vx = \vn \cdot \vp ,
$$
where $\vn$ is a vector that is *normal = perpendicular* to $\ell$.

**Note:** All of these simplify when the line goes through the origin,
as then you can take $\vp = \vec 0$.

**Example:** Find all four forms of the equations for the line in $\R^2$
going through $A = [1,1]$ and $B = [3,2]$.

**Note:** None of these equations is *unique*, as $\vp$, $\vd$ and $\vn$
can all change. The general form is closest to being unique: it is unique
up to an overall scale factor.

**Question:** What are the pros and cons of the different ways of
describing a line?

When expanded into components, it gives the