Vector Calculator (Dot Product, Cross Product, Angle)

A vector has magnitude and direction. For a = (1, 2, 3) and b = (4, 5, 6), the sum is (5, 7, 9), the dot product is 32, the cross product is (−3, 6, −3) and the angle between them is 12.93°.

Last updated · By · Runs in your browser, nothing is uploaded

Result

Step-by-Step Solution

Enter your values above to see the full working.

What Is a Vector?

A vector is a quantity that has both size (magnitude) and direction, usually written as a list of components such as (1, 2, 3). It can represent a displacement, a velocity, a force or a position in space. Unlike a plain number (a scalar), a vector tells you not only “how much” but “which way”.

This calculator works with 2D and 3D vectors (use z = 0 for 2D). It performs the standard operations: addition and subtraction, magnitude, the dot product (a number that measures how much two vectors point the same way), the cross product (a vector perpendicular to both), the angle between them and the unit vector.

Results for a = (1, 2, 3) and b = (4, 5, 6)

OperationResult
|a| and |b|3.7417 and 8.7750
a + b(5, 7, 9)
a − b(−3, −3, −3)
Dot product a · b32
Cross product a × b(−3, 6, −3)
Angle between a and b12.93°

Vector Formulas

|a| = √(aₓ² + a_y² + a_z²) a ± b = (aₓ ± bₓ, a_y ± b_y, a_z ± b_z) a · b = aₓbₓ + a_yb_y + a_zb_z = |a||b| cos θ a × b = (a_yb_z − a_zb_y, a_zbₓ − aₓb_z, aₓb_y − a_ybₓ) Unit vector â = a ÷ |a|
  • The dot product is a scalar. It is zero when the vectors are perpendicular and equals |a||b| when they point the same way.
  • The cross product is a vector perpendicular to both a and b. Its length |a × b| = |a||b| sin θ is the area of the parallelogram they span.
  • The angle between vectors is θ = arccos[(a · b) ÷ (|a||b|)].

Each operation has a dedicated page: dot product, cross product, magnitude and projection.

How Is It Calculated? Worked Examples

a = (1, 2, 3) and b = (4, 5, 6)

  1. Magnitudes: |a| = √(1 + 4 + 9) = √14 = 3.7417 and |b| = √(16 + 25 + 36) = √77 = 8.7750.
  2. Sum: (1 + 4, 2 + 5, 3 + 6) = (5, 7, 9).
  3. Difference: (−3, −3, −3).
  4. Dot product: 4 + 10 + 18 = 32.
  5. Cross product: (2×6 − 3×5, 3×4 − 1×6, 1×5 − 2×4) = (−3, 6, −3).
  6. Angle: cos θ = 32 ÷ (3.7417 × 8.7750) = 0.9746, so θ = 12.93°.
  7. Parallelogram area: |a × b| = √(9 + 36 + 9) = 7.348.

Perpendicular Vectors

For (1, 2, 0) and (2, −1, 0), the dot product is 2 − 2 = 0, so the angle is exactly 90°.

Work Done by a Force

A force of (2, 3, 1) N moves an object through a displacement (4, 0, 5) m. The work is the dot product 8 + 0 + 5 = 13 J, with an angle of 57.14° between force and displacement.

Torque

A force (0, 0, 5) N acting at the position (0, 2, 0) m produces a torque r × F = (10, 0, 0) N·m, a turning effect about the x-axis.

Projection of a onto b

The scalar projection of a onto b is (a · b) ÷ |b| = 32 ÷ 8.775 = 3.647. The vector projection is (a · b ÷ |b|²) × b = (32 ÷ 77) × (4, 5, 6) = (1.662, 2.078, 2.494), the part of a that points along b. See the vector projection calculator.

How to Use This Vector Calculator

  1. Enter the components of vector a: x, y and z. Use z = 0 for a 2D vector.
  2. Enter the components of vector b.
  3. Read the magnitudes, sum, difference, dot product, cross product, angle and unit vector of a.

Where Vectors Are Used

  • Physics: forces, velocities, fields, work (dot product) and torque (cross product).
  • Engineering: structural loads and mechanics.
  • Computer graphics and games: directions, lighting and collision, where surface normals come from cross products.
  • Navigation and aerospace: wind and heading corrections.
  • Machine learning: data points as vectors, with the dot product measuring similarity.

What Are the Most Common Mistakes With the Vector Calculator (Dot Product, Cross Product, Angle)?

  • Confusing the dot and cross products. One gives a scalar, the other a vector.
  • Swapping the order in a cross product. a × b = −(b × a).
  • Applying the cross product to 2D vectors directly. It is defined in 3D, so use z = 0.
  • Forgetting that the angle needs nonzero vectors. A zero vector has no direction.
  • Mixing units. All components must share the same unit.
  • Treating a vector as a point. Positions and displacements behave differently.

Where Can You Verify These Formulas?

The definitions and formulas on this page follow standard references. Check them against these sources:

Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.

Frequently Asked Questions

What is a vector?

A quantity with magnitude and direction, written as components such as (x, y, z).

What is the dot product?

a · b = aₓbₓ + a_yb_y + a_zb_z. It is a scalar equal to |a||b| cos θ, and is zero for perpendicular vectors.

What is the cross product?

A vector perpendicular to both a and b, with magnitude |a||b| sin θ equal to the area of the parallelogram they span.

How do I find the angle between two vectors?

θ = arccos[(a · b) ÷ (|a||b|)]. For the default vectors it is 12.93°.

What is a unit vector?

A vector of length 1 pointing in the same direction as a given vector: â = a ÷ |a|.

How do I tell if two vectors are perpendicular?

Their dot product is zero.