## Cross Product and Dot Product

Our previous article discussing nuances of vector calculus presented features of the dot product and cross product. These vector computations, though not too complex, are nevertheless fundamental to performing higher level methods. This article provides proofs for these functions to foment comprehension of their governing dynamics. Furthermore, we analyze several examples piece by piece in an effort to make the implementation of these techniques clear.

## Proofs

*Dot Product Proof: *

As the previous vector calculus article explicates, the dot product is a vector technique that returns a real value when multiplying vectors in the following fashion:

Also as previously discussed, the dot product is particularly useful for identifying the angle between two vectors by the function:

With the sheer importance of this function, which states that the dot product is equal to the product of the magnitudes of the vectors and the cosine of the angle between them, a proof of this function will be provided in conjunction with the image below:

Firstly, we invoke the Law of Cosines to establish a quantitative relationship between the vectors constituting this system:

Next, we substitute ‘AB’ with ‘a-b’, ‘OA’ with ‘a’ and ‘OB’ with ‘b’:

We may see here that the left side of the equation hosts the statement |a-b|^2. We next rearrange this side of the equation with some basic arithmetic:

If we substitute this output into the expanded equation, we get:

Finally, we arithmetically manipulate this function to yield:

This proof efficaciously demonstrates the validity of the relationship between the dot product and the product of vector magnitudes with the cosine of the angle between them.

An additionally helpful interpretation comes from isolating the angle on one side of the angle so it may be readily computed:

This helpful representation demonstrates how the angle between vectors can be computed by the quotient of the dot product of the vectors and the product of vector magnitudes. For another take on proving the dot product, consult this excellent walkthrough which can be found here.

*Cross Product Proof:*

We just witnessed the validation of the dot product, but what of the cross product? Again, as a refresher of previous statements made in the previous article, the cross product can also be used for the identification of the angle between two vectors. However, the cross product is particularly useful for identifying another vector orthogonal to both of the vectors in three dimensions. The unique aspect associated with this function is the fact that a vector product is returned rather than a real number. Recall that the standard function for computing the cross product is as follows:

We can demonstrate this as true with the use of matrices. Let us first examine a second order matrix and the computation of its determinants:

Simple enough, right? Well, when working with three-dimensional vectors, we kick it up a notch by breaking it up into three separate groups, then take the determinant of each of those groups:

These deployments of matrices and computation of their respective determinants arrives at how cross products are too function. But, what of computing the angle between vectors? And for that matter, what of discerning the orthogonal vector to both of them? Well, to do so simply requires taking the magnitude of the cross product:

Briefly, we may reorganize this function such that computation of the angle is much more accessible:

## Dot Product Computations

While it may be insightful to observe the laws which govern the operations we employ, a concept can only confidently when applied in action. So, this subsequent section will examine in thorough order the application of dot product computations.

*Computation of Dot Product From Vector Components*

Suppose we have vectors ‘a’ and ‘b’ and we desire to compute the dot product:

Let us first re-establish the function that permits computation, then substitute our variables:

*Computation of Angle Between Two Vectors With Dot Product*

Suppose we have two vectors ‘a’ and ‘b’ such that:

Now, how might we compute the angle between these vectors? First, let us call to action the function which associates the vector dot product with the angle:

We can rearrange this equation with the dot product function such that:

Furthermore:

Thus, our comprehensive function appears as:

*Discerning If Two Vectors Are Orthogonal*

Suppose we have two vectors ‘a’ and ‘b’ and we wish to determine if these are orthogonal:

Because the angle between vectors ‘a’ and ‘b’ is not equal to 90˚ degrees, we may infer that these vectors are not orthogonal.

## Cross Product Computation

As with our discussion of the dot product, it could be quite useful to work through some examples of computing the cross product to get a better understanding of the operations they support.

*Computation of Cross Product From Component Vectors*

Suppose we have two vectors ‘a’ and ‘b’ of the form:

Consider how we might compute the cross product of these vectors. First, let us call to action the function that makes this possible, and subsequently, substitute values:

*Discerning the Angle Between Two Vectors*

As with the dot product, the cross product can be implemented to discern the angle between two vectors. Let us do so with vectors ‘a’ and ‘b’:

Let’s first call to action the function which permits the computation of the angle:

## Future Endeavors

This article elucidated both the proofs associated with the cross and dot product of three dimensional vectors, and also explicated some comprehensive examples. If you’d like broader insight into vector calculus, check out this article which explains the various aspects of the subject in detail. Otherwise, future articles will discuss alternative subjects in this style including parametric equations with vector functions, vector differentiation and integration, and applying these methods for computing arc length and curvature. Hopefully this has proven to be a useful resource for you, and if it has, the other guides will prove to be useful utilities.

As a page focused on utilizing mathematics for programming, expect to see some articles later discussing the creation of a program that can code these functions to make this automated, and also how to use vector calculus in data driven programs. Before doing so, however, check out the guide for designing a web scraper that can acquire all the data you need to practice manipulation of data with vector functions.