Vector Calculator

Vector A

Vector B

Leave z-component empty for 2D vectors. For cross product, z defaults to 0 if empty.


Add this Calculator to Your Site

What are Vectors?

A vector is a mathematical object that has both magnitude (size) and direction. Vectors are represented as ordered lists of numbers, typically written as (x, y) for 2D or (x, y, z) for 3D. They are fundamental in physics, engineering, computer graphics, and many other fields.

Vector Operations and Formulas

Vector Addition

Add corresponding components:

A + B = (a1 + b1, a2 + b2, a3 + b3)

Vector Subtraction

Subtract corresponding components:

A - B = (a1 - b1, a2 - b2, a3 - b3)

Dot Product (Scalar Product)

Multiply corresponding components and sum:

A . B = a1*b1 + a2*b2 + a3*b3

The result is a scalar (single number). It equals |A||B|cos(theta) where theta is the angle between vectors.

Cross Product (Vector Product)

Produces a vector perpendicular to both inputs:

A x B = (a2*b3 - a3*b2, a3*b1 - a1*b3, a1*b2 - a2*b1)

The magnitude equals |A||B|sin(theta).

Magnitude (Length)

The length of a vector:

|A| = sqrt(a1^2 + a2^2 + a3^2)

Angle Between Vectors

Using the dot product relationship:

theta = arccos((A . B) / (|A| * |B|))

Example Calculations

Example 1: Vector Addition

A = (3, 4, 2) and B = (1, -2, 5)

A + B = (3+1, 4+(-2), 2+5) = (4, 2, 7)

Example 2: Dot Product

A = (2, 3) and B = (4, -1)

A . B = 2*4 + 3*(-1) = 8 - 3 = 5

Example 3: Cross Product

A = (1, 2, 3) and B = (4, 5, 6)

A x B = (2*6 - 3*5, 3*4 - 1*6, 1*5 - 2*4)
     = (12 - 15, 12 - 6, 5 - 8)
     = (-3, 6, -3)

Applications of Vectors

Physics

Vectors describe forces, velocities, accelerations, and other physical quantities with direction.

Computer Graphics

3D modeling, lighting calculations, collision detection, and animations all rely heavily on vector mathematics.

Engineering

Structural analysis, fluid dynamics, and electromagnetic field calculations use vectors extensively.

Machine Learning

Feature vectors, word embeddings, and neural network operations are all based on vector mathematics.

Other Calculators