ZestCalc

Dot Product and Angle Calculator

Find the dot product, lengths, unit vectors, and the angle between two vectors, with exact roots like √14. Drag them and watch the sign change at 90°.

Vectors

Enter two vectors with the same number of entries, or start from an example.

Entries2
u=u =
v=v =

Result

Updates as you type.

u⋅v=5u \cdot v = 5
Lengths
∣u∣=10,∣v∣=5|u| = \sqrt{10},\quad |v| = \sqrt{5}
Cosine of the angle
cos⁡θ=22\cos\theta = \frac{\sqrt{2}}{2}
Angle
θ=45∘=π4\theta = 45^\circ = \frac{\pi}{4}
Unit vectors
u^=(31010, 1010)\hat{u} = \left(\frac{3\sqrt{10}}{10},\ \frac{\sqrt{10}}{10}\right)
v^=(55, 255)\hat{v} = \left(\frac{\sqrt{5}}{5},\ \frac{2\sqrt{5}}{5}\right)

The angle is less than 90°, so the dot product is positive.

What the dot product measures

The dot product of two vectors multiplies matching entries and adds the results:

u⋅v=u1v1+u2v2+⋯+unvnu \cdot v = u_1 v_1 + u_2 v_2 + \cdots + u_n v_n

It also has a geometric meaning, which connects it to the angle θ\theta between the vectors:

u⋅v=∣u∣ ∣v∣cos⁡θu \cdot v = |u|\,|v| \cos\theta

So its sign tells you the direction. It's positive when the vectors point broadly the same way, zero when they're perpendicular, and negative when they point apart. Each entry of a matrix product is one of these dot products, a row with a column, as the Matrix Multiplication Calculator shows.

Lengths, unit vectors, and angles

A vector's dot product with itself is its squared length, so:

∣u∣=u⋅u|u| = \sqrt{u \cdot u}

Dividing a vector by its length gives the unit vector, u^=u/∣u∣\hat{u} = u / |u|, with the same direction and length 1. Dividing the dot product by both lengths gives the cosine of the angle:

cos⁡θ=u⋅v∣u∣ ∣v∣\cos\theta = \frac{u \cdot v}{|u|\,|v|}

This calculator keeps roots exact, so you see 14\sqrt{14} rather than a rounded decimal, and it recognizes angles such as 45∘45^\circ and 120∘120^\circ exactly. Any other angle shows as an approximation, marked with ≈\approx. A zero vector has no direction, so it has no angle or unit vector.

Where it comes up

  • Testing for perpendicular. Two vectors are orthogonal exactly when their dot product is 0. That's quicker and more reliable than measuring an angle.
  • Projections. The dot product measures how much of one vector lies along another.
  • Work in physics. Force dotted with displacement gives the work done, so only the part of the force along the motion counts.
  • Similarity. Cosine similarity compares the directions of two lists of numbers while ignoring their sizes, which is common in search and machine learning.

The Linear Transformation Visualizer shows the same idea in reverse: a rotation keeps every dot product, so it keeps all lengths and angles.