© 2015-2019 Jacob Ström, Kalle Åström, and Tomas Akenine-Möller Forum

# Chapter 2: Vectors

One of the most important and fundamental concepts in linear algebra is the vector. Luckily, vectors are all around us, but they are, in general, not visible. The common ways to introduce a vector is either to begin with the strict mathematical definition, or to discuss examples of vectors, such as velocities, forces, acceleration, etc. For a more intuitive and hopefully faster understanding of this important concept, this chapter instead begins with an interactive demonstration and a clear visualization of what a vector can be. In this case, a ball's velocity, which consists of a direction (where the ball is going) and a speed (how fast it is going there), is shown in Interactive Illustration 2.1.
Interactive Illustration 2.1: This little breakout game shows the concept of a vector. Play along for an interactive introduction. Control the paddle with left/right keys, or touch/swipe.
Interactive Illustration 2.1: This little breakout game shows the concept of a vector. Play along for an interactive introduction. Control the paddle with left/right keys, or touch/swipe.

In this book, we denote points by capital italic letters, e.g., $A$, $B$, and $Q$. For most of the presentation in the early chapters, we will use two- and three-dimensional points, and some occasional one-dimensional points. We start with a definition of a vector.

Definition 2.1: Vector
Let $A$ and $B$ be two points. A directed line segment from $A$ to $B$ is denoted by:
 $$\overrightarrow{AB}.$$ (2.1)
This directed line segment constitutes a vector. If you can move the line segment to another line segment with the same direction and length, they constitute the same vector.
$A$
$B$
$\overrightarrow{AB}$
$C$
$D$
$\overrightarrow{CD} = \vc{v}$
For instance, the two line segments $\overrightarrow{AB}$ and $\overrightarrow{CD}$ in Interactive Illustration 2.2 constitute the same vector as can be seen when pushing the "forward" button.

We say that $\overrightarrow{AB}$ is a vector and that
 $$\overrightarrow{AB} = \overrightarrow{CD}.$$ (2.2)
A shorter notation for vectors is to use a single bold face characters, such as $\vc{v}$. As is shown in the illustration, $\vc{v} = \overrightarrow{AB} = \overrightarrow{CD}$. Some books make a difference between directed line segments and vectors, and reserve the short hand variant $\vc{v}$ for true vectors and the longer $\overrightarrow{AB}$ for directed line segments. While this may be mathematically more stringent, this difference is ignored for the purposes of this book, and we use vectors and directed line segments as one and the same thing.

We also use the terms tail point and tip point of a vector when this is convenient, where the tip point is where the arrowhead is, and the tail point is the other end.

A vector is completely defined by its
1. direction, and
2. its length
Note that a starting position of a vector is missing from the list above. As long as the direction and length is not changed, it is possible to move it around and have it start in any location. This is illustrated in Interactive Illustration 2.3.
Interactive Illustration 2.3: A vector does not have a specific starting position. This vector is drawn at a certain position, but even when it is moved to start somewhere else, it is still the same vector. Click/touch Forward to move the vector.
Interactive Illustration 2.3: A vector does not have a specific starting position. This vector is drawn at a certain position, but even when it is moved to start somewhere else, it is still the same vector. Click/touch Forward to move the vector.
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
The length of a vector is denoted by $\ln{\overrightarrow{AB}}$, or in shorthand by $\ln{\vc{v}}$.
 $$\text{length of vector:}\spc\spc \ln{\vc{v}}$$ (2.3)
The length of a vector is a scalar, which just means that it is a regular number, such as $7.5$. The term scalar is used to emphasize that it is just a number and not a vector or a point. Exactly how the length of a vector can be calculated will be deferred to Chapter 3.

Note that the order of the points is important, i.e., if you change the order of $A$ and $B$, another vector, $\overrightarrow{BA}$, is obtained. It has opposite direction, but the same length, i.e., $\ln{\overrightarrow{AB}} = \ln{\overrightarrow{BA}}$. Even $\overrightarrow{AA}$ is a vector, which is called the zero vector, as shown in the definition below.

Definition 2.2: Zero Vector
The zero vector is denoted by $\vc{0}$, and can be created using a directed line segment using the same point twice, i.e., $\vc{0}=\overrightarrow{AA}$. Note that $\ln{\vc{0}}=0$, i.e., the length of the zero vector is zero.
Two vectors, $\vc{u}$ and $\vc{v}$, are parallel if they have the same direction or opposite directions, but not necessarily the same lengths. This is shown to the right in Figure 2.4. Note how you can change the vectors in the figure, some can be changed by grabbing the tip, others by grabbing the tail. The notation
 $$\vc{u}\, ||\, \vc{v}$$ (2.4)
means that $\vc{u}$ is parallel to $\vc{v}$. The zero vector $\vc{0}$ is said to be parallel to all other vectors. Next, we will present how two vectors can be added to form a new vector, and then follows scalar vector multiplication in Section 2.3.

There are two fundamental vector operations in linear algebra, namely, vector addition and scalar vector multiplication, where the latter is sometimes called vector scaling. Most of the mathematics in this book build upon these two operations, and even the most complex operations often lead back to addition and scaling. Vector scaling is described in Section 2.3, while vector addition is described here. Luckily, both vector addition and vector scaling behave as we would expect them to.

The sum, $\vc{u}+\vc{v}$, of two vectors, $\vc{u}$ and $\vc{v}$, is constructed by placing $\vc{u}$, at some arbitrary location, and then placing $\vc{v}$ such that $\vc{v}$'s tail point coincides with $\vc{u}$'s tip point, and $\vc{u}+\vc{v}$ is the vector that starts at $\vc{u}$'s tail point, and ends at $\vc{v}$'s tip point.
Exactly how the vector sum is constructed is shown in Interactive Illustration 2.5 below.
Interactive Illustration 2.5: Two vectors, $\vc{u}$ and $\vc{v}$, are shown. These will be added to form the vector sum $\vc{u} + \vc{v}$. Note that the vectors can be changed as usual by dragging their tips. Click/press Forward to continue to the next stage of the illustration.
Interactive Illustration 2.5: Two vectors, $\hid{\vc{u}}$ and $\hid{\vc{v}}$, are shown. These will be added to form the vector sum $\hid{\vc{u} + \vc{v}}$. Note that the vectors can be changed as usual by dragging their tips. Click/press Forward to continue to the next stage of the illustration.
$\vc{u}+\vc{v}$
$\vc{v}$
$\vc{v}$
$\vc{v}$
$\vc{u}$
$\vc{u}$
$\vc{u}$
$\vc{v}$

So far, we have only illustrated the vector addition in the plane, i.e., in two dimensions. However, it can also be illustrated in three dimensions. This is done below in Interactive Illustration 2.6. Remember that you can rotate the figure by moving the mouse while right clicking or by using a two-finger swipe.
Interactive Illustration 2.6: Two vectors, $\vc{u}$ and $\vc{v}$, are shown. These will be added to form the vector sum, $\vc{u} + \vc{v}$. Note that the vectors can be changed as usual by dragging their tip points. If you do so, you will move the points in the plane of the screen. Click/press Forward to continue to the next stage of the illustration.
Interactive Illustration 2.6: In this final stage, we have added some dashed support lines to make it easier to see the spatial relationships. Recall that you can press the right mouse button, keep it pressed, and move the mouse to see the vector addition from another view point. For tablets, the same maneuver is done by swiping with two fingers. Note that by changing the point of view like this, you can verify that $\hid{\vc{u}}$, $\hid{\vc{v}}$, and $\hid{\vc{u}+\vc{v}}$ all lie in the same plane. Try also to move the vectors so that the projected points no longer end up on a straight line.
$\vc{u}$
$\vc{u}+\vc{v}$
$\vc{v}$
$\vc{v}$
$\vc{v}$

As we saw in the Breakout Game 2.1, the speed of the ball was increased by 50% after a while. This is an example of vector scaling, where the velocity vector simply was scaled by a factor of $1.5$. However, a scaling factor can be negative as well, and this is all summarized in the definition below, and instead of the term vector scaling, we also use the term scalar vector multiplication.

Definition 2.4: Scalar Vector Multiplication
When a vector, $\vc{v}$, is multiplied by a scalar, $k$, the vector $k\vc{v}$ is obtained, which is parallel to $\vc{v}$ and its length is $\abs{k}\,\ln{v}$. The direction of $k\vc{v}$ is opposite $\vc{v}$ if $k$ is negative, and otherwise it has the same direction as $\vc{v}$. If $k=0$, then $k\vc{v}=\vc{0}$.
A corollary to this is that if the two vectors $\vc{u}$ and $\vc{v}$ satisfy $\vc{u} = k \vc{v}$ for some scalar $k$, then $\vc{u}$ and $\vc{v}$ are parallel.

Scalar vector multiplication is shown in Interactive Illustration 2.7 below. The reader is encouraged to play around with the illustration.
Interactive Illustration 2.7: Here, we show how a vector, $\vc{v}$, can be multiplied by a scalar, $k$, so that $k\vc{v}$ is generated. The reader can move the vector, $\vc{v}$, and also manipulate the value of $k$ by dragging the slider below the illustration. Note what happens to $k\vc{v}$ when $k$ is negative. As an exercise, try to make the tip point of $\vc{v}$ meet coincide with the tip point of $k\vc{v}$.
Interactive Illustration 2.7: Here, we show how a vector, $\hid{\vc{v}}$, can be multiplied by a scalar, $\hid{k}$, so that $\hid{k\vc{v}}$ is generated. The reader can move the vector, $\hid{\vc{v}}$, and also manipulate the value of $\hid{k}$ by dragging the slider below the illustration. Note what happens to $\hid{k\vc{v}}$ when $\hid{k}$ is negative. As an exercise, try to make the tip point of $\hid{\vc{v}}$ meet coincide with the tip point of $\hid{k\vc{v}}$.
$k=$
$\vc{v}$
$k\vc{v}$
Now that we can both add vectors, and scale vectors by a real number, it is rather straightforward to subtract two vectors as well. This is shown in the following example.

Example 2.1: Vector Subtraction
Note that by using vector addition (Definition 2.3) and scalar vector multiplication (Definition 2.4) by $-1$, we can subtract one vector, $\vc{v}$, from another, $\vc{u}$ according to
 $$\underbrace{\vc{u} + (\underbrace{-1\vc{v}}_{\text{scaling}})}_{\text{addition}} = \vc{u}-\vc{v},$$ (2.5)
where we have introduced the shorthand notation, $\vc{u}-\vc{v}$, for the expression to the left of the equal sign. Vector subtraction is illustrated below.
Interactive Illustration 2.8: Vector subtraction, $\vc{u}-\vc{v}$, is illustrated here. First, only the two vectors, $\vc{u}$ and $\vc{v}$, are shown.
Interactive Illustration 2.8: Finally, we see that $\hid{\vc{u}-\vc{v}}$ is the vector from $\hid{\vc{v}}$'s tip point to $\hid{\vc{u}}$'s tip point. The reader can move the red ($\hid{\vc{u}}$) and green ($\hid{\vc{v}}$) vectors, and as an exercise, try out what happens if one of $\hid{\vc{u}}$ or $\hid{\vc{v}}$ is set to the zero vector, and also try setting $\hid{\vc{u}=\vc{v}}$.
$\vc{u}$
$\vc{v}$
$-\vc{v}$
$-\vc{v}$
$-\vc{v}$
$\vc{u}-\vc{v}$
$\vc{u}-\vc{v}$
$\vc{u}-\vc{v}$

Example 2.2: Box
In this example, we will see how a box can be created by using three vectors that all make a right angle with each other.
Interactive Illustration 2.9: In this example, we have one red, one green, and one blue vector. These all make right angles with each other, and they are constrained to be like that. The length of the vectors can be changed interactively, though. In the following, we will show how a box can be built from these vectors.
Interactive Illustration 2.9: In this example, we have one red, one green, and one blue vector. These all make right angles with each other, and they are constrained to be like that. The length of the vectors can be changed interactively, though. In the following, we will show how a box can be built from these vectors.
There are a number of different rules for using both vector addition and scalar vector multiplication. This is the topic of the next section.

Using vectors in calculations with vector addition and scalar vector multiplication is fairly straightforward. They behave as we might expect them to. However, rules such as $\vc{u}+(\vc{v}+\vc{w})=(\vc{u}+\vc{v})+\vc{w}$, must be proved. The rules for vector arithmetic are summarized in Theorem 2.1.

Theorem 2.1: Properties of Vector Arithmetic
Assuming that $\vc{u}$, $\vc{v}$, and $\vc{w}$ are vectors of the same size, and that $k$ and $l$ are scalars, then the following rules hold:
 \begin{gather} \begin{array}{llr} (i) & \vc{u}+\vc{v} = \vc{v}+\vc{u} & \spc\text{(commutativity)} \\ (ii) & (\vc{u}+\vc{v})+\vc{w} = \vc{u}+(\vc{v}+\vc{w}) & \spc\text{(associativity)} \\ (iii) & \vc{v}+\vc{0} = \vc{v} & \spc\text{(zero existence)} \\ (iv) & \vc{v}+ (-\vc{v}) = \vc{0} & \spc\text{(negative vector existence)} \\ (v) & k(l\vc{v}) = (kl)\vc{v} & \spc\text{(associativity)}\\ (vi) & 1\vc{v} = \vc{v} & \spc\text{(multiplicative one)} \\ (vii) & 0\vc{v} = \vc{0} & \spc\text{(multiplicative zero)} \\ (viii) & k\vc{0} = \vc{0} & \spc\text{(multiplicative zero vector)} \\ (ix) & k(\vc{u}+\vc{v}) = k\vc{u}+k\vc{v} & \spc\text{(distributivity 1)} \\ (x) & (k+l)\vc{v} = k\vc{v}+l\vc{v} & \spc\text{(distributivity 2)} \\ \end{array} \end{gather} (2.6)
While most (or all) of the rules above feel very natural and intuitive, they must be proved nevertheless. The reader is encouraged to look at the proofs, and especially at the interactive illustrations, which can increase the feeling and intuition for many of the rules.

$(i)$ This rule (commutativity) has already been proved in the figure in Definition 2.3. Another way to prove this rule is shown below in Interactive Illustration 2.10.
Interactive Illustration 2.10: This interactive illustration shows commutativity of vector addition. This means that $\vc{u}+\vc{v}=\vc{v}+\vc{u}$. Click/touch Forward to continue.
Interactive Illustration 2.10: Finally, we also show the other translated vectors both to the left and right. As can be seen, the resulting vector sum is the same, regardless of the order of the operands. Recall that the vectors can be moved around.
$\textcolor{#aa0000}{\vc{u}}$
$\textcolor{#aa0000}{\vc{u}}$
$\textcolor{#aa0000}{\vc{u}}$
$\textcolor{#aa0000}{\vc{u}}$
$\textcolor{#00aa00}{\vc{v}}$
$\textcolor{#00aa00}{\vc{v}}$
$\textcolor{#00aa00}{\vc{v}}$
$\textcolor{#00aa00}{\vc{v}}$
$\textcolor{#0000aa}{\vc{u}+\vc{v}}$
$\textcolor{#0000aa}{\vc{v}+\vc{u}}$
$(ii)$ The proof of this rule (associativity) is shown in Interactive Illustration 2.11.
Interactive Illustration 2.11: Consider the three vectors, $\vc{u}$, $\vc{v}$, and $\vc{w}$. Since vectors do not have a specific starting point, we have arranged them so that $\vc{v}$ starts where $\vc{u}$ ends, and $\vc{w}$ starts where $\vc{v}$ ends.
Interactive Illustration 2.11: Consider the three vectors, $\hid{\vc{u}}$, $\hid{\vc{v}}$, and $\hid{\vc{w}}$. Since vectors do not have a specific starting point, we have arranged them so that $\hid{\vc{v}}$ starts where $\hid{\vc{u}}$ ends, and $\hid{\vc{w}}$ starts where $\hid{\vc{v}}$ ends.
$\textcolor{#aa0000}{\vc{u}}$
$\textcolor{#00aa00}{\vc{v}}$
$\textcolor{#0000aa}{\vc{w}}$
$\textcolor{#00aaaa}{\vc{v}+\vc{w}}$
$\vc{u}+(\vc{v}+\vc{w})$
$\textcolor{#aaaa00}{\vc{u}+\vc{v}}$
$(\vc{u}+\vc{v})+\vc{w}$
$\vc{u}+\vc{v}+\vc{w}$
$(iii)$ Since, there zero vector has length zero, the definition of vector addition gives us that $\vc{v}+\vc{0}$ is the same as $\vc{v}$.
$(iv)$ Since $-\vc{v}$ is exactly $\vc{v}$ with opposite direction, the sum will be zero.
$(v)$ The approach to this proof is to start with the left hand side of the equal sign, and find out what the direction and length is. Then the same is done for the right hand side of the equal sign. The details are left as an exercise for the reader.
$(vi)$ Since $1$ is a positive number, we know that $1\vc{v}$ and $\vc{v}$ have the same direction, so it only remains to control that they have the same length. The length of the left hand side of the equal sign is $\abs{1}\,\ln{\vc{v}}=\vc{v}$, and for the right hand side it is $\ln{\vc{v}}$, i.e., they are the same, which proves the rule.
$(vii)$ and $(viii)$ First, note the difference between these. In $(vii)$, we have a scalar zero times $\vc{v}$ equals a zero vector, and in $(viii)$, we have a scalar, $k$ times a zero vector, which is equals the zero vector. $(vii)$ is actually defined in Definition 2.4, so only $(viii)$ needs to be proved. The length of both $k\vc{0}$ and $\vc{0}$ are zero, which proves the rule.
$(ix)$ First, we refer the reader to Interactive Illustration 2.12. Be sure to press Forward until the last stage of the illustration. The formal proof (of distributivity) follows after the illustration.
Interactive Illustration 2.12: This illustration helps show the rule $k(\vc{u}+\vc{v}) = k\vc{u}+k\vc{v}$. First, we simply show two vectors, $\vc{u}$ and $\vc{v}$, and their sum, $\vc{u}+\vc{v}$. Press Forward to continue.
Interactive Illustration 2.12: Finally the vector $\hid{k(\vc{u}+\vc{v})}$ is shown as well. Note that the smaller triangle $\hid{\triangle O A_1 B_1}$ is similar to the larger triangle $\hid{\triangle O A_2 B_2}$ since it has the same angle at $\hid{A_1}$ and $\hid{A_2}$ and since the two edges $\hid{\vc{v}}$ and $\hid{\vc{u}}$ is proportional to $\hid{k\vc{v}}$ and $\hid{k\vc{u}}$. Thus it is clear that by adding $\hid{k\vc{u}}$ and $\hid{k\vc{v}}$, we reach $\hid{k\vc{u}+k\vc{v}}$, which is the same as $\hid{k(\vc{u}+\vc{v})}$. Recall that you can press the right mouse button, keep it pressed, and move the mouse to see the vector addition from another perspective. For tablets, the same maneuver is done by swiping with two fingers.
$k=$
$\vc{u}$
$\vc{v}$
$\vc{u} + \vc{v}$
$k\vc{u}$
$k\vc{v}$
$k(\vc{u} + \vc{v})$
$O$
$A_1$
$A_2$
$B_1$
$B_2$
It follows from scalar vector multiplication (Definition 2.4) that
 \begin{align} \ln{k\vc{u}} &= \abs{k}\,\ln{\vc{u}}, \\ \ln{k\vc{v}} &= \abs{k}\,\ln{\vc{v}}, \end{align} (2.7)
and if $k>0$ then $\vc{u}$ and $k\vc{u}$ have the same direction, and so do $\vc{v}$ and $k\vc{v}$. On the other hand, if $k<0$ then $\vc{u}$ and $k\vc{u}$ have opposite directions, and so do $\vc{v}$ and $k\vc{v}$. This implies that the triangle, formed by the following set of three points: $\{O$, $O+\vc{u}$, $O+\vc{u}+\vc{v}\}$, is similar to the triangle formed by $\{O$, $O+k\vc{u}$, $O+k\vc{u}+k\vc{v}\}$. That those two triangles are similar also means that $O$, $O+\vc{u}+\vc{v}$ and $O+k\vc{u}+k\vc{v}$ lie on a straight line. Furthermore, since the triangles are similar, and due to (2.7), we know that
 $$\ln{k(\vc{u}+\vc{v})} = \abs{k}\,\ln{\vc{u}+\vc{v}}.$$ (2.8)
If $k>0$ then $k(\vc{u}+\vc{v})$ has the same direction as $\vc{u}+\vc{v}$, and if $k<0$ then the have opposite directions. Hence, it follows that $k(\vc{u}+\vc{v}) = k\vc{u}+k\vc{v}$. The rule is trivially true if $k=0$, which concludes the proof of this rule.
$(x)$ This is somewhat similar to $(ix)$, but simpler, and so is left for the reader.
This concludes the proofs for Theorem 2.1.
$\square$

Example 2.3: Vector Addition of Three Vectors
To get an understanding of how vector addition works for more than two vectors, Interactive Illustration 2.13 below shows the addition of three vectors. Recall that vector addition is associative, so we may write $\vc{u}+\vc{v}+\vc{w}$ without any parenthesis.
Interactive Illustration 2.13: This interactive illustration shows the addition of three vectors, shown to the left. The vectors can be moved around as usual, and the interactive illustrated may be advanced by clicking/touching Forward.
Interactive Illustration 2.13: Finally, the black vector is shown, which is the sum of the three vectors. Recall that the vectors to the left can be moved around by clicking close to the tip of the vectors and moving the mouse while pressing. As an exercise, try to make the three vectors sum to zero so a triangle appears to the right.
$\vc{u}$
$\vc{v}$
$\vc{w}$
It is often useful to be able to calculate the middle point of two points. This is described in the following theorem.

Theorem 2.2: The Middle Point Formula
$A$
$B$
$M$
$O$
Assume that $M$ is the middle point of the line segment that goes between $A$ and $B$ as shown in the illustration to the right. Assume $O$ is another point. The vector $\overrightarrow{OM}$, i.e., from $O$ to $M$, can be written as
 $$\overrightarrow{OM} = \frac{1}{2}(\overrightarrow{OA} + \overrightarrow{OB}).$$ (2.9)

The vector $\overrightarrow{OM}$ is the sum of $\overrightarrow{OA}$ and $\overrightarrow{AM}$
 $$\overrightarrow{OM} = \overrightarrow{OA} + \overrightarrow{AM}.$$ (2.10)
Another way of saying this is that if you start in $O$ and want to end up in $M$, you can either go first from $O$ to $A$ and then from $A$ to $M$ (right hand side of the equation) or go directly from $O$ to $M$ (left hand side of equation).

By going via $B$ instead we get
 $$\overrightarrow{OM} = \overrightarrow{OB} + \overrightarrow{BM}.$$ (2.11)
Summing these two equations together gives
 $$2\overrightarrow{OM} = \overrightarrow{OA} + \overrightarrow{OB} + \overrightarrow{AM} + \overrightarrow{BM}.$$ (2.12)
Since $\overrightarrow{BM}$ is equally long as $\overrightarrow{AM}$ but has opposite direction it must hold that $\overrightarrow{BM} = -\overrightarrow{AM}$. Inserting this in the equation above and dividing by two gives
 $$\overrightarrow{OM} = \frac{1}{2}(\overrightarrow{OA} + \overrightarrow{OB}).$$ (2.13)
Sometimes you also see the shorter notation
 $$M = \frac{1}{2}(A + B)$$ (2.14)
$\square$

Example 2.4: Sierpinski Triangles using the Middle Point Theorem
We will now show how the middle point formula can be used to generate a geometrical figure called the Sierpinski triangle. Assume we have a triangle consisting of three points, $A$, $B$, and $C$. Using Theorem 2.2, the midpoints of each edge can now be computed. These midpoints can be connected to form four new triangles, where the center triangle is empty. If this process is repeated for each new non-empty triangle, then we arrive at the Sierpinski triangle. This is shown in Interactive Illustration 2.15 below.
Interactive Illustration 2.15: In this illustration, we will show how a geometrical figure, called the Sierpinski triangle, is constructed. We start with three (moveable) points, $A$, $B$, and $C$, connected to form a triangle.
Interactive Illustration 2.15: In this illustration, we will show how a geometrical figure, called the Sierpinski triangle, is constructed. We start with three (moveable) points, $\hid{A}$, $\hid{B}$, and $\hid{C}$, connected to form a triangle.
$A$
$B$
$C$
$M_1 = \frac{1}{2}(A + B)$
$M_2 = \frac{1}{2}(B + C)$
$M_3 = \frac{1}{2}(A + C)$

Example 2.5: Center of Mass Formula
$A$
$B$
$C$
$A'$
$O$
$M$
$2$
$1$
$B'$
$2$
$1$
$M$
In the triangle $ABC$, the point $A'$ is on the mipoint between $B$ and $C$. The line segment from $A$ to $A'$ is called the median of $A$. Let $M$ be the point that divides the median of $A$ in a proportion 2 to 1, shown in the illustration to the right.

The center of mass formula states that
 $$\pvec{OM} = \frac{1}{3}(\pvec{OA} + \pvec{OB} + \pvec{OC}).$$ (2.15)
This formula can be proved as follows. We can go from $O$ to $M$ either directly or via $A$, hence
 $$\pvec{OM} = \pvec{OA} + \pvec{AM}.$$ (2.16)
It is also possible to arrive at $M$ via $A’$. This gives
 $$\pvec{OM} = \pvec{OA'} + \pvec{A'M}.$$ (2.17)
One of the assumptions is that $\pvec{A'M}$ is half the length of $\pvec{AM}$ and of opposite direction, and therefore, it holds that $\pvec{A'M} = -\frac{1}{2}\pvec{AM}$. Inserting this in the equation above gives
 $$\pvec{OM} = \pvec{OA'} -\frac{1}{2}\pvec{AM}.$$ (2.18)
We can eliminate $\pvec{AM}$ by adding Equation (2.16) to two times Equation (2.18)
 $$\pvec{3OM} = \pvec{OA} + 2\pvec{OA'}.$$ (2.19)
Since $A'$ is the mid point of $B$ and $C$, we known from the middle point formula that $\pvec{OA'} = \frac{1}{2}(\pvec{OB} + \pvec{OC})$. Inserting this in the equation above gives
 $$\pvec{3OM} = \pvec{OA} + 2\frac{1}{2}(\pvec{OB} + \pvec{OC}),$$ (2.20)
which simplifies as
 $$\pvec{OM} = \frac{1}{3}(\pvec{OA} + \pvec{OB} + \pvec{OC}).$$ (2.21)
This completes the proof.

Note that since the formula is symmetric, it works just as well on the median to $B$. The same point, $M$, will divide the median going from $B$ to $B'$ in proportion $2:1$. This can be seen by pressing forward in the interactive illustration.

This point is also called the center of mass. If the triangle was cut out of cardboard, this is the point where it would balance of the top of a pencil, which exaplains the name "center for mass". Also, if equal point masses were placed in the points $A$, $B$ and $C$, $M$ is the point where they would balance out.

Most of you are probably familiar with the concept of a coordinate system, such as in the map in the first step of Interactive Illustration 2.17 below. In this first step, the axes are perpendicular and of equal length, but this is a special case, as can be seen by pressing Forward. This section will describe the general coordinate systems, and the interaction between vectors, bases, and coordinates.
Interactive Illustration 2.17: A map with an ordinary coordinate system. The center of the map is marked as the origin, and we show the $x$-axis as a horizontal arrow, and the $y$-axis as a vertical arrow. These axes are locally similar to the longitude and latitude, but not on a global scale since the earth is not flat. Press/click Forward to continue to the next stage.
Interactive Illustration 2.17: A map with an ordinary coordinate system. The center of the map is marked as the origin, and we show the $\hid{x}$-axis as a horizontal arrow, and the $\hid{y}$-axis as a vertical arrow. These axes are locally similar to the longitude and latitude, but not on a global scale since the earth is not flat. Press/click Forward to continue to the next stage.
$x$
$y$
$x$
$y$
$x$
$y$
$x$
$y$
$\vc{e}_1$
$\vc{e}_2$
Next, we define how coordinates can be described in one, two, and three dimensions. This is done with the following set of theorems.

Theorem 2.3: Coordinate in One Dimension
$\vc{e}$
$\textcolor{#aa0000}{\vc{v}}$
Let $\vc{e}$ be a non-zero vector on a straight line. For each vector, $\vc{v}$, on the line, there is only one number, $x$, such that
 $$\vc{v} = x \vc{e}.$$ (2.22)
(The vector, $\vc{v}$, in the figure to the right can be moved around.)

If $\vc{e}$ and $\vc{v}$ have the same direction, then choose $x=\ln{\vc{v}}/\ln{\vc{e}}$, and if $\vc{e}$ and $\vc{v}$ have opposite directions, then set $x=-\ln{\vc{v}}/\ln{\vc{e}}$. Finally, if $\vc{v}=\vc{0}$, then $x=0$. It follows from the definition of scalar vector multiplication, $x\vc{e}$, that $x$ is the only number that fulfils $\vc{v} = x\vc{e}$.
$\square$

Note that we say that $\vc{e}$ is a basis vector, and that $x$ is the coordinate for $\vc{v}$ in the basis of $\{\vc{e}\}$.

So far, this is not very exciting, but the next step makes this much more useful.

Theorem 2.4: Coordinates in Two Dimensions
$\vc{e}_1$
$\textcolor{#aa0000}{\vc{v}}$
$\vc{e}_2$
$O$
$P_1$
$P_2$
Let $\vc{e}_1$ and $\vc{e}_2$ be two non-parallel vectors (which both lie in a plane). For every vector, $\vc{v}$, in this plane, there is a single coordinate pair, $(x,y)$, such that
 $$\vc{v} = x\vc{e}_1 + y\vc{e}_2.$$ (2.23)
(The vectors $\vc{v}$, $\vc{e}_1$, and $\vc{e}_2$ can be moved around in the figure.)

For this proof, we will use Interactive Illustration 2.19. As can be seen, $P_1$ was obtained by drawing a line, parallel to $\vc{e}_2$, from the tip point of $\vc{v}$ until it collides with the line going through $\vc{e}_1$. Similarly, $P_2$ is obtained by drawing a line, parallel to $\vc{e}_1$, from the tip point of $\vc{v}$ until it collides with the line going through $\vc{e}_2$. It is clear that
 $$\vc{v} = \overrightarrow{O P_1} + \overrightarrow{O P_2}.$$ (2.24)
Now, let us introduce $\vc{u} = \overrightarrow{O P_1}$ and $\vc{w} = \overrightarrow{O P_2}$. Using Theorem 2.3 on $\vc{u}$ with $\vc{e}_1$ as basis vector, we get $\vc{u} = x \vc{e}_1$. Similarly, for $\vc{w}$ with $\vc{e}_2$ as basis vector, $\vc{w} = y \vc{e}_2$ is obtained. Hence, the vector $\vc{v}$ can be expressed as
 $$\vc{v} = \vc{u} + \vc{w} = x \vc{e}_1 + y \vc{e}_2.$$ (2.25)
It remains to prove that $x$ and $y$ are unique in the representation of $\vc{v}$. If the representation would not be unique, then another coordinate pair, $(x',y')$, would exist such that
 $$\vc{v} = x' \vc{e}_1 + y' \vc{e}_2.$$ (2.26)
Combining (2.25) and (2.26), we get
 \begin{gather} x \vc{e}_1 + y \vc{e}_2= x' \vc{e}_1 + y' \vc{e}_2 \\ \Longleftrightarrow \\ (x-x') \vc{e}_1 = (y'-y) \vc{e}_2. \end{gather} (2.27)
The conclusion from this is that if another representation, $(x',y')$, would exist, then $\vc{e}_1$ and $\vc{e}_2$ would be parallel (bottom row in (2.27)). For instance, if $x'$ is different from $x$, then $(x-x') \neq 0$ and both sides can be divided by $(x-x')$, which gives us
 \begin{gather} \vc{e}_1 = \frac{(y'-y)}{(x-x')} \vc{e}_2, \end{gather} (2.28)
which can be expressed as $\vc{e}_1 = k \vc{e}_2$ with $k = \frac{(y'-y)}{(x-x')}$. However, according to the corollary to Definition 2.4 this means that $\vc{e}_1$ and $\vc{e}_2$ are parallel, contradicting the assumption in Theorem 2.4. The same reasoning applies if $y' - y \neq 0$. Hence, we have shown that there is only one unique pair, $(x,y)$, for each vector, $\vc{v}$, by using a proof by contradiction.
$\square$

Note that we say that $\vc{e}_1$ and $\vc{e}_2$ are basis vectors, and that $x$ and $y$ are the coordinates for $\vc{v}$ in the basis of $\{\vc{e}_1,\vc{e}_2\}$.

Next, we will extend this to three dimensions as well.

Theorem 2.5: Coordinates in Three Dimensions
Let $\vc{e}_1$, $\vc{e}_2$, and $\vc{e}_3$ be three non-zero basis vectors, and that there is no plane that is parallel with all three vectors. For every vector, $\vc{v}$, in the three-dimensional space, there is a single coordinate triplet, $(x,y,z)$, such that
 $$\vc{v} = x\vc{e}_1 + y\vc{e}_2 + z\vc{e}_3.$$ (2.29)

Start by placing all the vectors $\vc{v}$, $\vc{e}_1$, $\vc{e}_2$ and $\vc{e}_3$ so that they start in the origin according to Interactive Illustration 2.20. Let $\pi_{12}$ be the plane through $O$ that contains $\vc{e}_1$ and $\vc{e}_2$, and let $P$ be the point at the tip of $\vc{v}$, i.e., $\vc{v} = \overrightarrow{OP}$.

$O$
$P_{12}$
$\vc{e}_1$
$\vc{e}_2$
$\vc{e}_3$
$P$
$\pi_{12}$
Interactive Illustration 2.20: Starting with the three vectors $\vc{e}_1$, $\vc{e}_2$ and $\vc{e}_3$, all placed with their tails in a point $O$.
Interactive Illustration 2.20: In summary, going from $\hid{O}$ to $\hid{P}$ can be done by first going to $\hid{P_{12}}$: $\hid{\overrightarrow{OP} = \overrightarrow{OP_{12}} + \overrightarrow{P_{12}P}}$. These two terms can in turn be exchanged using $\hid{\overrightarrow{OP_{12}} = x\vc{e}_1 + y \vc{e}_2}$ and $\hid{\overrightarrow{P_{12}P} = z\vc{e}_3}$. Thus $\hid{\overrightarrow{OP} = \overrightarrow{OP_{12}} + \overrightarrow{P_{12}P} = x\vc{e}_1 + y \vc{e}_2 + z\vc{e}_3}$.
Draw a line from $P$ parallel with $\vc{e}_3$ that intersects the plane $\pi_{12}$ in the point $P_{12}$. It is now clear that we can write $\vc{v}$ as the sum
 $$\vc{v} = \overrightarrow{OP} = \overrightarrow{OP_{12}} + \overrightarrow{P_{12}P}.$$ (2.30)
However, according to the Theorem 2.4 (two dimensions), $\overrightarrow{OP_{12}}$ can be written as $\overrightarrow{OP_{12}} = x \vc{e}_1 + y \vc{e}_2$, and according to Theorem 2.3 (on dimension), $\overrightarrow{P_{12}P}$ can be written as $\overrightarrow{P_{12}P} = z \vc{e}_3$. Hence, there exist three numbers $x$, $y$ and $z$, such that
 $$\vc{v} = x \vc{e}_1 + y \vc{e}_2 + z \vc{e}_3.$$ (2.31)
We must now prove that $x$, $y$ and $z$ are the only numbers for which this is possible. Assume that there is another set of numbers, $x'$, $y'$ $z'$, that also generates the same vector, $\vc{v}$, that is
 $$\vc{v} = x' \vc{e}_1 + y' \vc{e}_2 + z' \vc{e}_3.$$ (2.32)
Combining (2.31) and (2.32) gives
 $$x \vc{e}_1 + y \vc{e}_2 + z \vc{e}_3 = x' \vc{e}_1 + y' \vc{e}_2 + z' \vc{e}_3.$$ (2.33)
This can be rearranged to
 $$(x-x') \vc{e}_1 + (y-y') \vc{e}_2 + (z-z') \vc{e}_3 = 0.$$ (2.34)
If the new set ($x'$, $y'$, $z'$) is to be different from the other ($x$, $y$, $z$), at least one of the terms must now be different from zero. Assume it is $(x-x')$ (or else, rename the vectors and scalars so that it becomes this term). This means that we can divide by $(x-x')$ to obtain
 $$\vc{e}_1 = - \frac{(y-y')}{(x-x')} \vc{e}_2 - \frac{(z-z')}{(x-x')}\vc{e}_3,$$ (2.35)
which also can be expressed as
 $$\vc{e}_1 = \alpha \vc{e}_2 + \beta \vc{e}_3,$$ (2.36)
where $\alpha = - \frac{(y-y')}{(x-x')}$ and $\beta = - \frac{(z-z')}{(x-x')}$. However, this means that $\vc{e}_1$ lies in the same plane as $\vc{e}_2$ and $\vc{e}_3$ (see Theorem 2.4), which contradicts the assumption that there is no plane that is parallel to $\vc{e}_1$, $\vc{e}_2$ and $\vc{e}_3$. Thus there cannot exist any other set of values, $x'$, $y'$, $z'$, that satisfies the equation and therefore the proof is complete.
$\square$

Similarly as before, we say that $\vc{e}_1$, $\vc{e}_2$, and $\vc{e}_3$ are basis vectors, and that $x$, $y$, and $z$ are the coordinates for $\vc{v}$ in the basis of $\{\vc{e}_1,\vc{e}_2,\vc{e}_3\}$.

Now, we can finally see where the vector representation using coordinates comes from. If we assume that a certain basis, $\{\vc{e}_1, \vc{e}_2, \vc{e}_3\}$, is used, then we can write a three-dimensional vector, $\vc{v}$, as
 $$\vc{v} = v_x \vc{e}_1 + v_y \vc{e}_2 + v_z \vc{e}_3= \begin{pmatrix} v_x \\ v_y \\ v_z \end{pmatrix},$$ (2.37)
where we have used $v_x$ instead of $x$, $v_y$ instead of $y$, and $v_z$ instead of $z$. This is to make it simpler to mix several different vectors, and still be able to access the individual components. Note that the right-hand expression shows the vector as a column of three numbers, the $x$-coordinate on top, the $y$-coordinate in the middle, and the $z$-coordinate at the bottom. This is such an important notation, so we have summarized it into the following definition:

Definition 2.5: Column Vector Notation
Given a basis, a column vector, $\vc{v}$, in $n$ dimensions (we have used $n\in [1,2,3]$) is a column of $n$ scalar values. These scalar components, sometimes called vector elements, of the vector can either be numbered, i.e., $v_1$, $v_2$, and $v_3$, or we can use $x$, $y$, and $z$ as subscripts when that is more convenient. The notation is:
 \begin{gather} \underbrace{ \vc{u} = \begin{pmatrix} u_x \end{pmatrix} = \begin{pmatrix} u_1 \end{pmatrix}}_{\text{1D vector}}, \spc\spc \underbrace{ \vc{v} = \begin{pmatrix} v_x \\ v_y \end{pmatrix} = \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}}_{\text{2D vector}}, \spc\spc \\ \underbrace{ \vc{w} = \begin{pmatrix} w_x \\ w_y \\ w_z \end{pmatrix} = \begin{pmatrix} w_1 \\ w_2 \\ w_3 \end{pmatrix}}_{\text{3D vector}}, \end{gather} (2.38)
where $\vc{u} = u_x \vc{e}_1$, $\vc{v} = v_x \vc{e}_1 + v_y \vc{e}_2$, and $\vc{w} = w_x \vc{e}_1 + w_y \vc{e}_2 + w_z \vc{e}_3$.
We also use a more compact way of writing vectors, which is convenient when writing vectors in text, for example: $\vc{w} = \bigl(w_1,w_2,w_3\bigr)$, which means the same as above (notice the commas between the vector elements).

Column vectors, per the definition above, is the type of vectors that we use mostly throughout this book. Hence, when we say "vector", we mean a "column vector". However, there is also another type of vectors, namely, row vectors. As can be deduced from the name, it is simply a row of scalar values, instead of a column of scalar values. An example of a row vector is:
 $$\bigl(1\spc 2\spc 5 \bigr).$$ (2.39)
Any vector, be it row or column, can be transposed, which means that a row vector turns into a column vector, and a column vector turns into a row vector. The notation for a transposed vector is: $\vc{v}^T$. An example is shown below:
 $$\vc{v} = \begin{pmatrix} 1\\ 2\\ 5 \end{pmatrix}, \spc\spc\spc \vc{v}^\T = \bigl(1\spc 2\spc 5 \bigr).$$ (2.40)
We summarize the transposing of a vector in the following definition:

Definition 2.6: Transpose of a Vector
The transpose of a vector, $\vc{v}$, is denoted by $\vc{v}^\T$, and turns a column vector into a row vector, and a row vector into a column vector. The order of the vector components is preserved.
Note that with this definition, we can transpose a vector twice, and get back the same vector, i.e., $\bigl(\vc{v}^T\bigr)^T = \vc{v}$. Next, we also summarize the row vector definition below:

Definition 2.7: Row Vector Notation
A row vector is expressed as a transposed column vector, as shown below:
 $$\underbrace{ \vc{v}^\T = \bigl( v_x \spc v_y \bigr) }_{\text{2D row vector}}, \spc \spc \underbrace{ \vc{w}^\T = \bigl( w_x \spc w_y \spc w_z \bigr) }_{\text{3D row vector}}.$$ (2.41)
Notice that a row vector never has any commas between the vector elements. This is reserved for the compact notation for column vector (see Definition 2.5).

Now, let us assume that we have two vectors, $\vc{u}$ and $\vc{v}$, in the same basis, i.e.,
 $$\vc{u} = u_x \vc{e}_1 + u_y \vc{e}_2 + u_z \vc{e}_3= \begin{pmatrix} u_x \\ u_y \\ u_z \end{pmatrix} \spc\spc \text{and} \spc\spc \vc{v} = v_x \vc{e}_1 + v_y \vc{e}_2 + v_z \vc{e}_3= \begin{pmatrix} v_x \\ v_y \\ v_z \end{pmatrix}.$$ (2.42)
The addition, $\vc{u}+\vc{v}$, becomes:
 \begin{align} \vc{u}+\vc{v} &= u_x \vc{e}_1 + u_y \vc{e}_2 + u_z \vc{e}_3 + v_x \vc{e}_1 + v_y \vc{e}_2 + v_z \vc{e}_3 \\ &=(u_x+v_x)\vc{e}_1 + (u_y+v_y)\vc{e}_2 + (u_z+v_z)\vc{e}_3 \\ &= \begin{pmatrix} u_x+v_x \\ u_y+v_y \\ u_z+v_z \end{pmatrix}. \end{align} (2.43)
As can be seen, the vector addition boils down to simple component-wise scalar addition. For scalar vector multiplication, $k\vc{v}$, we have:
 \begin{align} k\vc{v} &= k (v_x \vc{e}_1 + v_y \vc{e}_2 + v_z \vc{e}_3) \\ &= (k v_x) \vc{e}_1 + (k v_y) \vc{e}_2 + (k v_z) \vc{e}_3\\ &= \begin{pmatrix} k v_x \\ k v_y \\ k v_z \end{pmatrix}, \end{align} (2.44)
and here we see that each component of the vector is multiplied by $k$.

Example 2.6: Vector Addition and Scalar Multiplication using Coordinates
Assume we have the following vectors in the same basis:
 $$\vc{u} = \left( \begin{array}{r} 3 \\ -4 \\ 7 \end{array} \right), \spc \spc \vc{v} = \left( \begin{array}{r} 1 \\ 2 \\ 5 \end{array} \right), \spc \spc \text{and} \spc \spc \vc{w} = \left( \begin{array}{r} 2 \\ -1 \\ 6 \end{array} \right),$$ (2.45)
and that we now want to evaluate $\vc{u} + \vc{v} - 2\vc{w}$. As we have seen above, vector addition is simply a matter of adding the vector elements:
 $$\vc{u}+\vc{v} = \left( \begin{array}{r} 3 \\ -4 \\ 7 \end{array} \right) + \left( \begin{array}{r} 1 \\ 2 \\ 5 \end{array} \right) = \left( \begin{array}{r} 3+1 \\ -4+2 \\ 7+5 \end{array} \right) = \left( \begin{array}{r} 4 \\ -2 \\ 12 \end{array} \right).$$ (2.46)
We can also scale a vector by a scalar value, e.g., $k=2$:
 $$2\vc{w} = 2 \left( \begin{array}{r} 2 \\ -1 \\ 6 \end{array} \right) = \left( \begin{array}{c} 2\cdot 2 \\ 2\cdot (-1) \\ 2\cdot 6 \end{array} \right) = \left( \begin{array}{r} 4 \\ -2 \\ 12 \end{array} \right),$$ (2.47)
which means that $\vc{u} + \vc{v} - 2\vc{w} = \vc{0}$.
In many calculations, one uses a simple and intuitive basis called the standard basis, which is defined as follows.

Definition 2.8: Standard Basis
The standard basis in this book is as follows for two and three dimensions, that is,
 \begin{gather} \underbrace{ \vc{e}_1 = \begin{pmatrix} 1 \\ 0 \end{pmatrix},\ \vc{e}_2 = \begin{pmatrix} 0 \\ 1 \end{pmatrix} }_{\mathrm{two-dimensional\ standard\ basis}} \ \ \mathrm{and} \\ \ \\ \underbrace{ \vc{e}_1 = \begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix},\ \vc{e}_2 = \begin{pmatrix} 0 \\ 1 \\ 0 \end{pmatrix},\ \vc{e}_3 = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}. }_{\mathrm{three-dimensional\ standard\ basis}} \end{gather} (2.48)
In general, for an $n$-dimensional standard basis, the basis vectors, $\vc{e}_i$ have vector elements which are all zeroes, except the $i$:th element, which is a one.
In Chapter 3, we will discuss different types of bases, and we will see that the standard basis is, in fact, an orthonormal basis (Section 3.3).

Example 2.7: Addition in the Standard Basis
In this example, we will illustrate how vector addition is done in the standard basis in order to increase the reader's intuition about addition. See Interactive Illustration 2.21. Recall that the standard basis vector in two dimensions are $\vc{e}_1=(1,0)$ and $\vc{e}_2=(0,1)$.
Interactive Illustration 2.21: Here, two vectors are shown in the standard basis. Click/touch Forward to continue.
Interactive Illustration 2.21: The coordinates of the blue vector are simply the sum of the respective coordinates of the red and green vectors. For example, the $\hid{x}$-coordinate of the blue vector is simply the addition of the $\hid{x}$-coordinates of the red and green vectors. Recall that the vector can be moved around by clicking/touching close to the tip of the red or green vector, and the drag.
$\vc{u}$
$\vc{v}$
$\vc{u}+\vc{v}$
Next, two intuitive examples will be given on the topics of coordinate systems, basis vectors, uniqueness, and coordinates.

Example 2.8: Same Point Expressed In Different Bases
Note that the same point will have different coordinates when different basis vectors are used, as shown in Interactive Illustration 2.22. Note in the illustration that when the basis vectors change, the coordinates change too, but the point stays at the same place all the time.
Interactive Illustration 2.22: Here, we show how the same point, $P$, can be expressed in different coordinate systems. In the first step, we have an ordinary coordinate system where the first basis vector, $\vc{e}_1$ (thick red arrow) and the second basis vector, $\vc{e}_2$ (green thick arrow) make a right angle, and they are of equal length. The coordinates $(2,1)$ mean that if we start from the origin, go two steps along $\vc{e}_1$ and one step along $\vc{e}_2$, with the result that we end up in $P$.
Interactive Illustration 2.22: Here is another example, where the coordinates for $\hid{P}$ equals $\hid{(3,1)}$. Note that you can move the two basis vectors and $\hid{P}$, while the coordinates will adjust accordingly. Note also that if you place the two basis vectors so that they become almost parallel, then the coordinates start to rise dramatically and erratically. This makes sense, since if the vectors were indeed completely parallel, you would only be able to represent points on the line going from the origin along the first basis vector (or the second, which would be equivalent). If they are slightly different, this small difference must be enhanced by a large number in order to reach $\hid{P}$.
$O$
$P =$
$\vc{e}_1$
$\vc{e}_2$
$\vc{e}_2$
$\vc{e}_2$

Going back to stage two in Interactive Illustration 2.22, it is obvious that adding the two basis vectors together brings us the vector $\overrightarrow{OP}$ exactly, so $\overrightarrow{OP} = 1.0 \vc{e}_1 + 1.0 \vc{e}_2$ must hold. Thus, $(1, 1)$ is a valid coordinate pair for the point $P$. However, one may ask whether there are any other coordinates that will also describe the point $P$, now that the basis vectors no longer need to make a right angle. The answer to this is no, as we have seen in the proof to Theorem 2.4. A bit more intuition about why this is so, can be obtained from Interactive Illustration 2.23.
Interactive Illustration 2.23: In this interactive figure, the fat arrows represent the basis vectors, $\vc{e}_1$ and $\vc{e}_2$. The point, $P$, has the coordinates $(2.5, 1.0)$ since, if you start in the origin, you need to go $2.5$ steps along $\vc{e}_1$ (thin red arrow) and one step along $\vc{e}_2$ (thin green arrow) to get to $P$. But could other coordinates also work? Press/click Forward to advance the illustration.
Interactive Illustration 2.23: In this interactive figure, the fat arrows represent the basis vectors, $\hid{\vc{e}_1}$ and $\hid{\vc{e}_2}$. The point, $\hid{P}$, has the coordinates $\hid{(2.5, 1.0)}$ since, if you start in the origin, you need to go $\hid{2.5}$ steps along $\hid{\vc{e}_1}$ (thin red arrow) and one step along $\hid{\vc{e}_2}$ (thin green arrow) to get to $\hid{P}$. But could other coordinates also work? Press/click Forward to advance the illustration.

In this chapter, we have introduced the notion of vectors. The definitions of a vector in Section 2.5 and the basic operations, such as vector addition (Definition 2.3) and multiplication with a scalar (Definition 2.4), have been defined geometrically. We then showed that these two operations fulfill a number of properties in Theorem 2.1. This definition works for $\R^1$, $\R^2$, and $\R^3$. For higher dimensions, it is difficult for us to use the geometric definition. The notion of a two-dimensional and three-dimensional vector is in itself very useful, but geometric vectors are also a stepping stone for understanding general linear spaces or vector spaces. This more general theory is extremely useful for modeling and understanding problems when we have more than three unknown parameters. The reader may want to skip the following section, and revisit it later depending on his/her needs.

In this section, we will first give a definition of a $\R^n$.

Definition 2.9: Real Coordinate Space
The vector space $\R^n$ is defined as $n$-tuples $\vc{u} = (u_1, u_2, \ldots, u_n)$, where each $u_i$ is a real number. It is a vector space over the real numbers $\R$, where vector addition $\vc{u}+\vc{v}$ is defined as $\vc{u}+\vc{v} = (u_1+v_1, u_2+v_2, \ldots, u_n+v_n)$ and scalar-vector multiplications is defined as $k\vc{v} = (k v_1, k v_2, \ldots, k v_n)$, where $k\in \R$.
Note that using these definitions for vector addition and scalar-vector multiplication, the properties of Theorem 2.1 all hold.

Example 2.10:
Let $\vc{u}=(1,2,3,4,5)$ and $\vc{v}=(5,4,3,2,1)$ be two vectors in $\R^5$. What is $\vc{u}+\vc{v}$, $3\vc{u}$ and $3\vc{u}+3\vc{v}$?
 $$\vc{u}+\vc{v} = (1,2,3,4,5) + (5,4,3,2,1) = (1+5,2+4,3+3,4+2,5+1) = (6,6,6,6,6)$$ (2.49)
 $$3\vc{u}= 3(1,2,3,4,5) = (3 \cdot 1,3 \cdot 2,3 \cdot 3,3 \cdot 4,3 \cdot 5) = (3,6,9,12,15)$$ (2.50)
 $$3\vc{u}+3\vc{v} = 3 (\vc{u}+\vc{v}) = 3 (6,6,6,6,6) = (18,18,18,18,18)$$ (2.51)
In this last step, the result ($\vc{u}+\vc{v}$) from Equation (2.49) was used.

Definition 2.10: Basis in $\R^n$
A basis in $\R^n$ is a set of vectors $\{\vc{e}_1, \ldots, \vc{e}_m\}$ in so that for every vector $\vc{u}\in\R^n$, there is a unique set of coordinates $(u_1, \ldots, u_m)$ so that
 $$\vc{u} = \sum_{i=1}^m u_i \vc{e}_i.$$ (2.52)

Example 2.11: Canonical Basis in $\R^n$
The canonical basis in $\R^n$ is the following set of basis vectors
 $$\begin{cases} \begin{array}{ll} \vc{e}_1 &= (1, 0, \ldots, 0), \\ \vc{e}_2 &= (0, 1, \ldots, 0), \\ \vdots & \\ \vc{e}_n &= (0, 0, \ldots, 1). \end{array} \end{cases}$$ (2.53)

#### 2.6.1 The General Definition

We will now present an abstract definition of a vector space. Then we will show that any finite-dimensional vector space over $\R$ is in fact 'the same as' $\R^n$ that we defined earlier in Definition 2.9.

Definition 2.11: Vector space
A vector space consists of a set $V$ of objects (called vectors) and a field $F$, together with a definition of vector addition and multiplication of a scalar with a vector, in such a way that the properties of Theorem 2.1 holds.
A vector space consists of a set $V$ of objects. As we shall see in one example, the vector space is the set of images of size $m \times n$ pixels. In another example, the vector space is a set of polynomials up to degree $5$. The elements of the field $F$ are called scalars. A field is a set of objects where addition, subtraction, multiplication and division is well defined and follows the usual properties. Most often the field used is the set of real numbers $\R$ or the set of complex numbers $\mathbb{C}$, but one could use more exotic fields, such as integers modulu a prime number, e.g., $\mathbb{Z}_3$.

Example 2.12: Polynomials up to degree 2
Polynomials in $x$ up to degree 2 with real coefficients is a vector space over $\R$. Here if $u = u_0 + u_1 x + u_2 x^2$ and $v = v_0 + v_1 x + v_2 x^2$, where each coefficient $u_i$ and $v_i$ is a real number. Here vector addition $u+v$ is defined as $u+v = (u_0+v_0) + (u_1+v_1) x + (u_2+v_2) x^2$ and scalar-vector multiplications is defined as $ku = k u_0 + k u_1 x + k u_2 x^2$.

Example 2.13: Gray-scale images
Gray-scale images, where each pixel intensity is a real number is a vector space over $\R$. Here if the pixel of the image $u$ at position $(i,j)$ has intensity $u_{i,j}$ and similarily if the pixel of the image $v$ at position $(i,j)$ has intensity $v_{i,j}$, then vector addition is defined as an image $u+v$ where the intensity of the pixel at position $(i,j)$ is $u_{i,j}+v_{i,j}$. The scalar-vector multiplications is defined as the image $ku$ where the pixel at position $(i,j)$ has intensity $k u_{i,j}$,

Example 2.14: $\mathbb{Z}_3$ Coordinate Space
The vector space $\mathbb{Z}_3^n$ is defined as n-tuples $\vc{u} = (u_1, u_2, \ldots, u_n)$, where each $u_i$ is one of the integers $0$, $1$, or $2$. It is a vector space over the integers $0$, $1$, and $2$. Vector addition $\vc{u}+\vc{v}$ is defined as $\vc{u}+\vc{v} = (u_1+v_1, u_2+v_2, \ldots, u_n+v_n)$ and scalar-vector multiplications is defined as $k\vc{v} = (k u_1, k u_2, \ldots, k u_n)$. Here the multiplications and additions of two scalars are done moduli 3.

Definition 2.12: Basis in Vector Space
A basis in a finite dimensional vector space $V$ over $F$ is a set of vectors $\{\vc{e}_1, \ldots, \vc{e}_m\}$ in so that for every vector $\vc{u} \in V$, there is a unique set of coordinates $(u_1, \ldots, u_m)$ with $u_i \in F$, so that
 $$\vc{u} = \sum_{i=1}^m u_i \vc{e}_i.$$ (2.54)
The number, $m$, of basis vectors is said to be the dimension of the vector space. We will later show that this is a well-defined number for a given vector space.

Theorem 2.6: Vector in Vector Space
Let $V$ be a vector space over $\R^m$ and let $\{\vc{e}_1, \ldots, \vc{e}_m\}$ be a basis. Then each vector $\vc{u}$ can be identified with its coordinates $(u_1, \ldots, u_m)$.
In this way, one can loosely say that each $m$-dimensional vector space over $\R$ is 'the same thing' as $\R^m$.

The vector concept has been treated in this chapter, and the vector addition and scalar vector multiplication operations have been introduced. In addition, we have seen that these operations behave pretty much as expected, i.e., similar to how we calculate with real numbers. To make the vectors a bit more practical, the basis concept was introduced, and we saw how a, e.g., three-dimensional vector can be represented by three scalar numbers with respect to a certain basis. Finally, we also introduced the concept of a higher-dimensional vector space $\R^n$ very briefly. In Chapter 3, the dot product operation will be introduced. It is useful when measuring length and angles.

 Chapter 1: Introduction (previous) Chapter 3: The Dot Product (next)