Vector Projection / Dot & Cross Product Calculator

Compute dot & cross (3D) products, projection of a onto b, magnitudes, angle, and components. Private by design—everything runs locally in your browser.

Vectors & Actions

Enter vectors to see results…

Projection of a onto b: proj_b(a) = (a·b / ||b||²) b (requires b ≠ 0). Angle: θ = arccos((a·b)/(||a||·||b||)) when both nonzero. In 2D, the cross “product” is the scalar aₓbᵧ − aᵧbₓ; in 3D it’s a vector. Tip: Press Enter in any field to calculate.

Preview (2D)

Shows a, b, and projb(a) in 2D mode.

Vector Operations at a Glance

  • Dot product: a·b = Σ aᵢbᵢ. Measures alignment; negative means pointing mostly opposite.
  • Cross product (3D): a×b perpendicular to both; magnitude ||a||||b||sin θ.
  • Projection: component of a along b, proj_b(a) above; perpendicular part is a − proj_b(a).
  • Angle: θ = arccos((a·b)/(||a||·||b||)) (when both nonzero).

Vector Projection, Dot & Cross Product — Concepts & Examples

This calculator helps you explore three closely related operations from linear algebra and physics: the dot product, the cross product (in 3D), and the projection of a onto b. These ideas show how two vectors align, how they differ, and how to split one vector into useful components for geometry, engineering, or data analysis.

Dot Product (Alignment & Angle)

The dot product measures how much two vectors point in the same direction: a · b = Σ aᵢ bᵢ. It connects directly to the angle θ between them: a · b = ||a|| ||b|| cos θ. If the value is positive, the vectors are mostly aligned; if negative, they point in largely opposite directions; if zero, they are orthogonal (perpendicular). Our tool reports θ in radians and degrees when both vectors are non-zero, plus magnitudes ||a|| and ||b||.

Projection (Component of a Along b)

The projection answers: “what part of a lies along b?” When ||b|| ≠ 0, the projection is projb(a) = (a·b / ||b||²) b. Splitting a as a = a∥ + a⟂ with a∥ = projb(a) and a⟂ = a − projb(a) is useful for shadow length problems, resolving forces along an incline, and decomposing motion into “along” and “across” parts. If b = 0, the projection is undefined—our calculator will still compute dot, magnitudes, and (in 3D) the cross product.

Cross Product (Area & Perpendicular Direction, 3D)

In 3D, the cross product a × b is a vector perpendicular to both a and b. Its magnitude equals the parallelogram area spanned by a and b: ||a × b|| = ||a|| ||b|| sin θ. The direction follows the right-hand rule: curl your fingers from a to b; your thumb points along a × b. In 2D, there is no full vector cross product: the “cross” is often represented by the scalar k-component aₓ bᵧ − aᵧ bₓ, which equals the signed area of the parallelogram per unit length in the out-of-plane direction.

Common Pitfalls

  • Zero vectors: Angles and projections require non-zero lengths; otherwise results are undefined.
  • Units: A dot product has squared units (e.g., m²) if your vectors carry units. A projection shares the same units as the original vectors.
  • Numerical rounding: Floating-point math may produce tiny negative values inside arccos. We clamp internally to avoid “NaN”.
  • 2D vs 3D: The 3D cross product returns a full vector; in 2D we display only the scalar k-component.

Where This Shows Up

You’ll see these operations in computer graphics (lighting and normals), robotics and kinematics (motion components), physics (work = F · d), statistics and ML (similarity via cosine), navigation (bearing errors), and structural analysis (resolving forces along beams and cables). Use the projection to isolate the useful component along a chosen direction, the dot product to check alignment or compute work, and the cross product to find perpendicular directions and areas in 3D.

Tip: Try small integers first to build intuition. Then scale up to real-world magnitudes—our calculator keeps full precision and shows rounded values for readability.

5 Fun Facts about Vectors

Projection is a shadow

The projection of a onto b is literally the “shadow” of a cast onto b—same direction as b, but scaled by how aligned they are.

Geometric intuition

Dot product = work

Physics sneak peek: pushing 1 N for 1 m straight ahead is 1 J of work. Push at a right angle and the dot product (and the work) is exactly zero.

Energy insight

Cross gives twice the area

In 3D, ||a×b|| is the area of the parallelogram spanned by a and b—so half of it is the triangle area, no trig required.

Fast geometry

Zero dot means orthogonal

When a·b = 0, you’ve found a perfect perpendicular pair. Graphics engines use this to build camera axes that never skew.

Right-angle detector

2D cross is a sneaky scalar

The “cross” in 2D is just the k-component aₓbᵧ − aᵧbₓ. Its sign tells you if b is to your left or right as you face a.

Orientation trick

Frequently Asked Questions

What happens if b = 0?

The projection is undefined (division by 0). The tool will compute dot, cross (if 3D), and magnitudes, but skip projection/angle.

How precise are results?

Calculations use full double precision and display rounded values. Copy LaTeX for exact numeric strings.

Can I paste values quickly?

Yes—tab between fields and press Enter to compute. Use Share to copy a URL with current inputs.

Explore more tools