# The Dot Product: Applications to Artificial Intelligence

By: Sahil Gandhi

We’ll be covering information about the dot product in this article. Do note that this will largely cover the 2D considerations of the dot product, but it is definitely applicable to 3D systems as well, with the necessary modifications.

A vector can be described as a quantity containing both a magnitude and direction and is represented by an arrow. Prior to taking a look at how the dot product can be applied to artificial intelligence, it must be defined: the dot product can be interpreted as a scalar quantity describing how much one vector reinforces another one. This means that it is a value consisting only of a magnitude, essentially lowering the amount of information we have from two vectors into one piece of information with specific functions.

The dot product is calculated by multiplying the x values of your two vectors and adding that to the product of the y values of the vectors. For example, the dot product of vector a (2,3) and vector b (6, -1) is 9.

Immediately, one can find out that in acute relationships between vectors, the dot product is positive; when the vectors form a right angle, it results in a value of zero and when obtuse, the dot product is negative. Why is this information important? This information is useful for technological purposes. For example, this could tell a self-driving car if it needs to turn in a certain direction to arrive at a destination, using both the vector for the direction the car is facing and the vector for the direction the destination is in relative to the car.

Using some trigonometry, one can derive a new, more useful formula from the original one (a.x * b.x + a.y * b.y), which equates the dot product of vectors a and b to the product of the magnitudes of a and b multiplied by the cosine of the angle in between them. This allows, with some rearrangement, one to calculate the angle between the vectors - now we know how much the car would have to turn.

Recall that this is a scalar quantity: it has no direction, only a magnitude. This actually means that unfortunately, the car does not know whether to turn left or right- there is a separate value called the cross product that allows one to calculate this.

**Citations:**

__https://www.mathsisfun.com/algebra/vectors-dot-product.html__

**Image:**

Geometry Mathematics Volume - Free image on Pixabay

__What Did You Learn?__

__What Did You Learn?__

Questions:

1. Using a calculator, try to find the dot product of vector a (1,1.86) and vector b (-2.96, 4.7). Are these vectors obtuse to each other? How can you tell?

You should have gotten the value of -2.96 + 8.742 = 5.782. No, the angle is acute; you can tell by noticing that the dot product value is positive.

2. Why might that new equation be derivable through trigonometry?

To learn about this, I would recommend looking through these resources:

__https://www.softschools.com/math/trigonometry/sum_and_difference_of_angles_identities/__