Dot Product Calculator

Calculate scalar products, angles, projections, and vector alignment.

Results are calculated automatically as you enter data.

Vector values
Dimensions:
3
Components: X, Y, Z

Formula and interpretation
Dot productEnter valid vectors.

Finite components are evaluated with scaled arithmetic so very large and very small values can be combined. Results are rounded only for display; a nonzero value that rounds below browser range is rejected rather than treated as zero. Vectors are called orthogonal only when their computed dot product is exactly zero for the entered values.

▼ See explanations and tips below ▼

What Is the Dot Product?

The dot product is a way to multiply two vectors of the same dimension and get one number as the result. That number is a scalar, not another vector.

For two vectors

$$ A = (a_1, a_2, \ldots, a_n) $$

and

$$ B = (b_1, b_2, \ldots, b_n), $$

the dot product is

$$ A \cdot B = \sum_{i=1}^{n} a_i b_i = a_1b_1 + a_2b_2 + \cdots + a_nb_n. $$

In plain language, multiply each component of Vector A by the matching component of Vector B, then add the products.

The dot product also has a geometric meaning. For two nonzero vectors, it measures how strongly the vectors point in the same direction. This connection comes from the formula

$$ A \cdot B = \lVert A \rVert \lVert B \rVert \cos\theta, $$

where \(\theta\) is the angle between the vectors. A positive dot product means the vectors point in broadly similar directions. A negative dot product means they point more against each other. A dot product of zero means the vectors are perpendicular when both vectors are nonzero.


Why the Dot Product Matters

The dot product is useful because it connects arithmetic with geometry. The component formula is easy to calculate, while the angle formula explains what the result means.

Students use the dot product in algebra, geometry, calculus, linear algebra, and physics. It helps answer questions such as:

  • Are these two vectors perpendicular?
  • What is the angle between them?
  • How much of one vector points in the direction of another?
  • How similar are two direction-based data vectors?
  • How much work is done by a force acting along a displacement?

The same idea appears in many settings. In geometry, it describes alignment. In physics, it helps calculate work from force and displacement. In data analysis, a normalized dot product becomes cosine similarity, which compares direction while reducing the effect of vector length.


Key Terms to Know

  • Vector: An ordered list of numbers, such as \((3, 4)\) or \((2, -1, 5)\).
  • Component: One entry in a vector. In \((3, 4, 0)\), the components are \(3\), \(4\), and \(0\).
  • Dimension: The number of components in a vector. A vector with three components is a 3D vector.
  • Scalar: A single number. The dot product result is a scalar.
  • Magnitude: The length of a vector, written as \(\lVert A \rVert\).
  • Angle between vectors: The smaller angle formed when two nonzero vectors are placed tail-to-tail.
  • Orthogonal vectors: Vectors that meet at a right angle. For nonzero vectors, this is equivalent to a dot product of \(0\).
  • Projection: The part of one vector that lies in the direction of another vector.
  • Cosine similarity: The dot product divided by the product of the two magnitudes. It compares direction rather than raw vector size.

How the Dot Product Works

The dot product starts with two vectors that have the same number of components. For example, if

$$ A = (3, 4, 0) $$

and

$$ B = (4, 0, -2), $$

then the dot product is

$$ A \cdot B = (3)(4) + (4)(0) + (0)(-2) = 12. $$

The magnitude of a vector is its Euclidean length. For a vector \(A = (a_1, a_2, \ldots, a_n)\), the magnitude is

$$ \lVert A \rVert = \sqrt{a_1^2 + a_2^2 + \cdots + a_n^2}. $$

For two nonzero vectors, the angle between them can be found by rearranging the geometric dot product formula:

$$ \cos\theta = \frac{A \cdot B}{\lVert A \rVert \lVert B \rVert}. $$

Then

$$ \theta = \cos^{-1}\left(\frac{A \cdot B}{\lVert A \rVert \lVert B \rVert}\right). $$

This calculator reports the angle in degrees. The angle is defined only when both vectors have nonzero magnitude, because a zero vector has no direction.

The vector projection of \(A\) onto \(B\) is the part of \(A\) that points along the direction of \(B\):

$$ \operatorname{proj}_B(A) = \frac{A \cdot B}{\lVert B \rVert^2}B. $$

This projection requires \(B\) to be nonzero. Projecting \(A\) onto \(B\) is not the same as projecting \(B\) onto \(A\), because the direction vector is different.


Examples of the Dot Product in Practice

Example 1: Simple Component Calculation

Let

$$ A = (3, 4, 0) $$

and

$$ B = (4, 0, -2). $$

Multiply matching components and add:

$$ A \cdot B = (3)(4) + (4)(0) + (0)(-2) $$
$$ A \cdot B = 12 + 0 + 0 = 12. $$

Now calculate the magnitudes:

$$ \lVert A \rVert = \sqrt{3^2 + 4^2 + 0^2} = 5 $$
$$ \lVert B \rVert = \sqrt{4^2 + 0^2 + (-2)^2} = \sqrt{20} \approx 4.47214. $$

The angle is found from

$$ \cos\theta = \frac{12}{5\sqrt{20}} \approx 0.53666. $$

So

$$ \theta \approx 57.54369^\circ. $$

The projection of \(A\) onto \(B\) is

$$ \operatorname{proj}_B(A) = \frac{12}{20}(4, 0, -2). $$

So

$$ \operatorname{proj}_B(A) = (2.4, 0, -1.2). $$

The positive dot product and acute angle tell us that the vectors point partly in the same direction.


Example 2: Weighted Score Example

The dot product can combine matching quantities and weights. Suppose a course grade uses three categories, and a student has score vector

$$ S = (80, 90, 75). $$

The weight vector is

$$ W = (0.20, 0.30, 0.50). $$

The weighted score is the dot product:

$$ S \cdot W = (80)(0.20) + (90)(0.30) + (75)(0.50). $$
$$ S \cdot W = 16 + 27 + 37.5 = 80.5. $$

Here, the dot product works because each score is paired with the matching category weight. If the components were placed in the wrong order, the result would describe a different weighting.


Example 3: Orthogonal and Zero-Vector Edge Cases

Let

$$ A = (3, 4) $$

and

$$ B = (4, -3). $$

The dot product is

$$ A \cdot B = (3)(4) + (4)(-3) = 12 - 12 = 0. $$

Both vectors are nonzero, so the zero dot product means the vectors are orthogonal. Their angle is \(90^\circ\).

Now compare that with

$$ C = (0, 0) $$

and

$$ D = (4, -3). $$

Their dot product is also

$$ C \cdot D = (0)(4) + (0)(-3) = 0. $$

But this does not prove a right angle, because \(C\) is the zero vector. A zero vector has no direction, so the angle is undefined. This is why a zero dot product means perpendicular only when both vectors are nonzero.


How to Interpret the Result

The dot product is best interpreted together with vector magnitudes and the angle between vectors.

Result What it usually means
Positive dot product The vectors point in broadly similar directions.
Negative dot product The vectors point in opposing or obtuse directions.
Dot product of \(0\) with two nonzero vectors The vectors are orthogonal, meaning the angle is \(90^\circ\).
Dot product of \(0\) involving a zero vector The angle is undefined, so it should not be treated as proof of perpendicular directions.
Larger absolute dot product The vectors may be longer, more aligned, or both.
Angle near \(0^\circ\) The vectors point in nearly the same direction.
Angle near \(90^\circ\) The vectors are nearly perpendicular.
Angle near \(180^\circ\) The vectors point in nearly opposite directions.

A high dot product does not always mean the directions are very similar. It may simply mean one or both vectors have large magnitudes. When the goal is to compare direction alone, use the normalized value

$$ \frac{A \cdot B}{\lVert A \rVert \lVert B \rVert}, $$

which is the cosine of the angle for nonzero vectors.

The projection result should be read as a vector. For \(\operatorname{proj}_B(A)\), the output is the part of \(A\) that lies along the direction of \(B\). If the projection points opposite the direction of \(B\), the scale factor is negative.

For vectors with more than two components, a 2D graph can still help visualize the first two components, but it cannot show the full higher-dimensional relationship.


Common Mistakes and Misconceptions

One common mistake is using vectors with different dimensions. The dot product requires matching components, so \((1, 2, 3)\) cannot be dotted with \((4, 5)\) unless the vectors are first made compatible in a mathematically meaningful way.

Another mistake is leaving a blank component when the intended value is \(0\). A blank input is not the same as zero. Enter \(0\) explicitly when a component has no value in that position.

It is also easy to confuse a zero dot product with perpendicular vectors in every situation. The perpendicular interpretation applies only when both vectors are nonzero. If either vector is the zero vector, the angle is undefined.

Projection direction is another frequent source of confusion. The projection of \(A\) onto \(B\) points along \(B\). The projection of \(B\) onto \(A\) points along \(A\). These are usually different vectors.

Users sometimes expect a 2D graph to represent every component of a 3D or higher-dimensional vector. A two-dimensional graph can only show the first two components, so it should be treated as a visual aid rather than a complete picture for higher-dimensional vectors.

Finally, be careful with units and scales. If one component represents meters and another represents seconds, the dot product may be mathematically valid as arithmetic but may not have a useful physical meaning unless the vector model is well defined.


When to Use the Dot Product

Use the dot product when you need to:

  • Find the scalar product of two equal-dimension vectors.
  • Test whether two nonzero vectors are orthogonal.
  • Find the angle between two nonzero vectors.
  • Compute the projection of one vector onto another nonzero vector.
  • Compare vector direction through cosine similarity.
  • Combine matching quantities and weights into a single total.
  • Calculate work when a force and displacement are represented as vectors.

The dot product is especially useful when a problem involves both size and direction. If the problem only cares about direction, the cosine value may be easier to interpret than the raw dot product.


Limitations and Things to Keep in Mind

This calculation assumes real-valued Euclidean vectors. It does not cover complex-valued vectors, symbolic vectors, weighted inner products, or non-Euclidean inner products.

The vectors must have the same number of components. This calculator supports vectors from \(2\) through \(10\) components. It does not support one-dimensional vectors or vectors with more than \(10\) components.

The angle calculation requires two nonzero vectors. If either vector has magnitude \(0\), there is no defined direction for that vector, so the angle cannot be calculated.

The projection of \(A\) onto \(B\) requires \(B\) to be nonzero. The formula divides by \(\lVert B \rVert^2\), so the projection is undefined when \(B\) is the zero vector.

Displayed results are rounded only for readability. The calculator keeps a separate scale for finite components and products, so it can combine very large and very small entered values without first overflowing or underflowing the intermediate dot product. A nonzero entry that converts to zero in the browser is rejected as below the supported numeric range rather than treated as zero. Orthogonality is reported only when the computed dot product is exactly \(0\) for the entered values; no near-zero tolerance is used.

For vectors with more than two components, the graph uses only the first two components. Use the numeric dot product, magnitudes, angle, and projection to interpret the full vector relationship.

For physics, engineering, data analysis, or safety-related work, make sure the vector model and units are appropriate before relying on the result. The calculation can be correct even when the chosen vector representation does not match the real-world situation.


How to Use This Calculator

  1. Choose the number of vector components, from \(2\) to \(10\).
  2. Enter every component of Vector A.
  3. Enter every component of Vector B using the same dimension.
  4. Enter \(0\) for zero components instead of leaving fields blank.
  5. Optionally paste two lines of vector values, with Vector A on the first line and Vector B on the second line. Values may be separated by spaces, commas, semicolons, or tabs.
  6. Optionally load an example preset to see an orthogonal or standard example.
  7. Review the dot product, magnitudes, angle, projection, formula expansion, interpretation, and graph.
  8. Use the graph download option if you need a PNG image of the 2D alignment view.

Frequently Asked Questions

What is the dot product formula?

For \(A = (a_1, a_2, \ldots, a_n)\) and \(B = (b_1, b_2, \ldots, b_n)\), the dot product is \(A \cdot B = \sum_{i=1}^{n} a_i b_i\). Multiply each matching pair of components and add the products.


Why can a dot product be negative?

A dot product is negative when the vectors point more in opposite directions than in the same direction. Geometrically, this happens when the angle between two nonzero vectors is obtuse, so \(\cos\theta\) is negative.


Does a zero dot product always mean the vectors are perpendicular?

No. A zero dot product means two nonzero vectors are perpendicular. If one or both vectors are zero vectors, the dot product is still zero, but the angle is undefined because a zero vector has no direction.


What is the projection of A onto B?

The projection of \(A\) onto \(B\) is the vector part of \(A\) that lies in the direction of \(B\). It is calculated as \(\operatorname{proj}_B(A) = \frac{A \cdot B}{\lVert B \rVert^2}B\), and it requires \(B\) to be nonzero.


Why do the vectors need the same number of components?

The dot product pairs each component of Vector A with the matching component of Vector B. If the vectors have different dimensions, there is no complete one-to-one pairing of components.


Sources and References

Books and Open Textbooks

  1. OpenStax. Calculus Volume 3. OpenStax, 2016. Section 2.3, “The Dot Product.” OpenStax: The Dot Product.
  2. Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra. Georgia Institute of Technology, June 3, 2019. Sections 6.1, “Dot Products and Orthogonality,” and 6.3, “Orthogonal Projection.” Interactive Linear Algebra: Dot Products and Orthogonality; Interactive Linear Algebra: Orthogonal Projection.

Online and Educational Sources

  1. Herbert Gross. “Lecture 4: The Dot Product.” Calculus Revisited: Multivariable Calculus, MIT OpenCourseWare, Fall 2011. MIT OpenCourseWare: Lecture 4, The Dot Product.
  2. scikit-learn developers. “cosine_similarity.” scikit-learn User Guide and API Reference, accessed June 28, 2026. scikit-learn: cosine_similarity.