Vector Dot Product - Algebraic Interpretation
In this article, we are going to learn about the dot product and we will only focus on the algebraic interpretation. I’ll explain the geometric interpretation after another one or two articles.
There are 4 ways to multiply 2 vectors:
Hadamard Product
The Dot Product
The Cross Product
Outer Product
Source Code → https://github.com/MrSheerluck/linear-algebra/tree/main/vectors/vector-dot-product
What is the Dot Product?
The Dot Product is a single number that provides information about the relationship between two vectors.
As the dot product is a single number, this is sometimes called as the scalar product.
Notations for the dot product
So, a dot product can be denoted in different notations:
First, you can denote it using lowercase Greek letters as its a single number (remember how we were denoting scalar values).
You can also represent a dot product with a “.” between two vectors.
You can also represent a dot product with angled brackets.
Now, this notation:
is the most common notation in linear algebra to represent a dot product. The “T” indicates an operation called “Transpose”. So, its the first vector transpose times the second vector.
For now, don’t worry too much about this “T” notation and the transpose operation as we will cover this later in our series. For now, you can just keep in mind that this above notation means a dot product of the two vectors.
Finally, you can see the algebraic definition of the Dot Product, its defined as “Element wise multiplication and then some over all the corresponding elements of the two vectors.”
Let me show you an example to make this algebraic definition more clear:
You can see, we have 2 vectors with same dimensionality and we are multiplying all the corresponding elements of the two vectors and then summing them up to get the final scalar value.
In dot product, the dimensionality of both the vectors should be exactly the same.
Let me explain why?
You can see as we don’t have same dimensionality or the number of elements on both the vectors, we can’t do the corresponding element multiplication for all elements of vector v.
In a later article, I’ll show you the geometric sense of this and then you’ll get even more clear understanding of dot product and this dimensionality issue. Till then please be patient.
Now, lets write some python code for our dot product operation.
Dot Product in Python
First, lets import all the libraries that we have been importing everytime:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
## many ways to compute the dot product
v1 = np.array([ 1, 2, 4, 5, 6 ])
v2 = np.array([ 0, -4, -3, 6, 5 ])
# using dot method provided by numpy
dp1 = np.dot( v1,v2 )
# manually multiplying corresponding elements using a for loop
dp2 = 0
for i in range(len(v1)):
# multiply corresponding element and sum
dp2 = dp2 + v1[i]*v2[i]
print(dp1,dp2)
The first way to calculate a dot product is by using Numpy’s built-in dot() function
The second way is to do it manually with a for loop. It goes through each index, multiplies v1[i] * v2[i], and adds to a running total.
I hope this dot product concept is clear to you and I promise I’ll explain the geometric interpretation once we understand some more concepts. In the next article, we will learn about the properties of dot product and that’ll be a bit long than this article. See you soon, Good Bye!

