MaximCalculator Free, fun & accurate calculators
🧮 Platinum math layout
🌙Dark Mode

Dot Product Calculator

Use this free Dot Product Calculator to compute a · b for two vectors in 2D up to 10D. You’ll also get the cosine similarity, the angle between vectors, and clear step-by-step working. It’s fast, mobile-friendly, and designed for screenshots (hello, homework + study group chats).

Instant dot product + steps
📐Angle between vectors (degrees + radians)
🧠Cosine similarity / correlation vibes
💾Save & compare vector pairs

Enter your vectors

Choose the number of components, then type values for vectors a and b. Works for negative numbers and decimals. Tip: you can paste a list like 1, 2, 3 into the “Quick paste” box.

📏
a=
b=
Your results will appear here
Choose a dimension, enter vectors a and b, then tap “Calculate Dot Product”.
Outputs include dot product, magnitudes, cosine similarity, and the angle between vectors (when defined).
Cosine similarity scale: −1 (opposite) · 0 (perpendicular) · +1 (same direction)
−10+1

This tool is for learning and convenience. For graded work, confirm your steps and rounding rules from your course.

🧾 Formula breakdown

Dot product formula (and what it really means)

The dot product (also called the scalar product) takes two vectors and returns a single number. In coordinate form, it is the sum of the products of matching components. If a = (a₁, a₂, …, aₙ) and b = (b₁, b₂, …, bₙ), then:

a · b = a₁b₁ + a₂b₂ + … + aₙbₙ

That’s the “multiply-and-add” definition. But the dot product has a second identity that is just as important: it connects vector coordinates to geometry. For nonzero vectors, the dot product also equals:

a · b = |a| |b| cos(θ)

where |a| and |b| are magnitudes and θ is the angle between them.

This is where the dot product becomes “viral” in real life: it’s used for checking perpendicularity, computing angles, and measuring similarity between directions or features. Here are the big takeaways:

  • Perpendicular test: if a · b = 0 and neither vector is the zero vector, then θ = 90°. That’s why dot products show up constantly in orthogonality problems.
  • Angle from dot product: rearrange the geometric identity: cos(θ) = (a · b) / (|a||b|) and then θ = arccos(cos(θ)). This calculator reports degrees and radians because different classes and fields prefer different units.
  • Direction similarity: cos(θ) is +1 when vectors point the same way, 0 when they’re perpendicular, and −1 when they’re opposite. That’s exactly what cosine similarity is measuring.

One more concept that makes the dot product incredibly useful is projection. The dot product tells you how much of one vector lies “along” another. The scalar projection of a onto b is:

compᵦ(a) = (a · b) / |b|

And the vector projection is projᵦ(a) = ((a · b) / |b|²) b.

In physics, this shows up when you ask things like “how much force acts in the direction of motion?” In graphics, it appears when you project a point onto a line. In data science, it’s lurking inside linear regression and principal component ideas. The math is the same; the story changes.

Magnitude (length) reminder

The magnitude of an n-dimensional vector is computed using the Pythagorean idea extended to many components:

|a| = √(a₁² + a₂² + … + aₙ²)

This matters because the angle and cosine similarity are only defined if both magnitudes are nonzero. If one vector is the zero vector, the dot product is still defined (it will be 0), but the angle is not meaningful, because a zero vector has no direction.

🧠 How it works

What this calculator does step-by-step

Under the hood, the calculator follows the exact same process you’d show on paper. The only “automation” is that it keeps the arithmetic tidy and displays the steps cleanly.

Step 1: Read and validate the vectors

You can enter vector values in two ways: fill each component field, or paste a list into the quick paste box. The calculator accepts commas or spaces (for example 1, -2, 3 or 1 -2 3). If you paste values, it automatically fills the component inputs for you.

Step 2: Compute the dot product

Once we have a and b, the dot product is the sum of component-wise products: multiply a₁ × b₁, a₂ × b₂, and so on, then add them all up. The steps section shows every multiplication and the final sum.

Step 3: Compute magnitudes

The calculator finds |a| and |b| by squaring each component, summing the squares, then taking the square root. This is needed for cosine similarity and angle.

Step 4: Cosine similarity and angle

If both magnitudes are nonzero, we compute: cos(θ) = (a · b) / (|a||b|). Due to rounding, a computed value might be slightly above 1 or below −1 (like 1.0000000002), so we clamp it into the valid range to keep arccos stable. Then we compute θ in radians and degrees.

Step 5: Projection (bonus)

If |b| > 0, we also report the scalar projection of a onto b: (a · b) / |b|. If you’re doing physics or geometry, this number is often the “what portion counts?” value you’re actually looking for.

Finally, the calculator formats everything for quick sharing: it generates a short summary you can copy, paste, or send in WhatsApp/Telegram/X. People love sharing “angle between vectors” screenshots because it’s the perfect blend of “I did math” and “I’m not doing this by hand.”

🧪 Examples

Dot product examples (with interpretation)

Example 1: Simple 3D vectors

Let a = (1, 2, 3) and b = (4, 5, 6). The dot product is:

a · b = 1·4 + 2·5 + 3·6 = 4 + 10 + 18 = 32

Because the dot product is positive, these vectors point in a generally similar direction (acute angle). The exact angle depends on their magnitudes, but the sign already gives a quick gut-check.

Example 2: Perpendicular vectors (dot product = 0)

Let a = (1, 2) and b = (−2, 1). Compute:

a · b = 1·(−2) + 2·1 = −2 + 2 = 0

Dot product zero means the vectors are perpendicular (orthogonal) as long as neither is the zero vector. In geometry, this is a quick way to confirm a right angle without using slopes.

Example 3: Opposite-ish direction (negative dot product)

Let a = (3, 0) and b = (−2, 1).

a · b = 3·(−2) + 0·1 = −6

Negative dot product means the angle between vectors is obtuse (more than 90°). The vectors are “fighting” each other directionally.

Example 4: Cosine similarity for quick comparison

Suppose two vectors represent feature directions, like word embeddings or normalized measurements. The dot product alone changes with scale, but cosine similarity ignores scale and focuses on direction: cos(θ) near 1 means “very similar,” near 0 means “unrelated,” and near −1 means “opposites.”

That’s why many ML pipelines normalize vectors first: when |a| = |b| = 1, the dot product is the cosine similarity. Same formula, cleaner interpretation.

❓ FAQs

Frequently Asked Questions

  • What is the dot product used for?

    The dot product appears in geometry (angles and perpendicularity), physics (work, force components), computer graphics (lighting and shading), and data science (cosine similarity, projections, optimization). Any time you care about “how aligned” two directions are, the dot product is a natural tool.

  • Can the dot product be negative?

    Yes. A negative dot product means the vectors point mostly in opposite directions (an obtuse angle). A positive dot product suggests an acute angle. A dot product of 0 indicates perpendicular vectors (if both are nonzero).

  • Why does the angle sometimes say “undefined”?

    The angle formula uses θ = arccos((a · b) / (|a||b|)). If |a| = 0 or |b| = 0, the denominator is zero. A zero vector has no direction, so an “angle” isn’t meaningful. The calculator will still compute the dot product (it will be 0), but it will not pretend the angle is defined.

  • Is cosine similarity the same as dot product?

    Not always. Cosine similarity is (a · b) / (|a||b|). If both vectors are normalized to length 1, then the dot product equals cosine similarity. Otherwise, dot product mixes direction and magnitude.

  • What does it mean if cosine similarity is 0?

    If cosine similarity is 0, the vectors are perpendicular (90°) and share no directional alignment. In ML contexts, that often means “no similarity” in direction (though your actual application interpretation can vary).

  • How should I format vector input?

    You can type each component into the fields, or paste a list using commas or spaces: 1, 2, 3 or 1 2 3. Decimals and negative values are allowed (e.g., -0.5, 3.2, 10).

MaximCalculator provides simple, user-friendly tools. Double-check critical calculations and follow your assignment’s rounding rules.