Advertisement

Free Online Vector Calculator

Add vectors and calculate dot products, cross products, and angles.

Vector a

Vector b

Enter the components of each vector. Empty cells are treated as zero. The cross product is a vector in 3D and a signed scalar (the z-component) in 2D.

a + b
—
Component-wise addition
a − b
—
Component-wise subtraction
|a|
—
Magnitude of a
|b|
—
Magnitude of b
Unit vector of a
—
a divided by |a|
Dot product
—
a · b
Cross product
—
a × b
Angle between
—
Degrees

Step-by-step working

  1. Enter vector components to see the calculations.
Advertisement

About the Vector Calculator

A vector carries both size and direction. In two dimensions it has x and y components; in three dimensions it adds z. This calculator takes two vectors and returns their sum, difference, magnitudes, the unit vector of the first, the dot product, the cross product and the angle between them. It is useful for physics, engineering, computer graphics, navigation and linear algebra homework, and each result includes the working so the method is visible.

Addition, subtraction and magnitude

Vector addition combines matching components: the x of the sum is the sum of the x components, and similarly for y and z. Subtraction follows the same rule with a minus sign. Geometrically, the sum is the diagonal of the parallelogram formed by the two vectors. Magnitude is the length of the arrow, calculated with the Pythagorean theorem: |a| = √(x² + y² + z²). A unit vector keeps the direction but has length one, and is found by dividing each component by the magnitude. A zero vector has no unit vector because division by zero is undefined.

Dot product and the angle

The dot product multiplies matching components and adds the results: a · b = aₓbₓ + aₒbₒ + a𔗩b𔗩. It relates to the angle by a · b = |a||b|cos θ, so the angle is θ = arccos((a · b) / (|a||b|)). A dot product of zero means the vectors are perpendicular. A positive dot product means the angle is less than 90 degrees, and a negative one means it is greater. The calculator guards against zero-length vectors, where the angle is undefined.

Cross product in 3D and 2D

In three dimensions the cross product produces a new vector perpendicular to both inputs. Its components are (aₒb𔗩 − a𔗩bₒ, a𔗩bₓ − aₓb𔗩, aₓbₒ − aₒbₓ). The magnitude equals |a||b|sin θ and equals the area of the parallelogram spanned by the vectors. In two dimensions the result is a single signed scalar, the z-component of the 3D cross product; its sign indicates clockwise or counterclockwise orientation.

Reading and using the results

Components are rounded for display, but calculations use full precision. Very small values near zero may appear as tiny numbers instead of exact zero because of floating-point arithmetic. Use the dot and cross products together to test whether vectors are parallel or perpendicular, to find a normal vector for a plane, or to compute torque and angular momentum. The angle is reported in degrees because that is the most common unit in navigation and general physics; convert to radians by multiplying by π/180 if needed.

Frequently asked questions

What happens if one vector has zero length?

The magnitude is zero, the unit vector is undefined, and the angle is undefined because the formula divides by zero. The dot product and cross product still compute, but the angle card shows a dash and explains why.

Is the cross product commutative?

No. Swapping the vectors reverses the sign: b × a = −(a × b). The magnitude stays the same, but the direction points the opposite way under the right-hand rule.

Why does the 2D cross product give a scalar?

Two vectors in the xy-plane span a parallelogram whose oriented area is a single number. That number is the z-component of the 3D cross product when both vectors have z = 0. It is signed, so it also tells you the rotation direction.

Sponsored
Find a bug? Report now