General Math
Vector Calculator: Dot Product, Cross Product & Magnitude
Master vector operations including dot product, cross product, magnitude, unit vectors, and angle between vectors. Complete guide with formulas.
Try it now
Vector Calculator
Calculate dot product, cross product, magnitude, and angle between vectors.
Vectors are the mathematical language of physics, engineering, and computer graphics. Every force, velocity, acceleration, electric field, and displacement in the physical world is naturally represented as a vector — a quantity with both magnitude and direction. Understanding vector operations is essential for anyone working in physics, engineering, game development, robotics, or data science.
Our vector calculator handles all fundamental vector operations for 2D and 3D vectors: addition, subtraction, dot product, cross product, magnitude, unit vectors, and angle between vectors. This guide provides the mathematical foundation so you can understand what these operations mean and when to apply them.
What Is a Vector?
A vector is a mathematical object that has both magnitude (length) and direction. In contrast, a scalar has only magnitude (like temperature or mass). We represent vectors as ordered lists of components:
- 2D vector: v = (vₓ, vᵧ) — components in x and y directions
- 3D vector: v = (vₓ, vᵧ, v_z) — components in x, y, and z directions
Geometrically, a vector is an arrow in space. The components tell you how far the arrow extends in each coordinate direction. Two vectors are equal if they have the same components, regardless of where their “tails” are positioned.
Vector Addition and Subtraction
Adding two vectors combines their components element-wise:
A + B = (a₁+b₁, a₂+b₂, a₃+b₃)
Geometrically, this corresponds to placing the tail of B at the head of A — the result points from A’s tail to B’s head (the “parallelogram rule” or “tip-to-tail” method).
Subtraction works similarly: A − B = (a₁−b₁, a₂−b₂, a₃−b₃). The vector A−B points from the tip of B to the tip of A.
Physical Interpretation
When forces F₁ and F₂ act on an object simultaneously, the net force is F₁ + F₂. When computing relative velocity (velocity of A relative to B), you calculate v_A − v_B.
Magnitude (Length) of a Vector
The magnitude of a vector is its length, computed using the Pythagorean theorem generalized to n dimensions:
|v| = √(v₁² + v₂² + v₃²)
For a 2D vector (3, 4): |v| = √(9 + 16) = √25 = 5 For a 3D vector (1, 2, 2): |v| = √(1 + 4 + 4) = √9 = 3
Magnitude is always non-negative. The only vector with zero magnitude is the zero vector (0, 0, 0). You can compute any vector’s magnitude using our vector calculator by selecting the Magnitude operation.
Unit Vectors
A unit vector has magnitude exactly 1 and points in the same direction as the original vector. To find the unit vector â in the direction of vector a:
â = a / |a|
This operation is called “normalization.” You divide each component by the magnitude:
â = (a₁/|a|, a₂/|a|, a₃/|a|)
Unit vectors are important because they isolate direction from magnitude. The standard basis unit vectors are î = (1,0,0), ĵ = (0,1,0), and k̂ = (0,0,1). Any vector can be written as a linear combination of these: v = vₓî + vᵧĵ + v_zk̂.
The Dot Product (Scalar Product)
The dot product of two vectors produces a scalar (a single number):
A · B = a₁b₁ + a₂b₂ + a₃b₃
Alternatively: A · B = |A| |B| cos(θ)
Where θ is the angle between the vectors.
Properties and Applications
- Testing orthogonality: A · B = 0 if and only if A and B are perpendicular.
- Finding angles: cos(θ) = (A · B) / (|A| |B|), so θ = arccos(A·B / |A||B|).
- Projection: The scalar projection of A onto B is (A · B) / |B|.
- Work in physics: W = F · d (force dot displacement).
The dot product is commutative (A·B = B·A) and distributive over addition (A·(B+C) = A·B + A·C).
Example
A = (2, 3, 1), B = (4, -1, 2) A · B = 2(4) + 3(-1) + 1(2) = 8 - 3 + 2 = 7
Since A·B > 0, the angle between them is acute (less than 90°).
The Cross Product (Vector Product)
The cross product of two 3D vectors produces a new vector perpendicular to both inputs:
A × B = (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁)
The magnitude of the cross product equals |A||B|sin(θ), representing the area of the parallelogram formed by the two vectors.
Properties
- Anti-commutativity: A × B = −(B × A). Order matters!
- Zero for parallel vectors: If A ∥ B, then A × B = 0 (sin(0°) = 0).
- Perpendicularity: The result is always perpendicular to both inputs.
- Not defined in 2D: Cross product only exists for 3D vectors.
- Not associative: (A × B) × C ≠ A × (B × C) in general.
Direction (Right-Hand Rule)
Point your fingers in the direction of A, curl them toward B — your thumb points in the direction of A × B. This right-hand rule determines which of the two perpendicular directions the cross product points.
Example
A = (1, 2, 3), B = (4, 5, 6) A × B = (2×6−3×5, 3×4−1×6, 1×5−2×4) = (12−15, 12−6, 5−8) = (−3, 6, −3)
Verify: A · (A×B) = 1(-3)+2(6)+3(-3) = -3+12-9 = 0 ✓ (perpendicular to A)
Our vector calculator computes cross products instantly and shows the resulting magnitude.
Angle Between Two Vectors
The angle θ between vectors A and B is found using the dot product relationship:
θ = arccos(A · B / (|A| · |B|))
This formula works for both 2D and 3D vectors and always returns an angle between 0° and 180°.
Example
A = (1, 0, 0), B = (1, 1, 0) A·B = 1(1) + 0(1) + 0(0) = 1 |A| = 1, |B| = √2 cos(θ) = 1/(1×√2) = 1/√2 θ = arccos(1/√2) = 45°
Applications of Vector Operations
Physics
- Forces: Net force is the vector sum of all individual forces
- Torque: τ = r × F (cross product of position and force)
- Work: W = F · d (dot product of force and displacement)
- Magnetic force: F = qv × B (charge × velocity cross magnetic field)
Computer Graphics
- Surface normals: Cross product of two edge vectors gives the normal for lighting calculations
- Backface culling: Dot product of view direction and surface normal determines visibility
- Reflections: Reflection vector = v − 2(v·n)n where n is the unit surface normal
Robotics
- Inverse kinematics: Joint angles calculated using vector projections and cross products
- Path planning: Direction vectors guide movement trajectories
- Force sensing: Decomposing forces into components along different axes
Navigation
- GPS calculations: 3D position vectors on Earth’s surface
- Aircraft heading: Direction vectors relative to North, with wind correction via vector addition
- Bearing between points: Angle calculations using dot product formula
Vector Spaces and Linear Independence
Vectors also form the foundation of abstract linear algebra. A set of vectors is “linearly independent” if none can be written as a combination of the others. The maximum number of linearly independent vectors in a space defines its dimension.
In 3D space, you need exactly three linearly independent vectors to form a basis — any other vector can then be expressed as a linear combination of these three. The standard basis {î, ĵ, k̂} is the simplest choice, but infinitely many valid bases exist.
Common Mistakes with Vectors
-
Cross product in 2D: The cross product is only defined for 3D vectors. For 2D vectors, you can compute the “scalar cross product” a₁b₂−a₂b₁ (which gives the z-component if you extend to 3D with z=0).
-
Dot product vs multiplication: A·B is NOT element-wise multiplication. It sums the products: a₁b₁+a₂b₂+a₃b₃, yielding a scalar.
-
Cross product order: A×B ≠ B×A. Reversing the order negates the result.
-
Unit vector of zero vector: The zero vector (0,0,0) has no unit vector because you cannot divide by zero magnitude.
-
Angle range: arccos always returns 0° to 180°. If you need a signed angle (e.g., clockwise vs counterclockwise), you need additional information like the cross product’s direction.
Working with Vectors Effectively
Start by sketching vectors to build geometric intuition. A vector (3, 4) points to the upper right; (−1, 2) points to the upper left. Visualization helps catch sign errors and verify results make physical sense.
When solving physics problems, always draw a free-body diagram with all vectors shown. Decompose vectors into components along convenient axes (often horizontal/vertical or along/perpendicular to a surface). Then apply vector operations component-wise.
For the computational work, our vector calculator eliminates arithmetic errors and lets you focus on setting up problems correctly and interpreting results physically.
OurDailyCalc Team
OurDailyCalc — beautiful tools for everyday calculations.