Skip to content
Omnikalc

Vector calculator: magnitude, dot product, cross product and angle

Enter two vectors in 2D or 3D to get their magnitudes, the dot product, the cross product, the angle between them and the projection.

Updated on
Your inputs
Dimension

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Results

Dot product u · v

15

Angle between u and v

53.13 °

Magnitude of u
5
Magnitude of v
5
Cross product u × v: x
0
Cross product u × v: y
0
Cross product u × v: z
-20
Area of the parallelogram |u × v|
20
Scalar projection of u on v
3

Vectors in two and three dimensions

A vector has a size and a direction, and is written with its components: (3, 4) in a plane, or (1, 2, 3) in space. Vectors describe displacements, velocities, forces and directions in computer graphics. This calculator takes two vectors u and v and computes the operations used most often in math, physics and engineering.

The formulas

  • Magnitude: |u| = √(uₓ² + uᵧ² + u_z²)
  • Dot product: u · v = uₓvₓ + uᵧvᵧ + u_zv_z
  • Angle: θ = arccos(u · v ÷ (|u| |v|))
  • Cross product: u × v = (uᵧv_z − u_zvᵧ, u_zvₓ − uₓv_z, uₓvᵧ − uᵧvₓ)
  • Scalar projection of u on v: u · v ÷ |v|

In 2D, the calculator treats the vectors as lying in the xy-plane, so the cross product points along z.

Worked example in 2D

u = (3, 4) and v = (5, 0).

  1. |u| = √(9 + 16) = 5 and |v| = 5.
  2. u · v = 3 × 5 + 4 × 0 = 15.
  3. θ = arccos(15 ÷ 25) = arccos 0.6 = 53.13°.
  4. Cross product: (0, 0, 3 × 0 − 4 × 5) = (0, 0, −20), so the parallelogram they span has an area of 20.
  5. The projection of u on v is 15 ÷ 5 = 3: the shadow of u along the x-axis.

Worked example in 3D

u = (1, 2, 3) and v = (4, 5, 6) give a dot product of 32, magnitudes of 3.742 and 8.775, an angle of 12.93°, and a cross product of (−3, 6, −3) with a length of 7.348.

What the dot product tells you

Dot product Angle Meaning
positive less than 90° the vectors point roughly the same way
zero 90° perpendicular
negative more than 90° they point roughly in opposite directions

In physics, the work done by a force is the dot product of the force and the displacement: only the part of the force along the motion does work.

What the cross product tells you

The cross product is perpendicular to both vectors, following the right-hand rule, and its length is |u| |v| sin θ, the area of the parallelogram. It is zero when the vectors are parallel. It gives the normal to a surface in 3D graphics, the torque of a force, and the force on a moving charge in a magnetic field.

Tips

Use consistent units for all components. To get a unit vector, divide each component by the magnitude. The dot product is commutative (u · v = v · u), but the cross product is not: v × u is the opposite of u × v.

Frequently asked questions

How do you calculate the dot product?

Multiply the matching components and add them: u · v = uₓvₓ + uᵧvᵧ + u_zv_z. For u = (3, 4) and v = (5, 0), the dot product is 15.

How do I find the angle between two vectors?

θ = arccos(u · v ÷ (|u| |v|)). For u = (3, 4) and v = (5, 0): arccos(15 ÷ 25) = 53.13°.

What does a zero dot product mean?

The two vectors are perpendicular (orthogonal), as long as neither of them is the zero vector.

What is the cross product used for?

It gives a vector perpendicular to both u and v, whose length equals the area of the parallelogram they span. It is used for normals in 3D graphics, torque and magnetic forces.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.