Dot Product Calculator
Calculate the dot product of two vectors in 2D, 3D, or any dimension. Get step-by-step solutions, find the angle between vectors, and check orthogonality instantly.
Matrix Dot Product Calculator
Calculate the dot product of two matrices with an intuitive interface
Enter values for Matrix A
Enter values for Matrix B
Understanding the Dot Product
The dot product (also known as the scalar product or inner product) is a fundamental operation in linear algebra that combines two vectors to produce a single scalar value. It captures essential geometric information about the relationship between vectors, including alignment, angle, and projection. There are two equivalent ways to define the dot product: algebraically and geometrically.
Algebraic Formula
A · B = a₁b₁ + a₂b₂ + ... + aₙbₙ
Multiply each pair of corresponding components and sum the results. This component-wise definition works for vectors of any dimension and is the most common computation method.
Geometric Formula
A · B = |A| |B| cos(θ)
The product of the magnitudes of both vectors and the cosine of the angle between them. This form reveals the geometric meaning: the dot product measures how aligned two vectors are.
Key Properties
A · B = B · A (commutative)
The dot product is commutative (order doesn't matter), distributive over addition, and compatible with scalar multiplication. It is always a real number, never a vector.
Finding the Angle
θ = arccos(A · B / (|A| |B|))
Rearranging the geometric formula lets you find the angle between any two non-zero vectors. This is widely used in physics, graphics, and machine learning to measure vector similarity.
Dot Product Calculation Methods
There are several approaches to computing the dot product depending on the information available. Each method yields the same result but is suited to different scenarios. Our calculator supports all common methods and shows full working at every step.
Algebraic Method
A · B = Σ aᵢbᵢ
Multiply each corresponding pair of components and add the products. For A = (2, 3, 1) and B = (4, -1, 2): 2×4 + 3×(-1) + 1×2 = 8 - 3 + 2 = 7. This is the most straightforward method when you have component values.
Geometric Method
A · B = |A||B|cosθ
Use this when you know the magnitudes and the angle between vectors. For |A| = 5, |B| = 3, and θ = 60°: 5 × 3 × cos(60°) = 15 × 0.5 = 7.5. This is common in physics problems involving force and displacement.
Using Matrix Notation
A · B = AᵀB
Express the dot product as a matrix multiplication of the transpose of A with B. This notation is standard in linear algebra and is how dot products are computed in programming libraries like NumPy and MATLAB.
2D Example
A = (3, 4), B = (1, 2)
A · B = 3×1 + 4×2 = 3 + 8 = 11
|A| = 5, |B| = √5 ≈ 2.236
θ = arccos(11 / (5 × 2.236)) ≈ 10.3°
3D Example
A = (1, -2, 3), B = (4, 0, -1)
A · B = 1×4 + (-2)×0 + 3×(-1) = 4 + 0 - 3 = 1
|A| = √14, |B| = √17
θ = arccos(1 / √238) ≈ 86.3°
Orthogonal Check
A = (2, 3), B = (3, -2)
A · B = 2×3 + 3×(-2) = 6 - 6 = 0
Since the dot product is zero, vectors A and B are perpendicular (orthogonal) to each other.
Dot Product Applications
The dot product is one of the most widely used operations in applied mathematics. It appears across physics, computer science, data science, and engineering wherever the relationship between directions or magnitudes matters.
Physics & Engineering
- • Calculating work done: W = F · d (force dotted with displacement)
- • Projecting one vector onto another for component analysis
- • Determining power: P = F · v (force dotted with velocity)
- • Electromagnetic field calculations (E · A for electric flux)
Machine Learning & Data Science
- • Cosine similarity for text and document comparison
- • Neural network forward propagation (weight · input)
- • Kernel methods in support vector machines
- • Recommendation systems and collaborative filtering
Computer Graphics & Gaming
- • Lighting calculations (Lambert's cosine law: N · L)
- • Back-face culling to determine visible surfaces
- • Reflection and refraction vector computations
- • Camera frustum and field-of-view calculations
Geometry & Linear Algebra
- • Testing orthogonality: vectors are perpendicular when A · B = 0
- • Gram-Schmidt orthogonalization process
- • Computing vector projections and decompositions
- • Defining inner product spaces and Hilbert spaces
Frequently Asked Questions
What is the dot product?
The dot product (also called the scalar product or inner product) is an algebraic operation that takes two equal-length vectors and returns a single scalar value. It combines the corresponding components of each vector by multiplying them together and summing the results. For example, the dot product of vectors A = (2, 3) and B = (4, 5) is 2×4 + 3×5 = 23. The dot product encodes important geometric information about the relationship between two vectors, including the angle between them and whether they are perpendicular.
How do you calculate the dot product of two vectors?
To calculate the dot product of two vectors, multiply each pair of corresponding components and then add all the products together. For vectors A = (a₁, a₂, ..., aₙ) and B = (b₁, b₂, ..., bₙ), the dot product is A · B = a₁b₁ + a₂b₂ + ... + aₙbₙ. For example, if A = (1, 3, -2) and B = (4, -1, 5), then A · B = (1)(4) + (3)(-1) + (-2)(5) = 4 - 3 - 10 = -9. This component-wise method works for vectors of any dimension.
What is the dot product formula?
There are two main dot product formulas. The algebraic formula is A · B = a₁b₁ + a₂b₂ + ... + aₙbₙ, which sums the products of corresponding components. The geometric formula is A · B = |A| |B| cos(θ), where |A| and |B| are the magnitudes (lengths) of the vectors and θ is the angle between them. Both formulas always give the same result. The geometric formula is especially useful for finding angles: θ = arccos(A · B / (|A| |B|)).
What does the dot product tell you?
The dot product reveals the geometric relationship between two vectors. If the dot product is positive, the vectors point in roughly the same direction (angle less than 90°). If negative, they point in roughly opposite directions (angle greater than 90°). If zero, the vectors are perpendicular (orthogonal). The magnitude of the dot product indicates how aligned the vectors are — it reaches its maximum when the vectors are parallel. The dot product also equals the length of one vector’s projection onto the other, multiplied by the other vector’s length.
What is the difference between dot product and cross product?
The dot product and cross product are two distinct vector operations. The dot product (A · B) returns a scalar (a single number) and works in any dimension. The cross product (A × B) returns a new vector that is perpendicular to both input vectors and only works in 3D. The dot product measures how parallel two vectors are, while the cross product measures how perpendicular they are. The dot product uses cosine of the angle (A · B = |A||B|cosθ), while the cross product magnitude uses sine (|A × B| = |A||B|sinθ).
When is the dot product zero?
The dot product of two vectors is zero when the vectors are orthogonal (perpendicular), meaning the angle between them is exactly 90°. This is because A · B = |A||B|cos(90°) = 0, since cos(90°) = 0. The dot product is also zero if either vector is the zero vector. Testing whether A · B = 0 is the standard method for checking orthogonality in linear algebra, computer graphics, and machine learning. For example, (1, 0) · (0, 1) = 0, confirming that the x-axis and y-axis unit vectors are perpendicular.
Related Calculators
Share This Calculator
Found this tool helpful?
Help others discover it with one click.
Copy Link
Suggested hashtags: #product #Calculator #FreeTools #AICalculator