Dot Product (Scalar Product)
The dot product is an algebraic operation that takes two equal-length sequences of numbers and returns a single scalar value representing the projection of one vector onto another.
This public page keeps the free explanation visible and leaves premium worked solving, advanced walkthroughs, and saved study tools inside the app.
Core idea
Overview
Geometrically, the dot product relates the magnitudes of two vectors and the cosine of the angle between them. Algebraically, it is the sum of the products of the corresponding entries of the two sequences of numbers. It is a fundamental operation in vector spaces, serving as the basis for defining orthogonality and vector projections.
When to use: Use the dot product when you need to determine the angle between two vectors, check if two vectors are orthogonal (perpendicular), or calculate the work done by a force vector acting over a displacement.
Why it matters: The dot product is essential in physics for energy calculations, in computer graphics for lighting and shading algorithms, and in machine learning for measuring similarity between data points.
Symbols
Variables
a b = Dot Product, = Vector A component 1, = Vector A component 2, = Vector B component 1, = Vector B component 2
Walkthrough
Derivation
Derivation of Dot Product (Scalar Product)
This derivation uses the Law of Cosines to bridge the geometric definition of vectors as magnitudes and angles with their algebraic representation in Cartesian components.
- Vectors are defined in a 3D Euclidean space.
- The vectors are non-zero to allow for a defined angle between them.
Law of Cosines on a Vector Triangle
Consider a triangle formed by vectors a, b, and the difference vector (b - a). The Law of Cosines relates the side lengths of this triangle to the angle theta between a and b.
Note: Remember that the angle theta must be placed between the tails of the two vectors.
Algebraic Expansion of the Magnitude
Expanding the magnitude squared of the vector (b - a) using the Pythagorean theorem in coordinate components.
Note: Expanding this yields + - 2a_1b_1 + ... etc.
Equating and Simplifying
By setting the two expressions for |b - a|^2 equal, we subtract |a|^2 and |b|^2 from both sides.
Note: This algebraic cancellation isolates the relationship between the components and the trigonometric definition.
Final Identity
Dividing by -2 leaves the standard definition of the dot product, showing that the sum of the products of corresponding components equals the magnitude-cosine product.
Note: This proves the dot product is invariant under rotation of the coordinate system.
Result
Source: Stewart, J. (2015). Calculus: Early Transcendentals, 8th Edition.
Why it behaves this way
Intuition
Imagine a flashlight (vector b) shining onto a surface (vector a). The dot product is the 'shadow' length of vector a cast by vector b, scaled by the magnitude of the light source. If they point in the same direction, the shadow is maximized; if they are perpendicular, the shadow vanishes.
Signs and relationships
- Positive result: The vectors point generally in the same direction (angle < 90°).
- Zero result: The vectors are orthogonal (perpendicular); they have no common alignment.
- Negative result: The vectors point in generally opposite directions (angle > 90°).
One free problem
Practice Problem
Calculate the dot product of vector a = [3, 2] and vector b = [1, 4].
Solve for: dotProduct
Hint: Multiply the corresponding components (3*1) and (2*4), then add the results together.
The full worked solution stays in the interactive walkthrough.
Where it shows up
Real-World Context
In 3D game engines, developers use the dot product to determine if an object is within the field of view of the camera by comparing the orientation vector of the camera with the vector pointing to the object.
Study smarter
Tips
- If the dot product is zero, the vectors are orthogonal (angle is 90 degrees).
- The dot product of a vector with itself is the square of its magnitude: a · a = |a|^2.
- The dot product is commutative, meaning a · b = b · a.
Avoid these traps
Common Mistakes
- Confusing the dot product with the cross product, which results in a vector rather than a scalar.
- Forgetting that the result of a dot product is a scalar value, not a vector.
Common questions
Frequently Asked Questions
This derivation uses the Law of Cosines to bridge the geometric definition of vectors as magnitudes and angles with their algebraic representation in Cartesian components.
Use the dot product when you need to determine the angle between two vectors, check if two vectors are orthogonal (perpendicular), or calculate the work done by a force vector acting over a displacement.
The dot product is essential in physics for energy calculations, in computer graphics for lighting and shading algorithms, and in machine learning for measuring similarity between data points.
Confusing the dot product with the cross product, which results in a vector rather than a scalar. Forgetting that the result of a dot product is a scalar value, not a vector.
In 3D game engines, developers use the dot product to determine if an object is within the field of view of the camera by comparing the orientation vector of the camera with the vector pointing to the object.
If the dot product is zero, the vectors are orthogonal (angle is 90 degrees). The dot product of a vector with itself is the square of its magnitude: a · a = |a|^2. The dot product is commutative, meaning a · b = b · a.
References
Sources
- Stewart, J. (2015). Calculus: Early Transcendentals. Cengage Learning.
- Strang, G. (2016). Introduction to Linear Algebra. Wellesley-Cambridge Press.
- Stewart, J. (2015). Calculus: Early Transcendentals, 8th Edition.