Skip to content

Vector Calculator

Enter two vectors in 2D or 3D and get their sum and difference, magnitudes, unit vectors, dot and cross products, the angle between them and each projection — with exact square roots instead of rounded decimals and the working beside every answer. Switch modes to convert components into magnitude and direction, or back. Free, no sign-up.

What do you want to do?
Dimension
Vector u
Vector v

Whole numbers, decimals or fractions such as 3/4.

Results

−5

Dot product u · v

5

Magnitude |u|

3

Magnitude |v|

109.4712° ≈ 1.910633 rad

Angle between u and v

Sum u + v(3 + 1, 4 + (−2), 0 + 2)(4, 2, 2)
Difference u − v(3 − 1, 4 − (−2), 0 − 2)(2, 6, −2)
Scalar multiple 2 × u(2 × 3, 2 × 4, 2 × 0)(6, 8, 0)
Scalar multiple 2 × v(2 × 1, 2 × (−2), 2 × 2)(2, −4, 4)
Magnitude |u||u| = √(3² + 4² + 0²) = √255
Unit vector in the direction of uu ÷ |u|: divide each component by the magnitude(3/5, 4/5, 0)
Magnitude |v||v| = √(1² + (−2)² + 2²) = √93
Unit vector in the direction of vv ÷ |v|: divide each component by the magnitude(1/3, −2/3, 2/3)
Dot product u · vu · v = 3 × 1 + 4 × (−2) + 0 × 2−5
Cross product u × vu × v = (4 × 2 − 0 × (−2), 0 × 1 − 3 × 2, 3 × (−2) − 4 × 1)(8, −6, −10)
Area of the parallelogram on u and v|u × v| = √(|u|²|v|² − (u · v)²); the triangle on u and v has half this area10√2 ≈ 14.142136
Angle between u and vcos θ = (u · v) / (|u| |v|) = −5 / (5 × 3) = −1/3109.4712° ≈ 1.910633 rad
Projection of u onto vproj = ((u · v) / (v · v)) × v, with factor −5/9(−5/9, 10/9, −10/9)
Scalar projection of u along vcomp = (u · v) / |v|, the signed length of the shadow of u along v−5/3
Projection of v onto uproj = ((v · u) / (u · u)) × u, with factor −1/5(−3/5, −4/5, 0)
Scalar projection of v along ucomp = (u · v) / |v|, the signed length of the shadow of v along u−1

Three-dimensional vectors are not drawn; the exact results above are complete.

How to Use the Vector Calculator

  1. 1. Choose a mode and a dimension. "Work with two vectors" does every operation at once; the other two modes convert between components and magnitude-and-direction.
  2. 2. Enter the components. Whole numbers, decimals and fractions are all exact. Pick 2D or 3D first, and fill in u and v (and a scalar k if you want multiples).
  3. 3. Read the results. Each row gives its formula with your numbers substituted, then the answer. Magnitudes stay as radicals — |(1, 1)| is √2 — with a decimal beside them.
  4. 4. Check the diagram. In 2D, u, v and u + v are drawn to scale from the origin with the parallelogram completed and the foot of the projection marked.

The Formulas

QuantityFormulaNotes
Magnitude|v| = √(x² + y² + z²)The length of the vector
Unit vectorv̂ = v / |v|Length 1, same direction; undefined for the zero vector
Dot productu · v = u₁v₁ + u₂v₂ + u₃v₃ = |u||v| cos θA number; 0 means perpendicular
Cross productu × v = (u₂v₃ − u₃v₂, u₃v₁ − u₁v₃, u₁v₂ − u₂v₁)3D only; perpendicular to both; |u × v| = |u||v| sin θ
Angleθ = cos⁻¹((u · v) / (|u||v|))Between 0° and 180°
Vector projectionproj_v u = ((u · v) / (v · v)) vThe part of u along v
Scalar projectioncomp_v u = (u · v) / |v|Signed length of that part

For 2D vectors the calculator treats them as lying in the xy-plane, so the cross product reduces to the single number u₁v₂ − u₂v₁ — the z-component.

Worked Example: u = (3, 4, 0) and v = (1, −2, 2)

  • Sum and difference. u + v = (4, 2, 2) and u − v = (2, 6, −2).
  • Magnitudes. |u| = √(9 + 16 + 0) = 5 and |v| = √(1 + 4 + 4) = 3, so the unit vectors are (3/5, 4/5, 0) and (1/3, −2/3, 2/3).
  • Dot product. u · v = 3 − 8 + 0 = −5. It is negative, so the angle is obtuse.
  • Angle. cos θ = −5 / (5 × 3) = −1/3, so θ ≈ 109.4712° (about 1.910633 rad).
  • Cross product. u × v = (8, −6, −10). Its dot product with u is 24 − 24 + 0 = 0 and with v it is 8 + 12 − 20 = 0, so it really is perpendicular to both.
  • Parallelogram area. |u × v| = √(64 + 36 + 100) = √200 = 10√2 ≈ 14.142136.
  • Projection of u onto v. The factor is −5/9, so the projection is (−5/9, 10/9, −10/9); the scalar projection is −5/3.

Magnitude and Direction

In 2D, a vector with components (x, y) has magnitude √(x² + y²) and direction angle θ measured counterclockwise from the positive x-axis. The calculator uses atan2(y, x), which puts θ in the right quadrant — the plain arctan(y/x) cannot tell (−3, 4) from (3, −4). So (−3, 4) has magnitude 5 and θ ≈ 126.8699°, in quadrant II. Going the other way, x = r cos θ and y = r sin θ: a vector of length 10 at 30° has components (5√3, 5), which the tool keeps exact for multiples of 30° and 45°.

In 3D a vector's direction is given by the angles α, β and γ it makes with the x-, y- and z-axes. Their cosines, v_x/|v|, v_y/|v| and v_z/|v|, are the direction cosines, and their squares always sum to 1. For (1, 2, 2) they are 1/3, 2/3 and 2/3, giving angles of about 70.5288°, 48.1897° and 48.1897°.

Frequently Asked Questions

What is the difference between the dot product and the cross product?
The dot product of two vectors is a single number, |u||v| cos θ, that measures how far they point the same way. The cross product is a vector perpendicular to both, with length |u||v| sin θ equal to the area of the parallelogram they span. The cross product exists in 3D; the dot product works in any dimension.
How do you find the angle between two vectors?
Divide the dot product by the product of the magnitudes to get cos θ, then take the inverse cosine: θ = cos⁻¹((u · v) / (|u||v|)). The result is always between 0° and 180°. A dot product of 0 gives 90°, and the angle is undefined if either vector is the zero vector.
How do you find a unit vector?
Divide the vector by its own magnitude. The result points the same way and has length exactly 1. For (1, 1) that is (1/√2, 1/√2), which the calculator writes in rationalized form as (√2/2, √2/2).
How do you know if two vectors are perpendicular or parallel?
They are perpendicular exactly when their dot product is 0. They are parallel when one is a scalar multiple of the other, which is exactly when their cross product is the zero vector (in 2D, when u₁v₂ − u₂v₁ = 0).
What does the projection of one vector onto another mean?
The projection of u onto v is the component of u that lies along v: the shadow u casts on the line through v. The scalar projection is that shadow's signed length, negative if u points against v. What is left, u minus the projection, is perpendicular to v.
Why does the calculator show square roots instead of decimals?
Exact radicals are what a textbook or an exam expects, and they avoid rounding error. Each radical comes with a six-decimal approximation next to it, so you can use whichever form you need.

Related Tools

More in Math Calculators

See all Math Calculators