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 \(\| \vec{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 {#dot-product-properties}#
We will use the results from some algebra of summation.
Commutative#
because \(v_i w_i = w_i v_i\).
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 \(\| \vec{v} \|\):
Let \(g \triangleq frac{1}{\| \vec{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 \(\| \vec{v} \|, \| \vec{w} \|, \| \vec{v} - \vec{w} \|\). When \(\vec{v}\) and \(\vec{w}\) are perpendicular, this is a right-angled triangle with hypotenuse length $| \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 \(\| \vec{v} \|^2 + \| \vec{w} \|^2 \ne \| \vec{v} - \vec{w} \|^2\) then vectors \(`vec{v}\) and \(\vec{w}\) do not form a right angle and are not perpendicular.