Vector Calculator

Vector 1

Vector 2

Operations

Result

Worked example

Set 3D mode with v1 = (1, 2, 2) and v2 = (2, -1, 2).

Magnitude: |v1| = √(1² + 2² + 2²) = √(1+4+4) = √9 = 3. |v2| = √(2² + (-1)² + 2²) = √(4+1+4) = √9 = 3 — both vectors happen to have length 3, a deliberately clean example.

Dot product: v1 · v2 = (1×2) + (2×-1) + (2×2) = 2 - 2 + 4 = 4.

Cross product: using (v1.y·v2.z − v1.z·v2.y, v1.z·v2.x − v1.x·v2.z, v1.x·v2.y − v1.y·v2.x): x = (2×2) − (2×-1) = 4+2 = 6; y = (2×2) − (1×2) = 4-2 = 2; z = (1×-1) − (2×2) = -1-4 = -5. Result: (6, 2, -5). As a check, the cross product should be perpendicular to both inputs — v1 · (6,2,-5) = 1(6)+2(2)+2(-5) = 6+4-10 = 0, confirming perpendicularity.

Angle between vectors: cos θ = (v1 · v2) / (|v1| × |v2|) = 4 / (3 × 3) = 0.4444. θ = arccos(0.4444) ≈ 1.110 radians ≈ 63.6°.

2D mode versus 3D mode

Switching to 2D mode hides the z-input and locks it to 0 internally — every formula above still runs, just with a zero z-component, which is why 2D magnitude, dot product, and angle calculations are really 3D calculations operating in a flat plane. The cross product button is hidden in 2D mode because a true cross product isn't defined the same way in two dimensions.

Normalization and zero vectors

Normalizing divides each component by the vector's magnitude, producing a unit vector of length 1 pointing the same direction. Since this means dividing by |v|, the zero vector (0,0,0) has no defined direction to normalize toward, and the tool returns an explicit error rather than a divide-by-zero result.