formula for the dot product of two vectors
Dot product Algebraically, the dot product is the sum of the products of the corresponding entries of the two sequences of numbers. Geometrically, it is the product of the Euclidean magnitudes of the two vectors and the cosine of the angle between them. These definitions are equivalent when using Cartesian coordinates. In modern geometry, Euclidean spaces are often defined by using vector spaces. In this case, the dot product is used for defining lengths (the length of a vector is the square root of the dot product of the vector by itself) and angles (the cosine of the angle of two vectors is the quotient of their dot product by the product of their lengths).
Unit vector The unit vectors appropriate to spherical symmetry are:    r ^   {\displaystyle \mathbf {\hat {r}} } , the direction in which the radial distance from the origin increases;    φ ^   {\displaystyle {\boldsymbol {\hat {\varphi }}}} , the direction in which the angle in the x-y plane counterclockwise from the positive x-axis is increasing; and    θ ^   {\displaystyle {\boldsymbol {\hat {\theta }}}} , the direction in which the angle from the positive z axis is increasing. To minimize redundancy of representations, the polar angle   θ  {\displaystyle \theta }  is usually taken to lie between zero and 180 degrees. It is especially important to note the context of any ordered triplet written in spherical coordinates, as the roles of    φ ^   {\displaystyle {\boldsymbol {\hat {\varphi }}}}  and    θ ^   {\displaystyle {\boldsymbol {\hat {\theta }}}}  are often reversed. Here, the American "physics" convention[1] is used. This leaves the azimuthal angle   φ  {\displaystyle \varphi }  defined the same as in cylindrical coordinates. The Cartesian relations are: