# Vector algebra

In mathematics and linear algebra, **vector algebra** refers to algebraic operations in vector spaces. Most commonly, it refers to operations on Euclidean vectors.

## General vector spaces

### Addition and subtraction

Assume now that **a** and **b** are not necessarily equal vectors, but that they may have different magnitudes and directions. The sum of **a** and **b** is

The addition may be represented graphically by placing the tail of the arrow **b** at the head of the arrow **a**, and then drawing an arrow from the tail of **a** to the head of **b**. The new arrow drawn represents the vector **a** + **b**, as illustrated below:

This addition method is sometimes called the *parallelogram rule* because **a** and **b** form the sides of a parallelogram and **a** + **b** is one of the diagonals. If **a** and **b** are bound vectors that have the same base point, this point will also be the base point of **a** + **b**. One can check geometrically that **a** + **b** = **b** + **a** and (**a** + **b**) + **c** = **a** + (**b** + **c**).

The difference of **a** and **b** is

Subtraction of two vectors can be geometrically defined as follows: to subtract **b** from **a**, place the tails of **a** and **b** at the same point, and then draw an arrow from the head of **b** to the head of **a**. This new arrow represents the vector **a** − **b**, as illustrated below:

Subtraction of two vectors may also be performed by adding the opposite of the second vector to the first vector, that is, **a** − **b** = **a** + (−**b**).

### Scalar multiplication

A vector may also be multiplied, or re-*scaled*, by a real number *r*. In the context of conventional vector algebra, these real numbers are often called **scalars** (from *scale*) to distinguish them from vectors. The operation of multiplying a vector by a scalar is called *scalar multiplication*. The resulting vector is

Intuitively, multiplying by a scalar *r* stretches a vector out by a factor of *r*. Geometrically, this can be visualized (at least in the case when *r* is an integer) as placing *r* copies of the vector in a line where the endpoint of one vector is the initial point of the next vector.

If *r* is negative, then the vector changes direction: it flips around by an angle of 180°. Two examples (*r* = −1 and *r* = 2) are given below:

Scalar multiplication is distributive over vector addition in the following sense: *r*(**a** + **b**) = *r***a** + *r***b** for all vectors **a** and **b** and all scalars *r*. One can also show that **a** − **b** = **a** + (−1)**b**.

### Dot product

The *dot product* of two vectors **a** and **b** (sometimes called the *inner product*, or, since its result is a scalar, the *scalar product*) is denoted by **a** ∙ **b** and is defined as:

where *θ* is the measure of the angle between **a** and **b** (see trigonometric function for an explanation of cosine). Geometrically, this means that **a** and **b** are drawn with a common start point and then the length of **a** is multiplied with the length of that component of **b** that points in the same direction as **a**.

The dot product can also be defined as the sum of the products of the components of each vector as

## Three dimensional space

### Cross product

The *cross product* (also called the *vector product* or *outer product*) is only meaningful in three or seven dimensions. The cross product differs from the dot product primarily in that the result of the cross product of two vectors is a vector. The cross product, denoted **a** × **b**, is a vector perpendicular to both **a** and **b** and is defined as

where *θ* is the measure of the angle between **a** and **b**, and **n** is a unit vector perpendicular to both **a** and **b** which completes a right-handed system. The right-handedness constraint is necessary because there exist *two* unit vectors that are perpendicular to both **a** and **b**, namely, **n** and (–**n**).

The cross product **a** × **b** is defined so that **a**, **b**, and **a** × **b** also becomes a right-handed system (but note that **a** and **b** are not necessarily orthogonal). This is the right-hand rule.

The length of **a** × **b** can be interpreted as the area of the parallelogram having **a** and **b** as sides.

The cross product can be written as

For arbitrary choices of spatial orientation (that is, allowing for left-handed as well as right-handed coordinate systems) the cross product of two vectors is a pseudovector instead of a vector.

### Scalar triple product

The *scalar triple product* (also called the *box product* or *mixed triple product*) is not really a new operator, but a way of applying the other two multiplication operators to three vectors. The scalar triple product is sometimes denoted by (**a** **b** **c**) and defined as:

It has three primary uses. First, the absolute value of the box product is the volume of the parallelepiped which has edges that are defined by the three vectors. Second, the scalar triple product is zero if and only if the three vectors are linearly dependent, which can be easily proved by considering that in order for the three vectors to not make a volume, they must all lie in the same plane. Third, the box product is positive if and only if the three vectors **a**, **b** and **c** are right-handed.

In components (*with respect to a right-handed orthonormal basis*), if the three vectors are thought of as rows (or columns, but in the same order), the scalar triple product is simply the determinant of the 3-by-3 matrix having the three vectors as rows

The scalar triple product is linear in all three entries and anti-symmetric in the following sense:

### Other dimensions

The cross product does not readily generalise to other dimensions, though the closely related exterior product does, whose result is a bivector. In two dimensions this is simply a pseudoscalar

A seven-dimensional cross product is similar to the cross product in that its result is a vector orthogonal to the two arguments; there is however no natural way of selecting one of the possible such products.