3D Dot Product
Computes the dot product of two vectors in R3 from their components in a single line.
—
Dot product u · v in 3D
The dot product of u = (u₁, u₂, u₃) and v = (v₁, v₂, v₃) is the scalar u · v = u₁v₁ + u₂v₂ + u₃v₃ = |u|·|v|·cos θ, with θ being the angle between them. The vectors are perpendicular exactly when u · v = 0, and parallel when u · v = ±|u||v|. Take (1, 2, 3) · (4, -5, 6) = 4 - 10 + 18 = 12 as a quick check. It's commutative and distributive, and it hands you the cosine similarity cos θ = (u · v) / (|u|·|v|) that turns up all over ML.
Applications
It shows up as the work a force does in physics, W = F · d, in the scalar projection of one vector onto another, and in cosine similarity for ML embeddings such as NLP word vectors, recommender systems and image retrieval. You'll also meet it in orthogonal Gram-Schmidt decomposition, ray-plane intersection tests, and any time you need the angle between two directions in 3D geometry or robotics.
FAQ
Why is u · v a scalar? It measures how much of u lines up with v, which is a single magnitude with no direction attached. The geometric form |u|·|v|·cos θ spells that out.
What if u · v is negative? Then θ is obtuse, greater than 90°, and the projections point in opposite directions.
What is the difference between dot product and cross product? The dot product gives back a scalar, a projection, and works in any number of dimensions. The cross product gives back a vector that's perpendicular to both, and it only exists in 3D.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.