# Vectors

Vectors have a length and a direction. In GeoGebra you enter a vector either by using a tool or the input bar. See GeoGebra Tutorial - Cartesian Coordinates for information about how GeoGebra treats points and vectors respectively. Vectors are often used to translate object.

## Translations

### Translation along a vector

- Make a vector and a polygon.
- Make translated copies of the polygon (find the tool).
- Change the vector and the original polygon.

### Unit vectors

Unit vectors are vectors that have the length one unit. In GeoGebra you make a unit vector by using the command
`UnitVector[< vector > ]`

. In the topmost worksheet, each ant moves in the direction to the next ant, in
a clockwise order, and the length of the movement is given by the slider `speed`

. If `A1`

and `B1`

represent the positions of the first and second ants, then the next position `A2`

of the first ant
will be given by:

A2 = A1+speed*UnitVector[Vector[A1,B1]]

The easiest way to make a curve of pursuit in GeoGebra is to use the spreadsheet.

### Translations along Two Vectors

The blue polygon is translated along the green vector; the result is the green polygon. Then the green polygon is translated along the yellow vector; the result is the yellow polygon.

- Make a new vector in the applet above.
- Translate the blue polygon along your new vector.
- How should you create your vector in order for the translated polygon to always overlap the yellow polygon?

If you succeed with the task, you have created a translation that has the same effect as two translations. This gives us a reasonable way of defining vector addition.

## Adding Vectors

Vector addition is defined in the following way:

From the construction above you can see that ` w=u+v=v+u`;
changing the order of the vectors does not change the result, another word for
this is that vector addition is

**commutative**.

You can also represent vector addition graphically as a parallelogram.

## Basis and Coordinates

A **scalar** is a real number. When doing vectors you want to
distinguish between quantities having a direction and quantities with no direction.

### Exercise - Multiplication with a Scalar

- Make a vector
`u`

with its initial point at the origin. - Input
`2*u`

in the input bar. - Input
`-u`

in the input bar. - Change the vector
`u`

. - Make a slider
`a`

. Input`a*u`

in the input bar. Describe the result when multiplying a vector with a scalar; a positive or negative scalar.

What happens when multiplying with zero? Is the result still a vector? Would it be reasonable to define the "zero vector" as a vector or not? If it is a vector how does it differ from other vectors?

### Some definitions

Any two non-zero vectors that are not parallel, form a **basis**
for the plane. Given a basis you can describe any vector in the plane as a **linear
combination** of the basis vectors.

If the basis vectors are called \(\mathbf{u}\) and \(\mathbf{v}\), then any vector \(\mathbf{w}\) can be written as

\[\mathbf{w}=a\mathbf{u}+b\mathbf{v}\]

for some scalars \(a\) and \(b\). \(\mathbf{w}\) is a so called linear combination of \(\mathbf{u}\) and \(\mathbf{v}\).
The scalars \(a\) and \(b\) are called the **coordinates** of \(\mathbf{w}\) in the basis
\(\mathbf{u}\) and \(\mathbf{v}\).

If the basis is known, you can use a short form for writing the vector, either as

\[\mathbf{w}=(a,b) \hspace{1cm} \text{or} \hspace{1cm} \mathbf{w}=\binom{a}{b}\]

If you have two vectors \(\mathbf{w}=a\mathbf{u}+b\mathbf{v}\) and \(\mathbf{z}=c\mathbf{u}+d\mathbf{v}\), you can add them like this

\[\binom{a}{b}+\binom{c}{d}=a\mathbf{u}+b\mathbf{v}+c\mathbf{u}+d\mathbf{v}=(a+c)\mathbf{u}+(b+d)\mathbf{v}=\binom{a+c}{b+d}\]

In GeoGebra the Cartesian coordinate-system is used to define the basis vectors. The first basis vector is a vector
from the origin to the point (1,0), the second vector is from the origin to the point (0,1). A basis for which
each basis vector is a unit-vector, and where the basis vectors are mutually ortoghonal (perpendicular to each other),
is called an **orthonormal basis**.

## Bound Vectors

In a Cartesian plane, you can place a vector between points in the plane. By choosing the base vectors to have the initial points at the origin and their terminal points at (1, 0) and (0, 1) respectively, you get a convenient basis for comparing the coordinates of vectors and the coordinates of points.

The vector coordinates of \(\mathbf{w}\) are the same as the Cartesian coordinates of the terminal point \(P\) of \(\mathbf{w}\). You can describe the vector \(\mathbf{w}\) as the vector with the initial point \(O\) and the terminal point \(P\), where \(O\) is at the origin.

\[\mathbf{w}=\vec{OP}\]

\(\vec{OP}\) is a **bound vector**, it is a vector between the points \(O\) and \(P\)
and as such it cannot be moved. If you want a movable vector, you introduce
a vector \(\mathbf{w}\) and let \(\mathbf{w}=\vec{OP}\).

### Reaching a point in the Cartesian plan

By applying vector addition repeatedly you find that \(\mathbf{z}=\mathbf{u}+\mathbf{v}+\mathbf{w}\); or in bound vectors

\[\vec{OC}=\vec{OA}+\vec{AB}+\vec{BC}\]

## Subtracting vectors

When subtracting two vectors \(\mathbf{u}\) and \(\mathbf{v}\), you get the resulting vector, \(\mathbf{u}-\mathbf{v}\), by starting at the terminal point of \(\mathbf{v}\) and ending at the terminal point of \(\mathbf{u}\); as seen from the parallelogram in the construction below.

This result is especially important when trying to find the coordinates of bound vectors between points in the Cartesian plane.

If you have the vector \(\vec{PQ}\) between two points \(P\) and \(Q\) with known coordinates; you can find the coordinates of \(\vec{PQ}\) by using vector subtraction.

Since \(\vec{OP}\) and \(\vec{OQ}\) have the same coordinates as the points \(P\) and \(Q\), you can find the coordinates of \(\vec{PQ}\) by using the identity:

\[\vec{PQ}=\vec{OQ}-\vec{OP}\]

## Equation of a Line - Exercise

### Through Point along Vector

Given points O and A, a vector **u** and a parameter *t*,
you should be able to find an equation for the vector **r** in
terms of O, A, **u** and *t*. In the construction above
this has been done. The point P, which is the endpoint of **r**
has also been created. If *t* could take on any real value, the point
P could reach any point on the line *l*.

In the construction below you are given the objects O, A, **u**
and *t *(there are other objects as well but their names are hidden).
Using these four objects make vector/vectors and point/points to find a vector
**r** as in the construction above. You can make new objects by
using these commands:

w=Vector[<Start Point>,<End Point>] w=u+v (where u and v are vectors that are already defined) w=a*u (where a is a number and u is vector, both defined)

### Through Two Points

Given three points O, A and B; and a parameter *t*, you should be able
to find an equation for the vector **r** in terms of O, A, B**
**and *t*. In the construction above this has been done. The point
P, which is the endpoint of **r** has also been created. If *t*
could take on any real value, the point P could reach any point on the line
*l*.

In the construction below you are given the objects O, A, B and
*t *(there are other objects as well but their names are hidden). Using
these four objects make vector/vectors and point/points to find a vector **r**
as in the construction above.

by Malin Christersson under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Sweden License