Vector Calculator

Add, subtract and scale 2D and 3D vectors, find magnitude, direction and unit vectors, and calculate dot products, cross products and the angle between vectors, step by step.

Dimension

Vector addition: add matching components. Cross product is available in 3D mode.

Vector A

A = (3, 4) = 3i + 4j

Vector B

B = (1, 2) = i + 2j

Angle unit

Try an example

A + B

(4, 6)
Unit-vector notation
4i + 6j
Magnitude |A + B|
2√13 ≈ 7.2111
Unit vector
(2, 3)/√13 ≈ (0.5547, 0.8321)
Direction θ
≈ 56.3099°, in Quadrant I

Step-by-Step Solution

  1. Step 1 — Add corresponding components

    Add the x-components together, then the y-components.

    A + B = (a₁ + b₁, a₂ + b₂)

    = (3 + 1, 4 + 2)

    = (4, 6)

Vector diagram

Vector diagramVectors drawn on the xy-plane: A = (3, 4); B = (1, 2); A + B = (4, 6). B is also drawn from the tip of A, showing tip-to-tail addition.−55−55xyA (3, 4)B (1, 2)A + B (4, 6)
A = (3, 4)B = (1, 2)A + B = (4, 6)Tip-to-tail: the dashed copy of B starts at the tip of A, and A + B runs from the origin to its end.

Vector formulas

AdditionA + B = (a₁ + b₁, a₂ + b₂, a₃ + b₃)
SubtractionA − B = (a₁ − b₁, a₂ − b₂, a₃ − b₃)
Scalar multiplekA = (ka₁, ka₂, ka₃), |kA| = |k||A|
Magnitude (2D)|A| = √(a₁² + a₂²)
Magnitude (3D)|A| = √(a₁² + a₂² + a₃²)
Unit vector = A / |A|, A ≠ 0
Direction (2D)θ = atan2(a₂, a₁)
Direction cosines (3D)cos α = a₁/|A|, cos β = a₂/|A|, cos γ = a₃/|A|
Dot productA · B = a₁b₁ + a₂b₂ + a₃b₃ = |A||B| cos θ
Angle betweenθ = cos⁻¹((A · B) / (|A||B|)), 0° ≤ θ ≤ 180°
Cross product (3D)A × B = (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁)
Cross product magnitude|A × B| = |A||B| sin θ (area of the parallelogram)

A = (a₁, a₂, a₃) and B = (b₁, b₂, b₃). For 2D vectors, leave out the third component. The cross product as a determinant:

        | i   j   k  |
A × B = | a₁  a₂  a₃ |
        | b₁  b₂  b₃ |

The length of B − A is the distance between two points, which the Distance Formula Calculator finds directly, and the direction of a 2D vector is closely related to the Slope Calculator. A 2D vector (a, b) behaves like the complex number a + bi, as the Complex Number Calculator shows on the complex plane. For solving linear systems, determinants and transformations, use the Matrix Calculator, and for trigonometry with the angles found here, the Triangle Calculator or the Scientific Calculator.

This vector calculator works with 2D and 3D vectors in component form, such as A = (3, 4) or A = (1, 2, 3). Enter the x-, y- and z-components, choose an operation, and the calculator shows the result with every step of the working: vector addition and subtraction, scalar multiplication, magnitude and direction, unit vector, dot product, angle between vectors, and, for 3D vectors, the cross product.

Exact answers are kept where possible, so the magnitude of (1, 1) is shown as √2 ≈ 1.4142 and the unit vector of (3, 4) as (3/5, 4/5). In 2D, a vector diagram draws A, B and the result from the origin, including tip-to-tail addition, so you can see what each operation does geometrically.

Worked Calculation Examples

ScenarioResultCalculation Step
Addition: (3, 4) + (1, 2)(4, 6)A + B = (a₁ + b₁, a₂ + b₂) = (3 + 1, 4 + 2) = (4, 6).
Subtraction: (5, 7) − (2, 3)(3, 4)A − B = (a₁ − b₁, a₂ − b₂) = (5 − 2, 7 − 3) = (3, 4).
Magnitude of (3, 4)|A| = 5|A| = √(3² + 4²) = √(9 + 16) = √25 = 5.
Unit vector of (3, 4)(3/5, 4/5) = (0.6, 0.8)|A| = 5, so  = A/|A| = (3/5, 4/5) = (0.6, 0.8). Check: √(0.6² + 0.8²) = √1 = 1.
Dot product: (3, 4) · (1, 2)11A · B = (3 × 1) + (4 × 2) = 3 + 8 = 11. The result is a scalar. With |A| = 5 and |B| = √5, the angle between them is cos⁻¹(11/(5√5)) ≈ 10.30°.
Cross product: (1, 2, 3) × (4, 5, 6)(−3, 6, −3)x: 2·6 − 3·5 = −3. y: 3·4 − 1·6 = 6. z: 1·5 − 2·4 = −3. Check: (−3, 6, −3) · (1, 2, 3) = −3 + 12 − 9 = 0, so the result is perpendicular to A (and likewise to B).

What Is a Vector?

A vector is a quantity with both a magnitude (size) and a direction. It is drawn as an arrow: the length of the arrow is the magnitude and the way it points is the direction.

In component form, a vector is written as the distance it moves along each axis. A = (3, 4) means 3 units in the x-direction and 4 units in the y-direction; 3 is the x-component and 4 is the y-component. Its length is √(3² + 4²) = 5, and it points at about 53.13° above the positive x-axis. A 3D vector adds a z-component, such as (1, 2, 3).

Scalar vs Vector

A scalar has magnitude only: a single number such as 5, a mass of 10 kg, a time of 20 seconds, or a speed of 60 km/h. A vector has magnitude and direction: displacement (5 m north), velocity (60 km/h east), force and acceleration are all vectors.

The difference matters when combining them. Two walks of 3 m and 4 m add up to 7 m of distance (scalars), but if one is east and the other north, the displacement (a vector) is only 5 m.

Vector Notation: Components and i, j, k

The same vector can be written in component form or in unit-vector notation. In 2D, A = (x, y) = xi + yj, and in 3D, A = (x, y, z) = xi + yj + zk. Here i, j and k are the unit vectors of length 1 along the x-, y- and z-axes, so (3, 4) = 3i + 4j and (1, −2, 5) = i − 2j + 5k.

Unit-vector notation is common in physics and engineering textbooks, and it makes the component-by-component rules easy to see: (3i + 4j) + (i + 2j) = 4i + 6j.

Adding, Subtracting and Scaling Vectors

To add vectors, add matching components: (3, 4) + (1, 2) = (4, 6). Geometrically, place the tail of B at the tip of A; A + B is the arrow from the start of A to the end of B (the tip-to-tail rule).

To subtract, subtract matching components: (5, 7) − (2, 3) = (3, 4). A − B is the arrow from the tip of B to the tip of A, which is why the distance between two points is the magnitude of their difference.

Multiplying by a scalar k multiplies every component: 3(2, −4) = (6, −12). The length is multiplied by |k|, and a negative k reverses the direction.

Dot Product and the Angle Between Vectors

The dot product multiplies matching components and adds the results: (3, 4) · (1, 2) = 3 × 1 + 4 × 2 = 11. The answer is a scalar, not a vector.

It is also equal to |A||B| cos θ, where θ is the angle between the vectors, so θ = cos⁻¹((A · B)/(|A||B|)). For (3, 4) and (1, 2), cos θ = 11/(5√5) ≈ 0.9839 and θ ≈ 10.30°. The sign tells you the type of angle at a glance: positive means acute, negative means obtuse, and a dot product of 0 means the vectors are perpendicular.

Cross Product of 3D Vectors

The cross product A × B of two 3D vectors is a vector perpendicular to both of them. It is found from the determinant with i, j, k in the first row and the components of A and B below: A × B = (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁). For (1, 2, 3) × (4, 5, 6) the result is (−3, 6, −3).

Its length |A||B| sin θ equals the area of the parallelogram formed by A and B, and its direction follows the right-hand rule. Order matters: B × A = −(A × B). If A and B are parallel, the cross product is the zero vector.

Where Vector Calculations Are Used

In physics and mechanics, forces, velocities and accelerations are vectors: resultant forces are vector sums, and work is the dot product of force and displacement. Torque is a cross product. Engineers resolve loads into components when analysing structures.

In computer graphics, 3D modelling and game development, unit vectors give directions, dot products drive lighting and visibility checks, and cross products give surface normals. Robotics and navigation use vectors for positions, headings and motion planning.

How to Use the Vector Calculator

  1. Choose 2D for vectors with x- and y-components, or 3D to add a z-component.
  2. Enter the components of Vector A. The preview shows it in component form, such as A = (3, 4), and in unit-vector notation, 3i + 4j.
  3. Select the operation: add, subtract, scalar multiple, magnitude and direction, unit vector, dot product, angle between vectors, or (in 3D) cross product.
  4. Enter Vector B when the operation needs two vectors, or the scalar k for a scalar multiple. The result updates as you type.
  5. Read the result and the step-by-step working. Pick degrees or radians for any angle.
  6. In 2D, use the vector diagram to see A, B and the result drawn from the origin, including tip-to-tail addition and subtraction.

Frequently Asked Questions

What is a vector?

A quantity with both magnitude and direction, written in component form such as (3, 4) or (1, 2, 3). Each component is how far the vector moves along one axis, and the magnitude is its length.

How do you add two vectors?

Add the matching components: (a₁, a₂) + (b₁, b₂) = (a₁ + b₁, a₂ + b₂). For example, (3, 4) + (1, 2) = (4, 6). On a diagram, place B tip-to-tail after A; the sum runs from the start of A to the end of B.

How do you subtract vectors?

Subtract each component of B from the matching component of A: (5, 7) − (2, 3) = (3, 4). A − B points from the tip of B to the tip of A, and A − B is not the same as B − A: they have opposite directions.

How do you find the magnitude of a vector?

Square each component, add the squares and take the square root: |A| = √(x² + y²) in 2D or √(x² + y² + z²) in 3D. |(3, 4)| = √25 = 5, and |(2, 3, 6)| = √49 = 7.

What is a unit vector?

A vector of length 1 that shows direction only. You find it by dividing a vector by its magnitude, Â = A/|A|. The unit vector of (3, 4) is (3/5, 4/5) = (0.6, 0.8). The zero vector has no unit vector, because its magnitude is 0.

How do you calculate the dot product?

Multiply matching components and add: A · B = a₁b₁ + a₂b₂ (+ a₃b₃ in 3D). (3, 4) · (1, 2) = 3 + 8 = 11. The result is a scalar, and it is 0 exactly when the vectors are perpendicular (or one is zero).

What is the cross product?

An operation on two 3D vectors that gives a third vector perpendicular to both: A × B = (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁). Its length equals the area of the parallelogram formed by A and B. (1, 2, 3) × (4, 5, 6) = (−3, 6, −3).

How do you find the angle between two vectors?

Use θ = cos⁻¹((A · B)/(|A||B|)). For A = (1, 0) and B = (1, 1): A · B = 1, |A| = 1, |B| = √2, so cos θ = 1/√2 and θ = 45°. The angle is always between 0° and 180°, and it is undefined if either vector is the zero vector.

What is the difference between a scalar and a vector?

A scalar is a single number with magnitude only, such as mass, time or temperature. A vector also has a direction, such as displacement, velocity or force. The dot product of two vectors is a scalar; the sum, difference and cross product are vectors.

Can this calculator handle 2D and 3D vectors?

Yes. Choose 2D or 3D at the top. Every operation works in both, except the cross product, which is defined for 3D vectors. To take the cross product of two 2D vectors, enter them in 3D with z = 0; the result points along the z-axis.

How do you find the direction of a vector?

In 2D, the direction angle is θ = atan2(y, x), measured counterclockwise from the positive x-axis. For (3, 4), θ ≈ 53.13°; for (−3, −4), θ ≈ −126.87°, in Quadrant III. A 3D vector has no single direction angle; its direction cosines x/|A|, y/|A| and z/|A| give the angles to each axis.

Last updated: September 27, 2026.