You already know how to add vectors and multiply them by numbers in . However, we haven't discussed yet whether it is possible to multiply vectors by other vectors in . Here you're going to learn one of the ways to construct such a new algebraic operation. It is going to provide you with new advanced geometric tools and shed new light on the concepts of angle and orthogonality. Some may argue that this sounds overly abstract and disconnected from real-life applications, but you will see that the opposite is true.
Motivation
Let’s look at a plane, which is a classic representation of a two-dimensional vector space . A basis of is typically chosen in such a way that and are perpendicular to each other, and the length of each of them is 1 (see the picture below). Here, a vector is identified with .
Now let’s look at another pair of perpendicular vectors and . We will perform a non-obvious procedure, namely, multiply the first coordinates of both vectors and add them with the product of the second coordinates, like this: . Notice that the sum is zero. If you repeat it with another pair of perpendicular vectors, for example and , you again obtain . On the contrary, if you take non-perpendicular vectors and , you will get . Seems like we stumbled upon a criterion of perpendicularity of vectors! But how are these weird calculations related to the mutual arrangement of vectors? Let’s figure it out!
Definition and properties
Let's start with the formal definition. Define a dot product of two arbitrary columns (vectors) and from as Thereby, given a pair of columns, the dot product returns a real number (scalar), which is the sum of their pairwise multiplied coordinates. This is why it is sometimes referred to as a scalar product. Despite not producing an element of the same nature as the elements in the input, there are a lot of similarities with the multiplication of numbers. For example, the dot product is
- Commutative: (This is obvious since .)
- Distributive (As ).
However, there are, of course, some differences. For example, the notion of associative property doesn't apply to the dot product. The expression is not a dot product of three vectors, it is a product of a scalar and a vector , which is a completely different operation.
The key idea of a vector space is that vectors interact with vectors through addition and with scalars by multiplication. The bilinear property describes the most general way of combining the dot product with these basic operations
In particular, (here Greek letters denote scalars). The bilinear property follows directly from the definition of the dot product.
Bilinearity is called this way because both multiples of the dot product behave linearly with respect to addition and multiplication by numbers. It makes calculations with vectors almost identical to analogous with numbers. Moreover, sometimes it allows proceeding calculations without any information about columns themselves. For example, if and , then
Geometric interpretation (plane)
We described a lot of algebraic properties of the dot product, showing that one can multiply vectors very similar to numbers or standard expressions with variables. When we motivated the introduction of the dot product at the beginning of this topic, we concentrated on its geometric meaning. Let’s find the connection of dot product with geometry. This match of algebraic and geometric properties will allow us to combine these two dominant areas of mathematics, giving us the ability to translate geometric concepts to the algebraic language and back around.
First, let's go back to the plane example.
Consider two arbitrary vectors and (see the picture). First of all, note that according to the Pythagorean theorem, the lengths of and (as a matter of fact of any vector on a plane), can be calculated using the dot product:Now, let be an angle between and . Thus if is an angle between and and an angle between and , then . By definition Aswe obtainBy definition , which implies
This is the most important junction between different points of view on the dot product. Here you saw that the plain calculation of the sum of pairwise products of coordinates of vectors gives the same result as calculating the product of vector lengths together with the cosine of the angle between them. From here we obtain our initial claim.
That follows from the fact that the cosine of a right angle is zero.
Multidimensional generalization
The idea of the dot product being connected with lengths of vectors and angles between them can be used to generalize the case. For example, in it gives the well-known formulas for Pythagorean theorem generalization. In fact, in the general case, this dot product intuition is the simplest way to define length and angles in for any natural . For vectors and we define
- the length of as
- the cosine of the angle between and as
- There is an ambiguity when it comes to calculating the angle itself, as the angle could be defined by cosine up the sight and some number of rotations, however, usually, the angle is defined just as
- to resolve this issue.
We say that vectors and are orthogonal (or perpendicular) if .
This way to define lengths and angles is very universal. Let us look at an example. is a five-dimensional vector space. Unfortunately, our perception is settled in such a way that we can’t imagine it, however now you can calculate an angle between any two five-dimensional vectors, without having an actual picture. The length of vector is
The length of is
The angle between and is
Note, that to find this purely geometric characteristic of vectors disposition not only didn’t we draw any pictures, we just did some simple algebraic calculations.
Lastly, multidimensionality works in another direction also. If we take for dot product is just usual multiplication!
A few words on applications
Here you have the right to say that, of course, it’s wonderful that you can count some geometric things in a high-dimensional space, but isn’t it just a fantasy applicable only to the fiction of Nolan films or reflections at your leisure. And of course, one can use our developments for these purposes. However, dot product has many more mundane applications. It’s used ubiquitously in science, especially in modern physics, not only because according to some theories spacetime is 26- or 10-dimensional, but because usually physicists do not work with the physical space itself, but with the so-called phase space of equations arising in a problem, which can have any dimension, but in which it is vital to be able to do geometric calculations. It is also indispensable in game development to describe rotations, movements, and light intensities.
In machine learning and data analysis, as you can guess data is usually described using lists and arrays, thus equipping it naturally with a structure of vector space. The whole idea of data analysis is to describe geometric patterns in these spaces to make predictions and classify data, without being able to find lengths and directions of vectors it would be impossible, that is why you will be inevitably calculating dot products.
The philosophy that it is useful to take out from here is that the operation we have constructed, and its generalizations, allow us to endow some not necessarily geometric objects with a geometric structure and calculate distances and angles for them with the same immediacy with which we did it in a checkered notebook in the elementary school.
Conclusion
- The dot product is an operation that matches a real number to any pair of vectors of .
- The dot product of and is defined as
- Dot product allows one to define the lengths of vectors and angles between them in a vector space. Namely and is a value of an angle between and .
- For any two vectors and , such that the angle between them is
- Two vectors and , such that , are called orthogonal or perpendicular.