🔢

Vector Calculator

Perform 2D and 3D vector operations — addition, subtraction, dot product, cross product, magnitude, unit vector, angle between vectors and projection. Full step-by-step working with visual diagram.

2D & 3D Step-by-Step
Dimension
Vector a
a = ( , , )
Vector b
b = ( , , )

Vector Operations Reference

OperationFormulaResult Type
Additiona + b = (ax+bx, ay+by, az+bz)Vector
Subtractiona − b = (ax−bx, ay−by, az−bz)Vector
Magnitude|a| = √(ax²+ay²+az²)Scalar
Unit Vectorâ = a / |a|Vector (|â|=1)
Dot Producta·b = ax·bx + ay·by + az·bz = |a||b|cos(θ)Scalar
Cross Producta×b = (ay·bz−az·by, az·bx−ax·bz, ax·by−ay·bx)Vector (3D only)
Angle Betweenθ = arccos(a·b / (|a|·|b|))Scalar (0°–180°)
Projection of a onto bproj_b(a) = (a·b/|b|²)·bVector
Scalar projectioncomp_b(a) = a·b / |b|Scalar

Dot Product vs Cross Product

Dot product (a·b): A scalar that equals |a||b|cos(θ). It measures how much two vectors point in the same direction. If a·b = 0 the vectors are perpendicular (orthogonal). Used to find angles, work done by a force, and vector projections.

Cross product (a×b): Only defined in 3D. Produces a vector perpendicular to both a and b, with magnitude |a||b|sin(θ). The direction follows the right-hand rule. Its magnitude equals the area of the parallelogram spanned by a and b. Used in physics for torque, angular momentum, and surface normals in 3D graphics.

Applications of Vectors

Frequently Asked Questions
The dot product (a·b) produces a scalar equal to |a||b|cos(θ). The cross product (a×b) produces a vector perpendicular to both inputs with magnitude |a||b|sin(θ), and is only defined in 3D. Use the dot product for angles and projection; use the cross product for normals, torque, and finding perpendicular vectors.
Use θ = arccos(a·b / (|a|·|b|)). Compute the dot product, divide by the product of the magnitudes to get cos(θ), then take the inverse cosine. The result is always between 0° and 180°. If the dot product is negative the angle is obtuse (greater than 90°).
A unit vector has magnitude exactly 1 and encodes direction only. To compute â from a, divide each component by the magnitude: â = a / |a|. The three standard unit vectors (î, ĵ, k̂) point along the x, y, z axes. Unit vectors are essential in physics (direction of forces) and 3D graphics (surface normals).
The cross product is strictly a 3D operation. In 2D we treat vectors as 3D with z = 0, giving a×b = (0, 0, ax·by − ay·bx). Only the z-component is non-zero. This scalar ax·by − ay·bx equals the signed area of the parallelogram formed by a and b, and can tell you whether b is to the left or right of a.