Vectors

Let's consider a new kind of object: vectors!
A vector $\boldsymbol{v}$ of dimension $n$ over commutative ring $R$ is a a sequence of $n$ values from $R$. Generally we will write $\boldsymbol{v} = [v_1 \ldots v_n]$, in which case $\boldsymbol{v}$ is a row vector, or
$\boldsymbol{v} = \begin{bmatrix} v_1\\ \vdots\\ v_n \end{bmatrix}$
in which case $\boldsymbol{v}$ is a column vector. The $v_i$'s are called the components of the vector, and their order matters. So $v_i$ is the $i$th component of $\boldsymbol{v}$. An element of $R$ is called a scalar. So $\boldsymbol{v}$ is of type vector, but $v_i$ is of type scalar.
Note: essentially a vector is a length n array of objects of type R.
Note: In the notes variables of type vector will be bold. So you will have to remember that when you see that bold variable it stands for a vector. Be able to write in ... notation when needed.

Why vectors? Same reasons we care about arrays and structs in programming. Many objects we care about consist of multiple pieces of information. With vectors, we are packaging together multiple pieces of numeric information.

Example1: Midn X has an 88% hw ave, a 72.5% quiz ave and an 81% exam ave. So we might represent this as the vector $[88\ 72.5\ 81]$. Note how the different components mean different things. If Midn Y has grade vector $[92.5\ 87.25\ 78.75]$, what is their exam ave? It's 78.75 since that's the 3rd component. For these examples: dimension = 3, ring = reals (or rationals).

Example2: Bytes can be represented by vectors. E.g. 0011 0101 would be $[0\ 0\ 1\ 1\ 0\ 1\ 0\ 1]$. For this examples: dimension = 8, ring = $\mathbb{Z}_2$.

Example3: Points in the Cartesian Plane: $[x\ y]$. In this example dimension = 2, ring = reals ($\mathbb{R}$).
Important: any vector can be viewed as representing a point. For example, the grade vector from Example 1 can be viewed as a point in 3-space.

Just like $\mathbb{Z}$ is the set of all integers, or $\mathbb{R}$ is the set of all real numbers, it is useful to define the set of all vectors over a given ring of a given dimension. So we make the following definition:

The set of all vectors of dimension $n$ over ring $R$ in which all non-zero elements have multiplicative inverses is called a vector space, and is denoted $R^n$.

Note that the requirement that all non-zero elements in the ring $R$ have multiplicative inverses is standard in mathematics. It doesn't mean that collections of vectors over rings that don't have this property, like the integers, don't make sense. We just don't call them vector spaces. Looking back at Example 2 from the above, is the set of all vectors of dimension $n$ over $\mathbb{Z}_2$ a vector space?

Operations on vectors

The following are the basic operations on vectors in a vector space:
The basic operations on vectors in vector space $R^n$ are:
scalar product: for scalar $a$ and vector $\boldsymbol{w}$, define $a \cdot \boldsymbol{w} = a\cdot[w_1 \ldots w_n] = [a\cdot w_1\ \ldots\ a\cdot w_n]$. Note: "scalar times vector gives vector"
vector addition: for vectors $\boldsymbol{u}$ and $\boldsymbol{v}$, define $\boldsymbol{u} + \boldsymbol{v} = [u_1+v_1\ \ u_2+v_2\ \ldots\ u_n+v_n]$. Note: "vector + vector gives vector"
dot product: for vectors $\boldsymbol{u}$ and $\boldsymbol{v}$, define $\boldsymbol{u} \cdot \boldsymbol{v} = u_1\cdot v_1\ + u_2\cdot v_2\ + \cdots + \ u_n\cdot v_n$. Note: "vector · vector gives scalar"

Question: Does subtraction exist for vectors? No! Yes! Sort of?!?!? $\boldsymbol{u} - \boldsymbol{y}$ is syntactic sugar for $\boldsymbol{u} + -1\cdot \boldsymbol{v}$

Question: Do the elements of a vector space form a ring with vector addition as "ring addition", scalar product with -1 as "ring additive inverse", and dot product as "ring multiplication"? No! Why? Because the dot product of two vectors is not a vector! In a ring, the product of two ring elements needs to produce a ring element. So vector spaces really are something new, and they are something we need to investigate!

Applications of vector operations

Dot product example: Go back to grades. If your final grade weights homeworks 25%, quizes by 15% and exams by 60%, then Mids X's total $t$ in the class is $t = [.25\ .15\ .60]\cdot[g_1\ g_2\ g_3]$. If we define $\boldsymbol{w}$ as the vector of weights $\boldsymbol{g}$ as the vector of scores, this is:

grade total $t = \boldsymbol{w}\cdot \boldsymbol{g}$.

If I wanted to use percentages to express the weight vector $\boldsymbol{w}$, we would have $\boldsymbol{w}= [25\ 15\ 60]$ and the grade total would be expressed as

grade total $t = .01 \cdot \boldsymbol{w}\cdot \boldsymbol{g}$.

Some professors like to curve (not me, though!). So maybe they want to curve the homework average by adding $c_1$, the quiz average by $c_2$, and the exam average by $c_3$. We would pack these into vector $\boldsymbol{c}$ and arrive at:

grade total $t = .01 \cdot \boldsymbol{w}\cdot (\boldsymbol{g} + \boldsymbol{c})$ .

So we see ourselves starting to do something arithmeticiesque with these vector operations!!

Christopher W Brown