# Linear Algebra/Vectors

Vectors are commonly used in physics and other fields to express quantities that cannot be accurately described by a scalar. Scalars are simply the value of something in a single dimension - a real number. For example, one might say that they have driven 5 kilometers, that an hour has elapsed, or that something's mass is 20 kilograms. In every one of these cases, there has been exactly one value stated.
However, we might have more information we wish to give. Take the example of driving 5 kilometers. In this case, it may be useful to know how far you drove, but it might also be equally important which direction you drove, such as 5 kilometers due east. Now, given your starting point, exactly where you drove can be determined.

## Definitions

Vectors can be described mathematically by using trigonometry.
We can define a vector to be an ordered pair consisting of a magnitude and a direction. In this diagram, r is the magnitude of this vector and θ is the direction. Notice, now, that we have moved horizontally r cos(θ) and vertically r sin(θ). These are called the x-component and the y-component, respectively.
We can also write a vector conveniently in terms of the x and y component. We write ${\begin{pmatrix}x\\y\end{pmatrix}}$ for vectors. In some texts, you may see the vector written sideways, like (x, y), but when you write it will help greatly to write them downwards in columns. In print we commonly use bold vectors, but since you probably don't have a pen that writes in bold print, underline your vectors, i.e. write v, or put a tilde underneath your vectors. Occasionally in Physics, you may see vectors written with an arrow pointing right.
Notice that vectors need not have two components. We can have 2 or 3 or n or an infinite number of components.
We write the set of all vectors with 2 real number components as R$^2$; likewise for 3, n, or infinite number of components. For components with complex numbers, we write C. Polynomials are "vectors" too - we'll look at notation for the set of polynomials later. For a reason why we do this, see Set theory for an explanation.

## Stretching and shrinking

We can define some actions on vectors. What will happen if we extend the vector? Or what will happen if we shrink the vector? The vector's direction doesn't change, only its length -- its magnitude. The action we perform to stretch or shrink a vector is that we multiply its magnitude by some amount. We refer to doing this as scalar multiplication: we multiply the vector by a scalar real number.

### Scalar multiplication

For scalar multiplication, we simply multiply each component by the scalar. We commonly use Greek letters for scalars, and English letters for vectors.
So for a scalar value of λ and a vector v defined by r and θ, the new vector is now λr and θ. Notice how the direction does not change.

#### Example

Say we have ${\begin{pmatrix}2\\3\end{pmatrix}}$ and we wish to double the magnitude. So, $2{\begin{pmatrix}2\\3\end{pmatrix}}={\begin{pmatrix}4\\6\end{pmatrix}}$.

## Addition of vectors

Simply, to add two vectors, you must add the respective x-components together to obtain the new x-component, and likewise add the two y-components together to obtain the new y-component.

### Example

Say we have $\mathbf {v_{1}} ={\begin{pmatrix}2\\3\end{pmatrix}},\mathbf {v_{2}} ={\begin{pmatrix}4\\6\end{pmatrix}}$ and we wish to add these. So, $\mathbf {v_{1}} +\mathbf {v_{2}} ={\begin{pmatrix}6\\9\end{pmatrix}}$.

## Subtraction of vectors

The operation of subtraction on two vectors, a and b, a-b, can also be written as a+(-1)b. Therefore, we can use scalar multiplication to find the value of (-1)b, then use vector addition to find our solution.

## Complex numbers as vectors

^ Complex numbers can be represented in the form $r(cos(\theta )+isin(\theta ))$ or equivalently $re^{i\theta }$ , or in other words, a vector with magnitude $r$ and direction $\theta$. On the complex plane, this vector has a real x-component and an imaginary y-component. See Complex numbers for more information.

## Lines and planes

We can form the equations of lines and planes using vectors. Let's see how we can do this.

### Vector equation of the line

Consider a vector $\mathbf {v} ={\begin{pmatrix}1\\2\end{pmatrix}}$. Let's consider the following:
    $2\mathbf {v} ={\begin{pmatrix}2\\4\end{pmatrix}}$
    $-\mathbf {v} ={\begin{pmatrix}-1\\-2\end{pmatrix}}$
    $3\mathbf {v} ={\begin{pmatrix}3\\6\end{pmatrix}}$
If we have the equation λv, it is clear that for each choice of λ we choose, we get a different point on the line y=2x.
We can now generalize this idea into the vector equation of the line (and it is not restricted to 2 dimensions either).
The vector equation of a line is given by
    x=λv (for a scalar λ)
where v is a vector parallel (which then, could lie) on the line. λ then, is the unknown in the equation. x is then the dependent vector variable.

### Vector equation of the plane

Now consider a plane. If we have two nonparallel vectors lying on the plane and we add them, we can add a linear combination (that is, add the two vectors, which are multiplied only by scalars) to choose some other vector. The set of all vectors under linear combinations of these two vectors form a plane.
More simply, if we have two nonparallel vectors a and b we can form any other vector parallel to a and b by:
    λ$_1$a+λ$_2$b=x
where λ$_1$ and λ$_2$ are both scalars.

## Further algebra and geometry of vectors

There are other operations on vectors which we can perform. These operations we will consider have very real and significant geometric meanings.

### Magnitude

The magnitude of a vector is its length in R$^+$

### The dot product

The dot product of two vectors is defined as the sum of the products of the components. Symbolically we write
    ${\begin{pmatrix}a_{1}\\a_{2}\\\vdots \\a_{n}\end{pmatrix}}\cdot {\begin{pmatrix}b_{1}\\b_{2}\\\vdots \\b_{n}\end{pmatrix}}=a_{1}b_{1}+a_{2}b_{2}+\ldots +a_{n}b_{n}$
For example,
    ${\begin{pmatrix}3\\5\end{pmatrix}}\cdot {\begin{pmatrix}1\\-2\end{pmatrix}}=3-10=-7$

#### Properties of the dot product

If we have a and b as vectors,
    a · b = b · a
    c(a · b) = ca·b = a·cb
where c is a scalar.

#### Geometry of the dot product

The dot product of two vectors has an alternate form:
    $\mathbf {a} \cdot \mathbf {b} =|\mathbf {a} ||\mathbf {b} |\cos {\theta }$
If we pick a vector c=a-b to form a triangle, we can show that these two forms are indeed equivalent by trigonometry.
The angle θ then is important, as it shows that the dot product of two vectors is related to the angle between them. More specifically, we can calculate the dot product of two vectors - if the dot product is zero we can then say that the two vectors are perpendicular.
For example, consider simply
    ${\begin{pmatrix}1\\1\end{pmatrix}}\cdot {\begin{pmatrix}1\\-1\end{pmatrix}}=1-1=0$
Plot these vectors on the plane and verify for yourself that these vectors are perpendicular.

### Cross product

The cross product is a more complicated product to define, but has a nice geometric property. We will only look at the cross product in three dimensions, since it is the most commonly used in three dimensions and it is difficult to define in greater dimensions.
For a vector with three components, the cross product is defined as
    ${\begin{pmatrix}a_{1}\\a_{2}\\a_{3}\end{pmatrix}}\times {\begin{pmatrix}b_{1}\\b_{2}\\b_{3}\end{pmatrix}}={\begin{vmatrix}\mathbf {i} &\mathbf {j} &\mathbf {k} \\a_{1}&a_{2}&a_{3}\\b_{1}&b_{2}&b_{3}\\\end{vmatrix}}$
where
    $\mathbf {i} ={\begin{pmatrix}1\\0\\0\end{pmatrix}},\mathbf {j} ={\begin{pmatrix}0\\1\\0\end{pmatrix}},\mathbf {k} ={\begin{pmatrix}0\\0\\1\end{pmatrix}}$
If you have not done Matricies before, here is a formula to work out from above...
= i $(a_{2}b_{3}-a_{3}b_{2})$ - j$(a_{1}b_{3}-a_{3}b_{1})$+ k $(a_{1}b_{2}-a_{2}b_{1})$

#### Properties of the cross product

The cross product has some properties
    a×b = -b×a
which is easily verified from the above definition, and
    c×(a+b) = c×a+c×b

#### Geometric properties of the cross product

The cross product has some interesting geometric properties.
If a and b are two vectors, a×b is the vector perpendicular to both. Now if we have two vectors, we have two choices of vector perpendicular to a and b - if we switch the order of the cross product we obtain the other vector.
The magnitude of the cross product of two vectors is the area of the parallelogram formed by these two vectors.
The scalar triple product, a·(b×c) is the volume of the paralleliped formed by these three vectors.

## See also

* Vectors at Wikipedia