Vector Calculator | Dot & Cross Product
Add, subtract, find dot product, cross product, and magnitude of vectors.
Dimensions
Operation
What Is the Vector Calculator | Dot & Cross Product?
A vector is a mathematical object with both magnitude (size) and direction. In 2D space it is represented as (x, y); in 3D as (x, y, z). Vectors are fundamental in physics (forces, velocity, acceleration), computer graphics (normals, lighting), and machine learning (feature embeddings).
The dot product measures alignment: A·B = |A||B|cos θ. A result of 0 means the vectors are perpendicular. The cross product (3D only) produces a new vector perpendicular to both inputs, with magnitude |A||B|sin θ equal to the area of the parallelogram they span.
Right-hand rule for cross products
Formula
Vector Operation Reference (3D)
| Operation | Formula | Result type | Key property |
|---|---|---|---|
| Addition A+B | (ax+bx, ay+by, az+bz) | Vector | Commutative, associative |
| Subtraction A−B | (ax−bx, ay−by, az−bz) | Vector | Not commutative |
| Scalar scale s·A | (s·ax, s·ay, s·az) | Vector | Scales magnitude by |s| |
| Magnitude |A| | √(ax²+ay²+az²) | Scalar | Always ≥ 0 |
| Unit vector  | A / |A| | Vector | |Â| = 1 |
| Dot product A·B | ax·bx + ay·by + az·bz | Scalar | = |A||B|cos θ |
| Cross product A×B | (ay·bz−az·by, az·bx−ax·bz, ax·by−ay·bx) | Vector | = |A||B|sin θ, perpendicular to both |
| Angle between | θ = arccos(A·B / |A||B|) | Scalar° | 0° = parallel, 90° = orthogonal |
How to Use
- 1Select 2D or 3D mode. 2D vectors have (x, y) components; 3D vectors have (x, y, z).
- 2Choose an operation: Addition, Subtraction, Dot Product, Cross Product (3D only), Scalar × A, or Angle Between.
- 3Enter Vector A and Vector B as comma-separated numbers (e.g. "1,2,3"). For Scalar × A, enter the scalar value instead of B.
- 4Click Calculate or press Enter. The main result, magnitudes, and unit vectors appear immediately.
- 5The Vector Properties panel shows |A|, |B|, unit vectors, orthogonality (dot product = 0), and parallelogram area (cross product).
- 6The Step-by-Step Working panel shows the full computation for verification or learning.
- 7Use presets to quickly load common examples like the standard basis vectors i, j, k.
Example Calculation
Example: Cross product of A=(1,0,0) and B=(0,1,0)
Understanding Vector | Dot & Cross Product
Vectors form the mathematical backbone of physics, computer graphics, robotics, and machine learning. In physics, every force, velocity, acceleration, and field is a vector, both the push of a spring and the direction it pushes must be known to predict motion. In graphics, surface normals (perpendicular vectors), lighting direction vectors, and camera orientation are all computed with the same dot and cross product operations this calculator performs.
The dot product A·B = |A||B|cos θ is particularly powerful: it measures how much two vectors "agree" in direction. A value of 0 means perpendicular (orthogonal), a fundamental check in graphics (is this surface facing the light?), in physics (does this force do work on this displacement?), and in machine learning (are these feature vectors unrelated?).
The cross product A×B produces a vector perpendicular to both inputs with magnitude equal to the area of the parallelogram they span. This makes it indispensable for computing surface normals in 3D graphics, torque in physics (τ = r × F), and angular momentum (L = r × p). The anti-commutative property (A×B = −B×A) means order matters, consistent winding order (clockwise vs counter-clockwise) in graphics pipelines relies on this.
In machine learning, high-dimensional vectors (embeddings) represent words, images, and concepts. Cosine similarity, the dot product of unit vectors, is used to measure semantic similarity in NLP models and recommendation systems. This calculator's angle-between operation computes exactly that relationship in 2D and 3D.
Frequently Asked Questions
What is the geometric meaning of the dot product?
The dot product encodes the alignment between two vectors:
- ›A·B > 0: vectors form an acute angle (point in roughly the same direction).
- ›A·B = 0: vectors are perpendicular (orthogonal), no component in common.
- ›A·B < 0: vectors form an obtuse angle (point in roughly opposite directions).
- ›A·B = |A||B|cos θ, so cos θ = (A·B)/(|A||B|) gives the angle between them.
- ›Used in physics for work: W = F·d (only the force component along displacement does work).
Why is the cross product only defined in 3D (and 7D)?
- ›In 2D: no third axis for the result, so a true vector cross product doesn't exist.
- ›2D "cross product" scalar: ax·by − ay·bx (the z-component) gives the signed parallelogram area.
- ›In 4D+: too many perpendicular directions, a unique result can't be defined.
- ›7D is the only other dimension with a cross product (via octonion algebra).
- ›The 3D cross product is unique because exactly one direction is perpendicular to both vectors.
What is a unit vector and why is it useful?
- ›Unit vector  = A / |A|, same direction as A but with magnitude 1.
- ›Normalizing removes scale information, only direction remains.
- ›Used in lighting models (surface normals, light direction vectors must be unit length).
- ›Used in physics: force direction, velocity direction, surface orientation.
- ›The zero vector has no defined unit vector (division by zero).
How is vector addition used in physics?
- ›Force superposition: F_net = F₁ + F₂ + … + Fₙ (Newton's second law).
- ›Velocity addition: relative velocity in different reference frames.
- ›Displacement: total path = Δr₁ + Δr₂ + … regardless of intermediate steps.
- ›Electric fields: superposition principle, E_total is the vector sum of all E fields.
What is the difference between a scalar and a vector quantity?
- ›Scalars: temperature, mass, time, speed, energy, pressure, magnitude only.
- ›Vectors: force, velocity, acceleration, displacement, electric field, magnitude + direction.
- ›Speed = |velocity|: the scalar magnitude of the velocity vector.
- ›Scalar × vector: scales the magnitude; reverses direction if scalar is negative.
- ›Dot product of two vectors → scalar; cross product of two vectors → vector.