Dot Product Calculator — Angle, Orthogonality & Projection

Compute the dot product of two vectors in 2D–6D, find the angle between them, check orthogonality and parallelism, and visualize component contributions with an interactive calculator.

Vector a

Vector b

Dot Product (a · b)
32.000000
Sum of component-wise products: 4.0000 + 10.0000 + 18.0000
Angle (degrees)
12.9332°
cos⁻¹(0.974632) = 12.9332°
Angle (radians)
0.225726 rad
Angle in radians between vectors a and b
cos θ
0.974632
Cosine of the angle: a·b / (‖a‖·‖b‖)
‖a‖
3.741657
Magnitude of a = √(1² + 2² + 3²)
‖b‖
8.774964
Magnitude of b = √(4² + 5² + 6²)
Scalar Projection
3.646738
proj_b(a) = (a·b)/‖b‖ — length of a's shadow on b
Orthogonal?
No
Dot product = 32.0000 ≠ 0
Parallel?
No
|cos θ| = 0.9746 ≠ 1

Vector Projection of a onto b

proj_b(a) = (a·b / ‖b‖²) · b = (1.6623, 2.0779, 2.4935)

Component Products Table

iaᵢbᵢaᵢ·bᵢContribution
11.00004.00004.000012.5%
22.00005.000010.000031.3%
33.00006.000018.000056.3%
Total (a · b)32.0000100%

Component Product Magnitudes

i=1
4.000
i=2
10.000
i=3
18.000

Dot Product Properties

PropertyFormula / Description
Commutativitya · b = b · a
Distributivitya · (b + c) = a·b + a·c
Scalar mult.(ka) · b = k(a · b)
Geometric forma · b = ‖a‖ ‖b‖ cos θ
Orthogonality testa · b = 0 ⟺ a ⊥ b
Self dot producta · a = ‖a‖²
Planning notes, formulas, and examples

About the Dot Product Calculator — Angle, Orthogonality & Projection

The dot product (also called the scalar product or inner product) is one of the most fundamental operations in linear algebra. Given two vectors a and b of the same dimension, the dot product a · b equals the sum of the products of their corresponding components: a₁b₁ + a₂b₂ + … + aₙbₙ. The result is a single scalar, not a vector.

Beyond the algebraic definition, the dot product has a powerful geometric interpretation: a · b = ‖a‖ ‖b‖ cos θ, where θ is the angle between the two vectors. This connection means the dot product simultaneously encodes magnitude and directional information. When a · b = 0, the vectors are orthogonal (perpendicular); when cos θ = ±1, they are parallel or anti-parallel.

This calculator handles vectors from 2D up to 6D. Enter the components of both vectors, choose from six built-in presets, and see the dot product, the angle in degrees and radians, cos θ, individual magnitudes, scalar projection, and orthogonality and parallelism checks. A component products table breaks down how each dimension contributes, and bar charts visualize product magnitudes so you can spot dominant components at a glance.

The dot product appears everywhere: computing work done by a force in physics, measuring cosine similarity in machine learning, projecting one vector onto another in computer graphics, and testing perpendicularity in geometry. Understanding it deeply unlocks much of applied mathematics, data science, and engineering.

When This Page Helps

Computing the dot product, both magnitudes, the division, and the inverse cosine for the angle is a multi-step process where arithmetic mistakes compound quickly — especially in higher dimensions. This calculator provides the dot product, angle in degrees and radians, orthogonality and parallelism checks, scalar projection, and a component-by-component breakdown with visual bars. It is essential for physics students computing work (W = F·d), ML practitioners evaluating cosine similarity, and anyone needing a quick perpendicularity test.

How to Use the Inputs

  1. Select vector dimension (2D through 6D)
  2. Enter components of vector a in the first group of fields
  3. Enter components of vector b in the second group of fields
  4. Or click a preset to load a common example
  5. Read dot product, angle, orthogonality, and projection from the output cards
  6. Examine the component products table and bar chart for per-dimension insights
Formula used
a · b = Σ aᵢbᵢ = a₁b₁ + a₂b₂ + … + aₙbₙ = ‖a‖ ‖b‖ cos θ

Example Calculation

Result: a · b = 32

1×4 + 2×5 + 3×6 = 4 + 10 + 18 = 32. ‖a‖ ≈ 3.742, ‖b‖ ≈ 8.775, cos θ ≈ 0.9746, θ ≈ 12.93°. The vectors are nearly parallel.

Tips & Best Practices

  • If a · b = 0, the vectors are orthogonal — this is the fastest perpendicularity test
  • Cosine similarity (cos θ) is the dot product of unit vectors — widely used in NLP and recommendation systems
  • The scalar projection (a · b)/‖b‖ tells you the signed length of a's shadow on b
  • The dot product is commutative (a · b = b · a), unlike the cross product
  • For real vectors, a · a = ‖a‖² — this connects the dot product to the Euclidean norm

Algebraic and Geometric Definitions

The dot product has two equivalent definitions. **Algebraically**, a · b = Σ aᵢbᵢ, the sum of component-wise products. **Geometrically**, a · b = ‖a‖ ‖b‖ cos θ, where θ is the angle between the vectors. The algebraic form is how you compute it; the geometric form is what it means. A special case is a · a = ‖a‖², connecting the dot product to the Euclidean norm. Unlike the cross product, the dot product returns a scalar, works in any dimension, and is commutative (a · b = b · a).

Orthogonality, Projection, and Cosine Similarity

When a · b = 0, the vectors are **orthogonal** (perpendicular), making the dot product the fastest perpendicularity test. The **scalar projection** of a onto b is (a · b)/‖b‖, giving the signed length of a's shadow on b. The **vector projection** scales the unit vector of b by this scalar. In machine learning and NLP, **cosine similarity** — the dot product of unit vectors — measures directional alignment regardless of magnitude, used in document similarity, recommendation engines, and attention mechanisms in transformers.

Applications in Physics and Data Science

In physics, **work** W = F · d is the dot product of force and displacement, extracting only the component of force along the direction of motion. In electrical engineering, power is P = V · I for AC circuits using phasor representations. In data science, the dot product underpins linear regression (Xᵀy), principal component analysis, and neural network forward passes (weight · input + bias). The dot product's simplicity and universality make it arguably the single most important operation in applied linear algebra.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • The dot product of two vectors is the sum of the products of their corresponding components. It returns a scalar (number), not a vector.