# Vector arithmetic

https://arbital.com/p/vector_arithmetic

by Adele Lopez Nov 26 2016 updated Dec 13 2016

Vectors: what they are, and how to add and scale them.

A vector is like an arrow, and has a direction and a magnitude. Vectors can be manipulated algebraically, and follow rules similar to the rules in elementary algebra, which allows us to do vector arithmetic. Vectors are used in [geometry geometry] to describe the relative positions of different points, and in [physics physics] to represent quantities such as [velocity velocities], [force forces], and [momentum momentum]. They are studied in mathematics in linear algebra as belonging to a vector space, and this mathematical framework based around them has extraordinary applicability to virtually every scientific field.

Vectors have their origin in geometry, but it was realized that they can be given names and manipulated by following certain rules, like we do with numbers in algebra. In fact, many of the same rules from algebra still make sense in the context of vectors. This makes calculations much easier, and it was found that the vector rules applied in situations far beyond the original geometric situations they were designed for.

To study vectors, we can draw geometric figures which have the advantage of being visual and intuitive, and show how vectors relate to the physical world. However, as the applications of vectors increase in complexity, it becomes easier for us (and computers) to work with vectors algebraically. The algebra also allows us to be more precise. So we will learn how to use both together.

# Points Each point has a position.

We can name the points: We'll usually use lowercase letters like $a$ or $b$ for points.

# Vectors

A vector has a direction and a magnitude. We'll start by thinking of the magnitude as the length of the vector, but in different contexts, other interpretations make more sense. In any case, the magnitude is either a positive number, or zero. %%note: Sometimes you might see negative or complex magnitudes being used, but we can think of these numbers as including directional information.%% We also give vectors names – usually a letter in boldface (like $\textbf{v}$), or with a little bar over it (like $\bar{v}$). We enclose a vector in bars to denote its magnitude: $|\textbf{v}|$, which reminds us that it is like the [absolute_value absolute value] of a vector.

Vectors do not have a position which means these: are all the same vector, since they all point in the same direction and have the same magnitude.

If we start at a point, we can add a vector to it to go to another point. We write this as $b + \textbf{v} = c$. This just says: "If you start at $b$, and move along the vector $\textbf{v}$, you will end up at $c$."

We can rearrange this algebraically to get $\textbf{v} = c - b$. You can think of this as saying that $\textbf{v}$ is the difference between the points $c$ and $b$. We can use this to describe vectors we haven't named yet. Two vectors can also be added together, which will give us a new vector. $$\textbf{u} + \textbf{v} = \textbf{w}$$

If we write these vectors as the differences between two points, we can see that the algebra gives us the same result! $$(b-a) + (c-b) = c -b + b -a = c-a$$

The math for vectors was designed so that things which are true algebraically are also true geometrically, and vice versa.

If we are adding three or more vectors, it doesn't matter the order we do the sums in. $$(\textbf{u}+\textbf{v})+\textbf{w}=\textbf{u}+(\textbf{v}+\textbf{w})$$
This is called the associative property of vector addition.

It also doesn't matter what order we order the vectors themselves in: $$\textbf{u} + \textbf{v} = \textbf{v} + \textbf{u}$$ This is called the commutative property. Try drawing a picture of this relation yourself so you can see why it is true geometrically.

# Scaling vectors

What happens when we add the same vector to itself? We get a vector in the same direction, but with twice the magnitude! Algebraically, we can depict this as $\textbf{v} + \textbf{v} = 2\textbf{v}$.

In general, we can scale a vector by any amount we want. The number we scale it by is called a scalar. We can write this as $n\textbf{v}$, with $n$ being the scalar. This is called scalar multiplication. It doesn't matter which side we put the scalar on, so we say it has the commutative property: $$n\textbf{v}=\textbf{v}n$$

Scaling something by $1$ doesn't change it, so we have the simple, but important fact that: $$1\textbf{v}=\textbf{v}$$

## Compatibility of scalar multiplication

%%todo: The scalar compatibility rule should be given more significance, including a picture illustrating it. %% One handy fact is that if we scale a vector, and then scale it again, the resulting vector will be scaled by the product of the two scalars. In algebra: $$n(m\textbf{v}) = (nm)\textbf{v}$$ In other words, scalar multiplication is compatible with itself. Since these are the same, there's no need to keep the parenthesis, we can just write $nm\textbf{v}$ and the meaning will be clear.

## Reverse

One thing that comes in handy a lot is reversing a vector. To see what this should be algebraically, we'll write the vector as the difference of points: $\textbf{v} = b -a$. Remember, this means $\textbf{v}$ is the vector that will take you from $a$ to $b$. The reverse vector will be the vector that will take you from $b$ to $a$, so $a - b$, which is $-(b -a)= -\textbf{v}$.

This means that reversing a vector is the same as scaling it by $-1$. This can be combined with the fact that scalar multiplication is compatible with itself to scale a vector by any negative number: $n(-1\mathbf {v}) =-n\mathbf v$.

## The zero vector

If we scale any vector by $0$, we get a special vector called the zero vector. $0\textbf{v} = \textbf{0}$. We write the zero vector in bold still to remind ourselves it's still a vector. As you can see, this vector is special because it has no direction, just a magnitude which is zero. And even though it looks like a point, it is different because it doesn't even have a position!

If we add the zero vector to any point, we just get the same point: $a + \textbf{0} = a$. If we add the zero vector to any vector, we get the same vector: $\textbf{v} + \textbf{0} = \textbf{v}$. If we add a vector to its reverse, we get the zero vector: $\textbf{v} - \textbf{v} = 0$. It's the additive identity for vector addition, just like zero is the additive identity for ordinary addition. This similarity is the reason we call it the zero vector.

## Magnitude

What happens to the magnitude of a vector when we scale it? For vectors scaled by positive numbers, it makes intuitive sense to just multiply the magnitude by the same number. For example, as we saw earlier, the magnitude of $2\mathbf{v}$ is $2|\mathbf{v}|$: But what about when we scale by a negative number? Let's look at a vector scaled by $-1$ again: You can see that in this case, the vectors still have the same length, so we expect that their magnitudes should be the same as well. $|\mathbf{v}|=|-\mathbf{v}|$In general, it makes sense for us to calculate the magnitude of a scaled vector by multiplying it by the [absolute_value absolute value] of the scalar: $$|n\textbf{v}|=|n||\textbf{v}|$$ The absolute value is like a magnitude for scalars!

This fact also gives us a way to ignore the magnitude, and just focus on the direction of a vector. We can scale a vector by the inverse of its magnitude to get a vector with magnitude one with the same direction: $\frac{1}{|\mathbf v|}\mathbf v$. We write this vector as $\mathbf{\hat v}$. We can verify that it has magnitude one in the following way: $$|\mathbf{\hat v}| = \left|\frac{\mathbf{v}}{|\mathbf{v}|}\right| = \left|\frac{1}{|\mathbf{v}|}\right||\mathbf{v}| = \frac{|\mathbf{v}|}{|\mathbf{v}|}=1$$

We call this kind of vector a unit vector, and the process of scaling a vector to get its unit vector is called normalization. But what about the zero vector? It doesn't have a direction at all, so there just isn't a unit vector that has the same direction! When we scale a vector by zero, we lose the information about its direction, and so we can't undo it. This is the reason why we have a rule that we can't [division_by_zero divide by zero].

# Distribution

How does scalar multiplication interact with vector addition? If we take $2v+3v$, then the sum is $(2+3)v=5v$. This means that multiplication of vectors by scalars is distributive over scalar summation: $$n\textbf{v} + m\textbf{v} = (n+m)\textbf{v}$$

What happens to the sum of two vectors if we scale them by the same scalar? Here's an illustration for $\textbf{u} +\textbf{v} = \textbf{w}$, which are then scaled by $2$. We can see that $2\textbf{u} + 2\textbf{v} = 2\text{w}$, the sum is scaled by the same amount as well! The same thing is true for any scalar – multiplication by scalars is also distributive over vector addition. For any scalar $n$, and any vectors $\textbf{u}$ and $\textbf{v}$: $$n\textbf{u} + n\textbf{v} = n(\textbf{u} + \textbf{v})$$

# Three dimensions and beyond

All of the same algebraic laws work in three dimensions too. As a visual example: $$\textbf{x} - \textbf{y} - \textbf{z} = \textbf{d}$$

This is really helpful when doing calculations because it is a lot harder to draw things in three dimensions, but the algebra stays at about the same level of difficulty. It's even more helpful when doing work that requires four, or even more dimensions, where it is almost impossible to draw them!

# Vector space

Vectors live inside of a space, called a vector space. %%note: Vector spaces also include the set of allowed scalars, which in most applications is just the real numbers.%% Within a space, any vectors that live inside that space can be added to get another vector, or be scaled to get another vector! For example, the arrows on this page all belong to the vector space of geometric vectors in two (or three) dimensions. Note that if we take vectors from different vector spaces, there usually isn't a meaningful way to add the vectors together.

The algebraic rules we've used for vectors apply for all the vectors in any vector space – in fact, we could say that having a system with all of the rules here is what makes something a vector space. Likewise, any set of things that follow these rules can be called a vector.

Not all vector spaces have a geometric meaning. To fit different contexts, we can add more operations and properties into the math, so that our math matches the rules of the specific context. We'll continue studying vectors from a geometric context, and add more mathematical tools to fit that context, such as the [geometric_product geometric product]. However, we will first work on understanding vectors in general more deeply.

# Summary

Here's a list of the rules we've covered, so you can see them all at once. Each rule is true for any vectors $\mathbf{u}$, $\mathbf{v}$, and $\mathbf{w}$, and for any scalars $n$ and $m$.

Associativity of vector addition: $$(\mathbf{u}+\mathbf{v})+\mathbf{w} = \mathbf{u}+(\mathbf{v}+\mathbf{w})$$ Commutativity of vector addition: $$\mathbf{u}+\mathbf{v} = \mathbf{v} + \mathbf{u}$$

### Special scalars that always give us special vectors

Multiplicative identity: $$1\mathbf{v} =\mathbf{v}$$ Reverse vector: $$-1\mathbf{v}=-\mathbf{v}$$ Zero vector: $$0\mathbf{v} = \mathbf{0}$$ Unit vector (only when $|\mathbf{v}|\neq 0$): $$\frac{1}{|\mathbf v|}\mathbf v = \mathbf{\hat v}$$

### Rules for scalar multiplication

Commutativity of scalar multiplication: $$n\mathbf{v}=\mathbf{v}n$$ Magnitude after scalar multiplication: $$|n\mathbf{v}| = |n||\mathbf{v}|$$ Compatibility of scalar multiplication: $$n(m\mathbf{v}) = (nm)\mathbf{v}$$

### Rules for how vector addition and scalar multiplication interact

Distributivity over vector sum: $$n\mathbf{v}+m\mathbf{v} = (n+m)\mathbf{v}$$ Distributivity over scalar sum: $$n\mathbf{u} + n\mathbf{v} = n(\mathbf{u}+\mathbf{v})$$

Next, let's see how combining vectors works!

Kevin Clancy

So to reverse a vector, just scale it by $-1$\. This can be combined with the product rule for scalars to scale a vector by any negative number\!

I see that there is a description of double scaling above. I assume that this is what "the product rule" refers to, but it is never explicitly labeled as such. Maybe giving the paragraph above Reverse a bold heading titled "The Product Rule" would help with this.

Chris Holden

This fact also gives us a way to ignore the magnitude, and just focus on the direction of a vector\. We can scale a vector by the inverse of its magnitude to get a vector with magnitude 1 with the same direction, called ${\\bf \\hat v}$\. $$|\\mathbf{\\hat v}| \= \\left|\\frac{\\mathbf{v}}{|\\mathbf{v}|}\\right| \= \\left|\\frac{1}{|\\mathbf{v}|}\\right||\\mathbf{v}| \= \\frac{|\\mathbf{v}|}{|\\mathbf{v}|}\=1$$

Maybe insert an equation style definition of the unit vector here, before showing that it has magnitude 1.

$\hat{\mathbf v} = \frac{1}{| \mathbf v |}\mathbf v = \frac{\mathbf v}{| \mathbf v |}$.