Vector Calculator
Enter two vectors and get the sum, difference, dot and cross product, magnitudes, unit vector, angle and projection.
Vector calculator (2D and 3D)
Formulas
| Quantity | Formula |
|---|---|
| Magnitude | |A| = √(a₁² + a₂² + a₃²) |
| Dot product | A · B = a₁b₁ + a₂b₂ + a₃b₃ = |A||B| cos θ |
| Cross product (3D) | A × B = (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁) |
| Angle | θ = cos−1[(A · B)/(|A||B|)] |
| Unit vector | â = A/|A| |
| Projection of A on B | [(A · B)/|B|²] B |
Worked example
A = (1, 2, 3), B = (4, −1, 2). A · B = 4 − 2 + 6 = 8. A × B = (2·2 − 3·(−1), 3·4 − 1·2, 1·(−1) − 2·4) = (7, 10, −9). |A| = √14 ≈ 3.7417.
What the dot and cross product tell you
The dot product gives a single number and measures how much two vectors point the same way. If it is zero, the vectors are perpendicular. For example, (2, 3) · (−3, 2) = −6 + 6 = 0, so those two vectors meet at a right angle. The cross product gives a new vector perpendicular to both, and its length equals the area of the parallelogram the two vectors form.
Worked examples
- Angle between vectors: A = (1, 0, 0) and B = (1, 1, 0). A · B = 1, |A| = 1, |B| = √2, so cos θ = 1/√2 and θ = 45°.
- Area from a cross product: A = (3, 0, 0) and B = (0, 4, 0) give A × B = (0, 0, 12). The parallelogram has area 12 and the triangle on the same two sides has area 6.
- Work done by a force: W = F · d. With F = (10, 5) N and displacement d = (3, 4) m, W = 30 + 20 = 50 J.
- Projection: the projection of A = (3, 4) onto B = (1, 0) is [(A · B)/|B|²] B = 3 × (1, 0) = (3, 0), the part of A that lies along the x-axis.
Physics situations where each one appears
Work and power use the dot product, since only the part of a force along the motion does work. Torque (τ = r × F) and the magnetic force on a moving charge use the cross product. Resolving a force into components is a projection. Whenever a physics formula contains a “cos θ”, a dot product is usually hiding behind it, and a “sin θ” usually means a cross product.
Mistakes to avoid
- The cross product is not commutative: A × B = −(B × A). Swapping the order flips the direction.
- The dot product needs vectors with the same number of components, and the standard cross product exists only in 3D. For 2D input the tool shows the single z-component.
- Angle formulas give degrees or radians depending on the setting, so check which one your problem expects.
FAQ
How do I find the dot product?
Multiply matching components and add them. For (1,2,3) and (4,-1,2) it is 1*4 + 2*(-1) + 3*2 = 8.
What does the cross product give?
A vector perpendicular to both A and B, defined in 3D. Its length is the area of the parallelogram they span.
How do I enter a 2D vector?
Type two numbers such as 3, 4. For 2D vectors Calvo shows the scalar z-part of the cross product.
How is the angle found?
From the dot product: the angle is the inverse cosine of A dot B divided by the product of the magnitudes.
What if a vector is zero?
Angle, unit vector and projection are undefined for a zero vector, and Calvo tells you so.
How do I know two vectors are parallel?
Their cross product is the zero vector, or one vector is a constant multiple of the other. For example (2, 4, 6) and (1, 2, 3) are parallel.
What is a unit vector used for?
It keeps only the direction. Dividing a vector by its magnitude gives a vector of length 1, useful for describing directions such as the axis of a force.