Vector Calculator — Free 2D/3D Vector Addition, Dot & Cross Product 2026 | AllInOneTools
→ Free Calculator

Vector Calculator

Perform vector addition, subtraction, dot product, cross product, magnitude, unit vector, angle, and projection in 2D or 3D with interactive visualization.

Vector Operations
Operation:
Dimension:
VECTOR A
VECTOR B
A+B = (a₁+b₁, a₂+b₂)| A·B = Σaᵢbᵢ| |A| = √Σaᵢ²
Result
--
|A|
--
|B|
--
A · B
--
Angle
--
|A×B|
--
Operation
--
Vector Properties Reference
PropertyVector AVector BResult
💡 Insight

Related Math Tools

Vectors: The Complete Guide

What Is a Vector?

A vector is a mathematical object with both magnitude (length) and direction. Unlike scalars (plain numbers like 5 or −3.2), vectors carry directional information. In 2D, a vector is represented as A = (a₁, a₂); in 3D, as A = (a₁, a₂, a₃). Vectors describe forces, velocities, displacements, electric fields, and gradients. The standard basis vectors are î = (1,0,0), ĵ = (0,1,0), and k̂ = (0,0,1), so any vector A = a₁î + a₂ĵ + a₃k̂.

A = (a₁, a₂, a₃) = a₁î + a₂ĵ + a₃k̂
|A| = √(a₁² + a₂² + a₃²)
 = A / |A| (unit vector)

Vector Addition and Subtraction

Vector addition adds corresponding components: A + B = (a₁+b₁, a₂+b₂, a₃+b₃). Geometrically, this is the "tip-to-tail" method: place vector B's tail at vector A's head, and the sum points from A's tail to B's head. This also forms the diagonal of the parallelogram formed by A and B. Subtraction reverses B first: A − B = A + (−B) = (a₁−b₁, a₂−b₂, a₃−b₃). Vector addition is commutative (A+B = B+A) and associative ((A+B)+C = A+(B+C)).

Example
A = (3, 4), B = (1, 5).
A + B = (3+1, 4+5) = (4, 9).
A − B = (3−1, 4−5) = (2, −1).

Dot Product (Scalar Product)

The dot product A·B = a₁b₁ + a₂b₂ + a₃b₃ produces a scalar. Geometrically, A·B = |A||B|cos(θ), where θ is the angle between the vectors. Key properties: if A·B = 0, the vectors are perpendicular (orthogonal). If A·B > 0, they point in roughly the same direction; if A·B < 0, roughly opposite directions. The dot product is used in projection, work calculations (W = F·d), lighting computations in computer graphics (Lambert's cosine law), and determining orthogonality in linear algebra.

A · B = a₁b₁ + a₂b₂ + a₃b₃ = |A||B|cos(θ)
θ = arccos(A·B / (|A||B|))
Perpendicular when A·B = 0

Cross Product (Vector Product)

The cross product A × B is defined only in 3D and produces a vector perpendicular to both A and B. The formula is A×B = (a₂b₃−a₃b₂, a₃b₁−a₁b₃, a₁b₂−a₂b₁). Its magnitude |A×B| = |A||B|sin(θ), which equals the area of the parallelogram formed by A and B. The direction follows the right-hand rule: curl fingers from A to B, and your thumb points in the direction of A×B. The cross product is anti-commutative: A×B = −(B×A).

Magnitude and Unit Vectors

The magnitude (or norm) of vector A is |A| = √(a₁² + a₂² + a₃²), which is the length of the vector. A unit vector has magnitude exactly 1 and preserves direction: Â = A/|A|. Unit vectors are essential for specifying directions without magnitude. Every non-zero vector can be decomposed as A = |A|·Â (magnitude × direction). The zero vector (0,0,0) has magnitude 0 and no defined direction.

Angle Between Vectors

The angle between two vectors is found using θ = arccos(A·B / (|A||B|)). The result is always between 0° and 180°. At 0°, vectors are parallel (same direction); at 90°, perpendicular; at 180°, antiparallel (opposite directions). This formula works in any dimension. In machine learning, the cosine similarity cos(θ) = A·B / (|A||B|) measures how similar two vectors are, widely used in text analysis and recommendation systems.

Scalar Multiplication and Projection

Scalar multiplication kA = (ka₁, ka₂, ka₃) scales a vector by factor k. If k > 1, the vector stretches; if 0 < k < 1, it shrinks; if k < 0, it reverses direction. The scalar projection of A onto B is comp_B(A) = A·B/|B|, which gives the signed length of A's shadow on B. The vector projection is proj_B(A) = (A·B/|B|²)B, a vector along B representing A's component in B's direction.

Pro Tip
To check if your cross product is correct, verify that A×B is perpendicular to both A and B by computing (A×B)·A and (A×B)·B — both should equal zero. This is a quick sanity check for 3D vector calculations.

Vectors in Physics and Engineering

Vectors are the language of physics. Force, velocity, acceleration, momentum, and electric/magnetic fields are all vector quantities. Newton's second law F = ma is a vector equation. The work done by a force is W = F·d (dot product). Torque is τ = r × F (cross product). In electromagnetism, Maxwell's equations use vector calculus extensively. In computer graphics, vectors define positions, normals, lighting directions, and camera orientations. In machine learning, data points are represented as high-dimensional vectors.

Vectors in Computer Science

Beyond mathematics, vectors power modern technology. In computer graphics, every vertex, normal, and ray is a vector. In machine learning, word embeddings (Word2Vec, GPT) represent words as high-dimensional vectors where cosine similarity captures semantic meaning. In game development, physics engines use vectors for collision detection, projectile motion, and camera controls. In data science, feature vectors describe data points, and operations like dot products underpin neural network computations.

How to Use This Calculator

Choose an operation (Addition, Subtraction, Dot Product, Cross Product, Magnitude, Unit Vector, Angle, or Scalar Multiplication). Select 2D or 3D mode. Enter vector components and click Calculate. For single-vector operations (Magnitude, Unit Vector), only Vector A is needed. For Cross Product, 3D mode is automatically selected. The visualization shows vectors on a coordinate grid with labeled axes, and the step-by-step section walks through every calculation.

Common Mistake
The cross product is NOT commutative: A×B ≠ B×A. In fact, A×B = −(B×A). Also, the cross product is only defined in 3D — there is no cross product in 2D. The dot product, however, works in any dimension and always produces a scalar (not a vector).

Frequently Asked Questions

How do you add two vectors?
Add corresponding components: (3,4) + (1,5) = (4,9). Geometrically, place B at A's tip — the sum runs from A's tail to B's tip.
What is the dot product?
A·B = a₁b₁+a₂b₂+a₃b₃ = |A||B|cos(θ). It produces a scalar. If A·B=0, vectors are perpendicular.
What is the cross product?
A×B produces a 3D vector perpendicular to both. A×B = (a₂b₃−a₃b₂, a₃b₁−a₁b₃, a₁b₂−a₂b₁). |A×B| = |A||B|sin(θ).
How to find vector magnitude?
|A| = √(a₁² + a₂² + a₃²). For (3,4): |A| = √(9+16) = 5. Always non-negative.
What is a unit vector?
 = A/|A|, magnitude = 1, same direction. For (3,4):  = (0.6, 0.8).
How to find the angle between vectors?
θ = arccos(A·B / (|A|·|B|)). Result: 0°–180°. Perpendicular = 90°, parallel = 0°.
What is scalar projection?
comp_B(A) = A·B/|B|. It's the signed length of A's shadow onto B. Vector projection is proj_B(A) = (A·B/|B|²)×B.
Dot product vs cross product?
Dot → scalar, measures parallelism, any dimension. Cross → vector, measures perpendicularity, 3D only. A·B = |A||B|cos(θ), |A×B| = |A||B|sin(θ).