Vector Calculator
Enter two vectors (A and B) to compute their magnitudes, unit vectors, sum (A + B), and difference (A - B). Supports 2D and 3D vectors.
A vector is a quantity with both magnitude and direction — distinguishing it from a scalar (just magnitude). Velocity (5 m/s northeast), force (10 N downward), position (3 m east, 4 m up), and acceleration are all vectors. Vectors are foundational in physics, engineering, computer graphics, and any field involving directional quantities.
In 2D, a vector is (x, y). In 3D, (x, y, z). The magnitude (length) is |v| = √(x² + y² + ...) — the Pythagorean theorem extended to any dimension. The direction can be expressed as angles or as a unit vector (vector divided by its magnitude, length 1).
Basic vector operations: - **Addition**: (a₁, a₂, a₃) + (b₁, b₂, b₃) = (a₁+b₁, a₂+b₂, a₃+b₃). Component-wise. - **Subtraction**: similarly component-wise. - **Scalar multiplication**: k × (a₁, a₂, a₃) = (ka₁, ka₂, ka₃). - **Magnitude**: |v| = √(sum of squares). - **Unit vector**: v / |v|. Has magnitude 1.
Two more vector operations are crucial: - **Dot product** (A · B): scalar result. Measures alignment. - **Cross product** (A × B): 3D only. Vector result perpendicular to both.
Common applications: physics (force, velocity, acceleration), engineering (structural analysis), computer graphics (3D positions, rotations), robotics (motion planning), navigation (GPS, course corrections), and any system involving directional quantities.
Inputs
Results
|A|
5
|B|
3
Unit A
(0.6, 0.8, 0)
Unit B
(0.333333, 0.666667, 0.666667)
A + B
(4, 6, 2)
|A + B|
7.483315
A - B
(2, 2, -2)
|A - B|
3.464102
Formula
How to use this calculator
- Choose 2D or 3D vectors.
- Enter components of vectors A and B.
- Calculator returns magnitudes, unit vectors, sum, difference.
- Magnitude = √(sum of squared components).
- Unit vector = vector / magnitude. Always magnitude 1.
- For dot/cross products: use separate calculator.
Worked examples
Force vector resultant
**Scenario:** Three forces on object: F₁ = (10, 0, 0) N, F₂ = (0, 8, 0) N, F₃ = (5, 5, 0) N. Net force? **Calculation:** Sum: (10+0+5, 0+8+5, 0+0+0) = (15, 13, 0). Magnitude: √(225+169) = √394 ≈ 19.85 N. Direction: arctan(13/15) ≈ 40.9° from x-axis. **Result:** Net force ~19.85 N at 40.9° from x-axis. If this is the only force on the object, it accelerates in this direction. To balance: opposite force of same magnitude.
Displacement and direction
**Scenario:** Walk 30 m east, then 40 m north. Total displacement? **Calculation:** Vector: (30, 40). Magnitude: √(900+1600) = √2500 = 50 m. Direction: arctan(40/30) = 53.13° from east. **Result:** End up 50 m from start, in NE direction (53.13° N of E). Classic 3-4-5 triangle (scaled). Total distance walked: 70 m (along path); straight-line distance: 50 m.
Unit vector for direction
**Scenario:** Velocity vector (6, 8, 0) m/s. Express as speed and direction (unit vector). **Calculation:** Magnitude (speed): √(36+64+0) = √100 = 10 m/s. Unit vector: (6/10, 8/10, 0) = (0.6, 0.8, 0). **Result:** Speed 10 m/s in direction (0.6, 0.8, 0). Unit vector points where velocity points but normalized to length 1. Multiplying back by 10 m/s gives original velocity.
When to use this calculator
**Use vector operations for:**
- **Physics**: forces, velocities, accelerations. - **Engineering**: structural loads, mechanical analysis. - **Computer graphics**: 3D positions, rotations. - **Robotics**: end-effector positions. - **Navigation**: GPS coordinates, course corrections. - **Game development**: character movement, projectile physics. - **Animation**: motion vectors, keyframe interpolation. - **Aerospace**: spacecraft attitudes, trajectories.
**Vector vs scalar:**
| Quantity | Vector or Scalar | |---|---| | Speed | Scalar | | Velocity | Vector | | Distance | Scalar | | Displacement | Vector | | Mass | Scalar | | Force | Vector | | Temperature | Scalar | | Electric field | Vector | | Time | Scalar | | Acceleration | Vector |
**Magnitude conversion:**
For 2D: |v| = √(x² + y²). For 3D: |v| = √(x² + y² + z²). For n-D: |v| = √(sum of all squared components).
**Common applications:**
- **Mechanics**: equilibrium analysis (sum of forces = 0). - **Kinematics**: position, velocity, acceleration vectors. - **Electromagnetism**: electric and magnetic fields. - **Quantum mechanics**: state vectors. - **Computer vision**: feature vectors. - **Machine learning**: data points as vectors.
**Resultant of multiple vectors:**
Sum all vectors component-wise: R = V₁ + V₂ + ... + Vₙ.
|R| = magnitude of resultant. Direction = arctan(y/x) for 2D.
**Vector difference applications:**
A - B = displacement from B to A. |A - B| = distance between A and B.
For position vectors: subtraction gives displacement vector.
**Software:**
- **Python NumPy**: numpy arrays as vectors. - **MATLAB**: native vector support. - **JavaScript THREE.js, GL-Matrix**: 3D graphics. - **C++ Eigen**: high-performance vector library. - **Excel**: not specialized, but works for simple operations.
**Pitfalls:**
- **Vector vs scalar confusion**: keep types distinct. - **Component order**: (x, y, z) standard but verify. - **Magnitude always positive**. - **For unit vector of zero**: undefined (division by zero). - **For cross product**: only 3D; gives perpendicular vector. - **For dot product**: scalar result. - **For direction angle**: arctan ambiguous; consider quadrant.
**Vectors in physics:**
Newton's laws use vectors: - F = ma (force and acceleration vectors). - p = mv (momentum vector). - L = r × p (angular momentum, cross product).
Maxwell's equations heavily use vector calculus (gradient, divergence, curl).
**Vectors in computer graphics:**
- Position vectors: object locations. - Normal vectors: surface orientations. - Velocity vectors: motion direction. - Up vectors: camera orientation.
All standard 3D graphics built on vector math.
**Educational notes:**
Vectors introduced in: - High school physics: force vectors. - Pre-calculus: 2D and 3D coordinates. - Calculus III: vector calculus. - Linear algebra: vector spaces. - Physics throughout.
Essential for STEM education.
**Common pitfalls:**
- **Adding magnitudes instead of vectors**: forces don't add scalarly if pointing different ways. - **For perpendicular vectors**: special case (Pythagorean theorem applies). - **For parallel vectors**: simple scalar multiplication. - **For dot product vs scalar multiplication**: different operations.
**Pitfalls (continued):**
- **For very large or small magnitudes**: numerical precision. - **For decomposing into components**: use coordinate system carefully. - **For converting coordinate systems**: ensure correct transformation matrices. - **For unit vector application**: lose magnitude information.
Common mistakes to avoid
- Adding vector magnitudes instead of vector components.
- Confusing magnitude with vector itself (scalar vs vector).
- For zero vector: trying to compute unit vector (undefined).
- For arctan: not considering quadrant.
- Component order errors (mixing up x, y, z).
- For cross product: applying in 2D (not defined).
- Mixing 2D and 3D operations.
- Confusing dot product (scalar) with scalar multiplication.
Frequently Asked Questions
Sources & further reading
Related Calculators
Dot Product Calculator
Calculate the dot product of two vectors in 2D or 3D, plus the angle between them.
Cross Product Calculator
Calculate the cross product of two 3D vectors, including the resulting vector and its magnitude.
2x2 Matrix Calculator
Calculate the determinant, inverse, and product of 2x2 matrices.
Distance Formula Calculator
Calculate the distance between two points on a coordinate plane.