MathematicsLinear Algebra and Vector CalculusUniversity

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.

Understand the formulaSee the free derivationOpen the full walkthrough

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

Dot Product
Variable
Vector A component 1
Variable
Vector A component 2
Variable
Vector B component 1
Variable
Vector B component 2
Variable

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.
1

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.

2

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.

3

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.

4

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.

Dot Product
A measure of how much two vectors 'agree' or align with each other.
Magnitude Product
The 'raw' strength of both vectors if they were perfectly aligned.
Alignment Factor
A percentage (from -1 to 1) representing how much of vector b actually contributes to the direction of vector a.
Component-wise product
The algebraic approach: sum up the product of corresponding dimensions to see how they interact in coordinate space.

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].

Vector A component 13
Vector A component 22
Vector B component 11
Vector B component 24

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

  1. Stewart, J. (2015). Calculus: Early Transcendentals. Cengage Learning.
  2. Strang, G. (2016). Introduction to Linear Algebra. Wellesley-Cambridge Press.
  3. Stewart, J. (2015). Calculus: Early Transcendentals, 8th Edition.