\(\newcommand{L}[1]{\| #1 \|}\newcommand{VL}[1]{\L{ \vec{#1} }}\newcommand{R}[1]{\operatorname{Re}\,(#1)}\newcommand{I}[1]{\operatorname{Im}\, (#1)}\)

# Vectors and dot products¶

A vector is an ordered sequence of values:

## Videos¶

See these Khan academy videos for nice introductions to vector dot products:

## Vector scaling¶

A vector can be *scaled* by a scalar \(c\):

## Vector addition¶

Say we have two vectors containing \(n\) values:

Vector *addition* gives a new vector with \(n\) values:

Vector addition is commutative because \(v_i + w_i = w_i + v_i\):

## Vector dot product¶

The vector *dot product* is:

## Vector length¶

We write the *length* of a vector \(\vec{v}\) as \(\VL{v}\):

This is a generalization of Pythagoras’ theorem to \(n\) dimensions. For example, the length of a two dimensional vector \([ x, y ]\) is the length of the hypotenuse of the right-angle triangle formed by the points \((x, 0), (0, y), (x, y)\). This length is \(\sqrt{x^2 + y^2}\). For a point in three dimensions \({x, y, z}\), consider the right-angle triangle formed by \((x, y, 0), (0, 0, z), (x, y, z)\). The hypotenuse is length \(\sqrt{\L{ [ x, y ] }^2 + z^2} = \sqrt{ x^2 + y^2 + z^2 }\).

From the definition of vector length and the dot product, the square root of the dot product of the vector with itself gives the vector length:

## Properties of dot products¶

We will use the results from Some algebra with summation.

### Distributive over vector addition¶

because:

### Scalar multiplication¶

Say we have two scalars, \(c\) and \(d\):

because:

From the properties of distribution over addition and scalar multiplication:

## Unit vector¶

A unit vector is any vector with length 1.

To make a corresponding unit vector from any vector \(\vec{v}\), divide by \(\VL{v}\):

Let \(g \triangleq \frac{1}{\VL{v}}\). Then:

## If two vectors are perpendicular, their dot product is 0¶

I based this proof on that in Gilbert Strang’s “Introduction to Linear Algebra” 4th edition, page 14.

Consider the triangle formed by the two vectors \(\vec{v}\) and \(\vec{w}\). The lengths of the sides of the triangle are \(\VL{v}, \VL{w}, \L{\vec{v} - \vec{w}}\). When \(\vec{v}\) and \(\vec{w}\) are perpendicular, this is a right-angled triangle with hypotenuse length \(\L{\vec{v} - \vec{w}}\). In this situation, by Pythagoras:

Write the left hand side as:

Write the right hand side as:

The \(v_i^2\) and \(w_i^2\) terms on left and right cancel, so:

By the converse of Pythagoras’ theorem, if \(\VL{v}^2 + \VL{w}^2 \ne \L{\vec{v} - \vec{w}}^2\) then vectors \(\vec{v}\) and \(\vec{w}\) do not form a right angle and are not perpendicular.