Dot Product Calculator (Scalar Product)
Find the dot product of two vectors from components (2 to 12 dimensions) or from lengths and angle, with both magnitudes, cos θ, the angle and orthogonality.
Dot Product Calculator
Background.
Every till receipt is a dot product. Three items at $2.50, $1.20 and $4.00, bought in quantities of 3, 5 and 2, cost 2.50 × 3 + 1.20 × 5 + 4.00 × 2 = $21.50: multiply matching entries, add the results, and one number is left. Written as vectors, that is (2.5, 1.2, 4) · (3, 5, 2) = 21.5.
What makes the same arithmetic central to geometry and physics is that it also measures direction. For two arrows in space, a · b equals the length of a times the length of b times the cosine of the angle between them. Coordinates go in and an angle comes out, with no drawing and no protractor. The sign sorts most cases on its own: positive when the vectors point broadly the same way, negative when they point broadly apart, and exactly zero when they are perpendicular, which makes the dot product the standard test for a right angle in any number of dimensions.
You can come at it from either side. Give the components of both vectors, anything from 2 to 12 numbers each, and you get the dot product, both lengths, cos θ, the angle and a one-line verdict: parallel, antiparallel, orthogonal, acute or obtuse. Or give two lengths and the angle between them and get the dot product from |a| |b| cos θ. Physics students meet that second form as work, force times distance times the cosine of the angle between them; graphics programmers meet it as the brightness of a surface lit at a slant; search engines use the cosine on its own to judge how alike two documents are.
What is dot product calculator?
The dot product, also called the scalar product or, for ordinary real vectors, the inner product, takes two vectors with the same number of components and returns a single number: a · b = a₁b₁ + a₂b₂ + … + aₙbₙ. Geometrically it equals |a| |b| cos θ, where θ is the angle between the vectors, between 0° and 180°. It is commutative (a · b = b · a), it distributes over addition, and a number multiplying either vector can be pulled outside. It is not associative, since a · b is a scalar and cannot be dotted with a third vector. Dotting a vector with itself gives its length squared, and two non-zero vectors are orthogonal exactly when their dot product is zero. The Cauchy–Schwarz inequality, |a · b| ≤ |a| |b|, is what keeps the cosine between −1 and 1. Unlike the cross product, which works only in three and seven dimensions, the dot product is defined in every dimension.
How to use this calculator.
- Under What do you have?, choose the components of both vectors, or both magnitudes and the angle between them. The fields for the other choice are ignored.
- For components, type each vector's numbers separated by commas, spaces or semicolons, such as 3, -2, 5. Both vectors need the same count, from 2 to 12, and each number must lie within ±1,000,000,000,000. Decimals and scientific notation like 2.5e-3 are fine.
- For magnitudes and angle, enter |a| and |b|, both greater than zero, and the angle in degrees from 0° to 180°. A bearing such as 250° between two directions is really 110° between the vectors, since the angle is always measured the short way round.
- Read the dot product first, then the verdict beside it. If you expected a right angle and the verdict says obtuse, a sign has probably slipped in one of the components.
- Swapping a and b changes nothing, so order the vectors however is convenient. If you want the angle between two lines rather than two arrows, take the smaller of θ and 180° − θ: the example vectors meet at 122.0727°, so the lines through them cross at 57.9273°.
- To check a result, carry it across modes: entering the example's lengths 6.1644 and 4.5826 with an angle of 122.0727° returns a dot product of −15.0001, the original −15 apart from the rounding of the inputs.
The formula.
With components, the dot product is the sum Σ aᵢbᵢ. The lengths come from the same kind of sum, |a| = √(Σ aᵢ²) and |b| = √(Σ bᵢ²), which is Pythagoras extended to n dimensions. Dividing gives cos θ = a · b ÷ (|a| |b|), and θ = arccos of that ratio. The arccosine is the right inverse to use because cosine runs one-to-one from 1 down to −1 as the angle goes from 0° to 180°, exactly the range an angle between two vectors can take, so every cosine maps back to one angle.
Why should a sum of products know anything about angles? Expand the squared length of a − b: |a − b|² = |a|² + |b|² − 2 a · b. The law of cosines says the same side of the triangle formed by a and b is |a|² + |b|² − 2|a| |b| cos θ. Set the two equal and a · b = |a| |b| cos θ falls out. For the worked example, a − b = (2, −6, 7), whose squared length 89 equals 38 + 21 + 30, as the identity requires.
With magnitudes and an angle, the calculation runs the other way: cos θ comes from the angle and a · b = |a| |b| cos θ. Lengths of 5 and 8 at 60° give 5 × 8 × 0.5 = 20.
The verdict is read from the unrounded cosine. A cosine within 10⁻¹² of 1 counts as parallel, within 10⁻¹² of −1 as antiparallel, and within 10⁻¹² of zero as orthogonal; anything else is acute or obtuse by its sign. Because the test uses the cosine rather than the raw dot product, it does not depend on how long the vectors are. The band is extremely narrow, so orthogonal and parallel verdicts appear only for exact or nearly exact data; measured vectors that are perpendicular to within a fraction of a degree will be labelled acute or obtuse, and the angle shows how close they came.
A worked example.
Take a = (3, −2, 5) and b = (1, 4, −2). Multiply matching components: 3 × 1 = 3, −2 × 4 = −8 and 5 × −2 = −10, so a · b = 3 − 8 − 10 = −15. The lengths are |a| = √(9 + 4 + 25) = √38 = 6.1644 and |b| = √(1 + 16 + 4) = √21 = 4.5826, whose product is √798 = 28.2489. Dividing, cos θ = −15 ÷ 28.2489 = −0.531, and the angle is arccos(−0.531) = 122.0727°. The negative dot product had already said the angle was obtuse before any square roots were taken; the verdict confirms it. The same −15 also measures how far a reaches along b's line. Divided by |b|, it gives a scalar projection of −3.2733: a's shadow on that line points backwards, opposite to b, by about 3.27 units. Divided by |b|² = 21 instead, it gives the multiple of b that forms that shadow, −5/7 of b, the vector (−0.7143, −2.8571, 1.4286).
Frequently asked questions.
What does a negative dot product tell me about two vectors?
How do I check whether two vectors are perpendicular?
How is the dot product used to calculate work in physics?
How do I find the projection of one vector onto another?
How is the dot product different from the cross product?
Can I take the dot product of vectors with more than three components?
What is cosine similarity, and why does it ignore vector length?
Why is the zero vector not accepted?
Why does a vector dotted with itself give its length squared?
Can I use this for a weighted total, such as a course grade?
References& sources.
- [1]OpenStax, Calculus Volume 3, §2.3 "The Dot Product" — component definition u·v = u₁v₁ + u₂v₂ + u₃v₃, the geometric theorem u·v = ‖u‖‖v‖ cos θ, the orthogonality criterion (non-zero u and v are orthogonal if and only if u·v = 0), and the angle formula θ = arccos[(u·v)/(‖u‖‖v‖)]. Retrieved 2026-07-29; open access.
- [2]Wolfram MathWorld, "Dot Product" — independent statement of the general n-dimensional component sum X·Y = Σᵢ xᵢyᵢ, the relation X·Y = |X||Y| cos θ, and the perpendicularity consequence. Used as the second authority, and as the basis for accepting more than three components. Retrieved 2026-07-29; open access.
- [3]OpenStax, Calculus Volume 3, §2.4 "The Cross Product" — source of the contrast drawn on this page between the scalar and vector products, including the sine relation and the three-dimensional restriction. Retrieved 2026-07-29; open access.
- [4]MIT OpenCourseWare, 18.06 Linear Algebra (Spring 2010), G. Strang — Unit I covers inner products, lengths and orthogonality. Retrieved 2026-07-29; open access.
- [5]Strang, G. (2016). Introduction to Linear Algebra, 5th ed., Wellesley–Cambridge Press. §1.2 "Lengths and Dot Products" — the dot product, the Schwarz inequality |a·b| ≤ |a||b| that bounds the cosine to [−1, 1], and the cosine formula. The book itself is print; the linked author page at MIT lists the 5th (2016) and 6th (2023) editions and is where the companion material lives. Retrieved 2026-07-29.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 5 cited below
- Method
- a · b = a₁b₁ + a₂b₂ + … + aₙbₙ = |a| |b| cos θ
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled