Vector Calculator
Perform vector operations for 2D and 3D vectors. Calculate magnitude, add or subtract vectors component-wise, or multiply by a scalar. Get the result vector, its magnitude, and direction angles.
Vectors are mathematical objects with both magnitude and direction. They are fundamental in physics, engineering, and computer graphics. A vector in 2D is defined by two components (x, y), and in 3D by three components (x, y, z).
The magnitude (or length) of a vector v = (x, y, z) is calculated as |v| = sqrt(x² + y² + z²). Vector addition and subtraction are performed component-wise: (a, b, c) + (d, e, f) = (a+d, b+e, c+f). Scalar multiplication scales every component: k(a, b, c) = (ka, kb, kc).
Direction angles are the angles that a vector makes with the positive coordinate axes. For a 3D vector, these are alpha (angle with x-axis), beta (angle with y-axis), and gamma (angle with z-axis), computed as cos(alpha) = x/|v|, cos(beta) = y/|v|, cos(gamma) = z/|v|.