Sign up
➜

Vector Math

Dot product, cross product, magnitude, angle, and projections.

Vector Inputs

Enter 2D coordinates.

Vector u
Vector v
Dot product, cross product, magnitude, and angle between vectors.

About this topic

Vector Addition & Subtraction Combine vectors component-by-component.

Adding vectors places them head-to-tail — the resultant goes from the start of the first to the tip of the last. Subtraction gives the vector pointing from one to the other.

Key formulas & rules

  • •u + v = (u₁+v₁, u₂+v₂, u₃+v₃)
  • •u − v = (u₁−v₁, u₂−v₂, u₃−v₃)
  • •Commutative: u + v = v + u
  • •Associative: (u+v)+w = u+(v+w)
  • •Geometrically forms a parallelogram
  • •Result magnitude ≤ |u| + |v| (triangle inequality)

Examples

Input Output Note
(3,4) + (1,2) (4,6) Add components
(3,4) − (1,2) (2,2) Subtract components
(1,0) + (0,1) (1,1) Perpendicular vectors
(2,2) − (2,2) (0,0) Equal vectors cancel

Real-world uses

Force composition Velocity addition Robot path planning
Dot Product (u · v) A scalar that measures alignment of two vectors.

The dot product combines two vectors into a single number. It tells you whether vectors point in similar directions, are perpendicular, or opposite.

Key formulas & rules

  • •Algebraic: u·v = u₁v₁ + u₂v₂ + u₃v₃
  • •Geometric: u·v = |u||v|cos θ
  • •Commutative: u·v = v·u
  • •If u·v = 0 → perpendicular (orthogonal)
  • •If u·v > 0 → angle is acute (< 90°)
  • •If u·v < 0 → angle is obtuse (> 90°)

Examples

Input Output Note
(3,4) · (1,2) 11 3×1 + 4×2 = 11
(1,0) · (0,1) 0 Perpendicular
(2,3) · (2,3) 13 |u|² = 4+9
(1,1) · (−1,1) 0 90° angle

Real-world uses

Work = F·d Cosine similarity in ML Lighting in graphics
Cross Product (u × v) A vector perpendicular to both inputs (3D only).

The cross product takes two 3D vectors and produces a third vector that is perpendicular to both. Its magnitude equals the area of the parallelogram spanned by u and v.

Key formulas & rules

  • •Formula: u × v = (u₂v₃−u₃v₂, u₃v₁−u₁v₃, u₁v₂−u₂v₁)
  • •Result is perpendicular to both u and v
  • •Anti-commutative: u × v = −(v × u)
  • •|u × v| = |u||v|sin θ = area of parallelogram
  • •If u × v = 0 → u and v are parallel
  • •Only defined in 3D (and 7D in special cases)

Examples

Input Output Note
(1,0,0) × (0,1,0) (0,0,1) x̂ × ŷ = ẑ
(0,1,0) × (1,0,0) (0,0,−1) Order matters!
(1,1,0) × (1,1,0) (0,0,0) Parallel vectors
(2,0,0) × (0,3,0) (0,0,6) Area = 6

Real-world uses

Torque = r × F Surface normals in 3D Angular momentum
Magnitude (|u|) The length of a vector — its distance from origin.

The magnitude is the Euclidean length of the vector. It generalizes the Pythagorean theorem to any number of dimensions.

Key formulas & rules

  • •2D: |u| = √(u₁² + u₂²)
  • •3D: |u| = √(u₁² + u₂² + u₃²)
  • •Always non-negative: |u| ≥ 0
  • •|u| = 0 if and only if u is the zero vector
  • •Unit vector: û = u / |u| (length 1)
  • •Triangle inequality: |u+v| ≤ |u| + |v|

Examples

Input Output Note
u = (3,4) 5 3-4-5 triangle
u = (1,1) 1.4142 √2
u = (0,0,5) 5 Along z-axis
u = (1,2,2) 3 √(1+4+4) = 3

Real-world uses

Distance calculations Normalizing vectors Speed from velocity
Angle & Projection Angle between vectors and projection of one onto another.

The angle between vectors tells you how aligned they are. The projection of u onto v is the 'shadow' of u cast along the direction of v.

Key formulas & rules

  • •cos θ = (u·v) / (|u||v|)
  • •θ ranges from 0° to 180°
  • •Projection scalar: comp_v(u) = (u·v) / |v|
  • •Projection vector: proj_v(u) = ((u·v) / |v|²) · v
  • •Residual u − proj_v(u) is perpendicular to v
  • •θ = 0° → parallel; θ = 90° → perpendicular

Examples

Input Output Note
(1,0) ↔ (1,1) 45° Halfway
(1,0) ↔ (0,1) 90° Perpendicular
(1,0) ↔ (−1,0) 180° Opposite
(3,4) ↔ (1,2) 10.30° Mostly aligned

Real-world uses

Work and energy Reflection in physics PCA and ML embeddings
Unit Vectors & Normalization Scale a vector to have length 1 while keeping direction.

A unit vector has magnitude 1 and preserves the original direction. Any non-zero vector can be normalized by dividing by its magnitude.

Key formulas & rules

  • •û = u / |u|
  • •|û| = 1 by construction
  • •Standard basis: î = (1,0), ĵ = (0,1), k̂ = (0,0,1)
  • •Unit vector encodes direction only, not magnitude
  • •Two vectors are parallel if they share the same unit vector
  • •Cannot normalize the zero vector

Examples

Input Output Note
u = (3,4) (0.6, 0.8) Divide by 5
u = (1,0) (1, 0) Already unit
u = (0,5,0) (0, 1, 0) Along y-axis
u = (1,1,1) (0.577, 0.577, 0.577) Divide by √3

Real-world uses

Surface normals Directional lighting Game physics

Modes & formulas

1

Addition

• Add or subtract two vectors component by component. • The result is visualized on a 2D graph with the parallelogram construction. • In 3D mode, the z-component is also included.
u + v = (u₁+v₁, u₂+v₂, u₃+v₃)

Vector addition is commutative and associative. Geometrically, it forms the diagonal of the parallelogram spanned by u and v.

2

Dot Product

• Combine two vectors into a single scalar that measures alignment. • The result tells you whether vectors are acute, perpendicular, or obtuse. • The projection of u onto v is also shown.
u · v = u₁v₁ + u₂v₂ + u₃v₃ = |u||v|cos θ

u·v = 0 means perpendicular. u·v > 0 means acute angle. u·v < 0 means obtuse angle.

3

Cross Product

• Only defined in 3D (and 7D). • Produces a third vector perpendicular to both u and v. • The magnitude equals the area of the parallelogram spanned by u and v.
u × v = (u₂v₃−u₃v₂, u₃v₁−u₁v₃, u₁v₂−u₂v₁)

The cross product is anti-commutative. Its direction follows the right-hand rule. If u × v = 0, the vectors are parallel.

4

Magnitude

• Compute the Euclidean length of each vector. • The magnitude is the distance from the origin to the vector's tip. • It generalizes the Pythagorean theorem to any number of dimensions.
|u| = √(u₁² + u₂² + u₃²)

The magnitude is always non-negative. A magnitude of 0 means the zero vector.

5

Angle

• Compute the angle between the vectors using the dot product. • The angle is displayed in degrees, ranging from 0° to 180°. • The projection of one vector onto the other is also calculated.
cos θ = (u·v) / (|u||v|)

The angle is only defined when neither vector has zero magnitude.

How to use it

Choose 2D or 3D mode, select an operation, and enter vector coordinates. The tool displays the result and draws the vectors on a 2D projection graph.

Frequently asked questions

What does it mean for two vectors to be perpendicular?
Their dot product is exactly zero: u·v = 0.
What is a unit vector?
A vector with magnitude 1, obtained by dividing a vector by its own length: û = u / |u|.
What is a vector?
A mathematical object that has both magnitude (length) and direction, commonly used to represent forces, velocities, or displacements.
What is the difference between a vector and a scalar?
A scalar only has magnitude (like temperature or mass), while a vector has both magnitude and direction.
How do you add two vectors?
Add their corresponding components. Geometrically, it is done by placing them head-to-tail to form a parallelogram.
What is the dot product?
Also called the scalar product, it measures how much two vectors point in the same direction. It is calculated as u·v = |u||v|cos(θ).

Related calculators

Read the full Vector Math guide — examples & 18 FAQs