If the graph is unreadable, or if you want to see different vectors visualized,
just refresh this page for a different one.

The dot product of a two vectors A and B is represented as follows:
|A||B|cos(c)

where:
- |A| is the length of vector A
- |B| is the length of vector B
- c is the angle between vector A and B.

As it is a little difficult to find the angle c in a given situation,
we're going to rewrite this formula into something easier.

Suppose we have vector A as [a1, a2] and vector B as [b1. b2].
These vectors can also be written as follows:
A = a1*i + a2*j
B = b1*i + b2*j
Where the vector i is defined as [1, 0] and the vector j as [0,1]

What we now can do is the following: multiply these two equations with each other:
A * B = (a1*i + a2*j) * (b1*i + b2*j) =
a1*b1*i*j + a1*b2*i*j + a2*b1*i*j + a2*b2*i*j

The nice thing about this equation is that i*i = 0 (after all, cos(0) = 0).
Also, since both the length of i and j and the cosinus of their angle (90 degrees) are equal to 1,
this means that i*j = 1
Because of that, the simple equation of the dot product is:

    A * B = a1 * b1 + a2 * b2

In the above application you can practice this. Just fill in the right spots at the equation.


Go back to the page index