# Vectors

In school, you learned how to plot points on “math paper”. Here are two example points:

We call the horizontal line $x$ and the vertical line $y$. We draw a number line on each of them. Then we can describe any point on the paper using the point's position on each line. The red point has $x=2$ and $y=3$. What is the $x$ value of the blue point?

No, that's actually the blue point's $y$ value. To get its $x$ value, read across the horizontal.

If a point has $x=2$ and $y=3$, a mathematician might write that the point is $(2,3)$, or $[23 ]$. But we will write the point in Python notation: `[2,3]`

. We call this object `[2,3]`

a **vector.**

Saying `p = [2,3]`

is nicer than saying `px = 2`

and `py = 3`

. Everything about the point is packaged in one object, and we don't have to make up names like `x`

and `y`

.

So far, we've been describing 2D space. The kind of space that old arcade games use. But now imagine a 3D space, like the one you live in. We usually imagine the lines $x$ and $y$ as before, plus a new line called $z$, which is perpendicular to the $x$ and $y$ lines. Imagine a point $q$ in space which has $x=5$, $y=2$, and $z=8$. How would we write this point in vector notation?

Right, we're writing the vector in the order `[x,y,z]`

.

You're not exactly wrong! Normally, we would write the vector in the order `[x,y,z]`

. But this is just a convention, and we certainly could write it as `[z,x,y]`

, as you did. Let's continue with the order `[x,y,z]`

.

Consider the point `[1,0,1,0,1]`

. It “lives” in some space. How many dimensions does that space have?

Mathematicians call this space $R_{5}$. (Don't take the “to the power of 5” too seriously -- it's just notation.)

Which of these vectors lives in $R_{1}$?

Now it's your chance to implement “vector-scalar multiplication”. Here's a Python shell for you to use:

## Next in Eigenwhat?:

# The dot product

How “similar” are two vectors? If we see the vectors as arrows, we can say they're similar if they point in the same direction. You'll re-invent the “dot product”, which can tell us the angle between two vectors. You'll implement it in Python and use it to compare word similarities.