Vector Dot Product Visualizer, a mathematical toy

This was developed as an aid to understanding the dot product function used in Fractal Kitty's There is(Ǝ) – Such that (∋) project.

The dot product is the length of vector A projected on vector B (you can imagine this as the length of the shadow that A would cast on B, if a flashlight were shining perpendicularly at B), times the length of vector B. If the two vectors point in directions 90° apart, the dot product is 0 since neither has a component in the other's direction. If they point in the same exact direction, it is just the full length of A times the full length of B.

Mathematically, the dot product of vectors A and B defined as |A| * |B| * Cos θ, where |A| and |B| are the lengths of vectors A and B, and θ is the angle between them.

Dot Product Visualizer

A B projection A·B dot product value 0
Vector A Vector B signed projection ("shadow") of A onto B angle between vectors actual dot product value
Because the dot product is a scalar (just a number, without any direction like a vector) the dot product of A·B is always equal to the dot product of B·A. To prove it, you can hit this button to swap A and B:

Dot product definition:

A · B =
|B| * |signed projection of A onto B|
or
|A| * |signed projection of B onto A|
(|A| means "the length of vector A")

Both definitions are always equal for ordinary Euclidean vectors, because the length of the signed projection of A onto B calculated by:

|A| * cos(θ)

where θ is the angle between vectors A & B.

So,

A · B = |B| * |signed projection of A onto B| = |B| * |A| * cos(θ)

and

B · A = |A| * |signed projection of B onto A| = |A| * |B| * cos(θ)

...which is the same thing. You can click the "Swap A and B" button above to see how this works in practice.

Controls

Vector A
Vector B
Angle between A and B
Length of signed projection of A onto B
Length of B
A · B
B · A
Meaning
Tip: set A angle to 0° and B angle to 180°. The vectors point in exactly opposite directions, so the dot product is negative.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply