# Vectors¶

## Scalars and vectors¶

Scalars are entities with only a magnitude. Vectors are entities with both a magnitude and direction.

## Base vectors¶

A vector is defined in terms of its components. Each component defines the vector in relation to one of the base vectors. In a geometric sense, each base vector represents one of the co-ordinate axes. In Cartesian co-ordinates the $x$, $y$ and $z$ axes are represented by the base vectors $\mathbf{\hat{i}}$, $\mathbf{\hat{j}}$ and $\mathbf{\hat{k}}$, which are just unit vectors (of magnitude 1) and are all orthogonal to each other (at an angle of 90 degrees to each other) just like the axes. Together, these vectors are sometimes known as the standard basis.

Other co-ordinate systems (polar) have different base vectors. Base vectors don't have to be geometrical (representing co-ordinates within a plane) – they can also represent other variables.

## Row and column vectors¶

Vectors can also be denoted as matrices with dimensionality $1$ x $n$ or $m$ x $1$. In the first case (as a matrix with one row and $n$ columns) the vector is known as a row vector. In the second case (as a matrix with m rows and 1 column) the vector is known as a column vector.

### Notation for row and column vectors¶

$$\begin{bmatrix} 12 \ 82 \ 40 \end{bmatrix}$$ (A column vector, which should be vertical)

$$\begin{bmatrix} 9 & 11 & 4 \end{bmatrix}$$ (A row vector)

## Norms¶

A norm measures the size of a vector. The $L_p$ norm of a vector $\mathbf{x}$ is defined as

\sum_{i=0}^n {(x^p)}^{(1/p)}

## Scalar-vector multiplication¶

To multiply a scalar by a vector each of the components are in turn (or in parallel) multiplied by the scalar in question.

\begin{bmatrix} 9 \\ 6 \\ 12 \end{bmatrix} \cdot 12 = \begin{bmatrix} 9\cdot12 \\ 6\cdot12 \\ 12\cdot12 \end{bmatrix} = \begin{bmatrix} 108 \\ 72 \\ 144 \end{bmatrix}

## Vector products¶

There are different vector products.

### Dot product¶

The dot product of two vectors $\mathbf{a}$ and $\mathbf{b}$ is $\lVert \lVert \mathbf{a} \rVert\rVert \lVert\lVert \mathbf{b} \rVert\rVert \cos \theta$ where theta is the angle between the two vectors.

The dot product between two row/column matrices $\mathbf{x}$ and $\mathbf{y}$ is given by $\mathbf{x^Ty}$ where $\mathbf{x^T}$ is the transpose of $\mathbf{x}$ (in this case if $\mathbf{x}$ is a row vector, the transpose of $\mathbf{x}$ is a column vector, likewise if $\mathbf{x}$ is a column vector it's transpose is a row vector).

The dot product can also be computed as $x_i y_i$ (using the summation convention in which any expression is considered to be summed over if it appears once and only once). This can also be written using summation notation.

\mathbf{x}\cdot\mathbf{y} = \sum_{i=0}^n \mathbf{x}_i y_i

Where $n$ is the number of elements in the two vectors.

### Cross product¶

The dot product of two vectors $\mathbf{a}$ and $\mathbf{b}$ is $\lVert \mathbf{a} \rVert\lVert \mathbf{b} \rVert \sin \theta$ where theta is the angle between the two vectors.

## Properties of vectors¶

Two vectors are parallel if one is a multiple of the other.