Dot product

The dot product, also known as the scalar product or inner product, is an operation that takes two vectors and produces a scalar. Geometrically, we define the dot product of `vec u` and `vec v` with

`vec u * vec v = |vec u||vec v|cos theta`,

where `theta` is the angle between the vectors in standard position. The dot product has a few useful properties that arise from the cosine term:

If Then Therefore
`vec u * vec v > 0` `0º < theta < 90º` acute
`vec u * vec v < 0` `90º < theta < 180º` obtuse
`vec u * vec v = 0` `theta = 90º` perpendicular

Algebraically, we define the dot product in `RR^3` with

`[u_1,u_2,u_3] * [v_1,v_2,v_3] = u_1v_1 + u_2v_2 + u_3v_3`.

Essentially, we get the product of the first components, of the second components, etc., and then take the sum of the products. It works in the same way with `RR^2` and any other Euclidean space.

The dot product has a few properties that are worth committing to memory. First, the dot product of a vector with itself is equivalent to the square of its magnitude:

`vec a * vec a = |vec a|^2`.

The dot product is commutative—order doesn’t matter:

`vec a * vec b = vec b * vec a`.

It is distributive over addition:

`vec a * (vec b + vec c) = vec a * vec b + vec a * vec c`.

It is associative over scalar multiplication:

`kvec a * vec b = k(vec a * vec b) = vec a * kvec b`.

Finally, any dot product with the zero vector produces the scalar zero:

`vec a * vec 0 = 0`.