123
Calculator-Cloud

Vector Calculator

Vector A

Vector B

Understanding Vectors

A vector is a mathematical object that has both magnitude (length) and direction. Unlike scalars (ordinary numbers), vectors capture directional information essential for describing physical quantities like force, velocity, and acceleration. This calculator handles 3D vectors with components (x, y, z).

Vectors are fundamental tools in physics, engineering, computer graphics, and data science. They allow us to represent and manipulate quantities that have direction, perform geometric calculations, and model real-world phenomena mathematically.

Vector Notation

A 3D vector can be written as:

v = (x, y, z) = xi + yj + zk

where i, j, k are unit vectors along the x, y, z axes

Vector Addition and Subtraction

Vector addition and subtraction are performed component-wise. To add vectors, add their corresponding components. To subtract, subtract corresponding components.

Addition Formula

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

Example: (1, 2, 3) + (4, 5, 6) = (5, 7, 9)

Geometric Interpretation

Vector addition follows the "head-to-tail" rule: place the tail of B at the head of A, and the sum is the vector from A's tail to B's head. This is also called the parallelogram rule when both vectors start at the same point.

Scalar Multiplication

Multiplying a vector by a scalar multiplies each component by that scalar. This changes the vector's magnitude (and direction if the scalar is negative) but not its orientation line.

c × (x, y, z) = (cx, cy, cz)

  • c > 1: Stretches the vector
  • 0 < c < 1: Shrinks the vector
  • c < 0: Reverses direction and scales
  • c = -1: Reverses direction (same length)

Dot Product (Scalar Product)

The dot product of two vectors produces a scalar (single number). It measures how much two vectors point in the same direction and has many important applications.

Dot Product Formula

A · B = a₁b₁ + a₂b₂ + a₃b₃

Also: A · B = |A| |B| cos(θ)

where θ is the angle between the vectors

Properties of Dot Product

  • Commutative: A · B = B · A
  • Distributive: A · (B + C) = A · B + A · C
  • Self-dot: A · A = |A|² (magnitude squared)
  • Perpendicular vectors: A · B = 0 when θ = 90°
  • Parallel vectors: A · B = ±|A||B| when θ = 0° or 180°

Applications of Dot Product

  • Finding angles between vectors
  • Checking perpendicularity (orthogonality)
  • Calculating work done by a force
  • Projecting one vector onto another
  • Lighting calculations in computer graphics

Cross Product (Vector Product)

The cross product of two 3D vectors produces another vector that is perpendicular to both input vectors. It's fundamental for calculating areas, torques, and normal vectors.

Cross Product Formula

A × B = (a₂b₃ - a₃b₂, a₃b₁ - a₁b₃, a₁b₂ - a₂b₁)

Magnitude: |A × B| = |A| |B| sin(θ)

Properties of Cross Product

  • Anti-commutative: A × B = -(B × A)
  • Distributive: A × (B + C) = A × B + A × C
  • Not associative: A × (B × C) ≠ (A × B) × C
  • Parallel vectors: A × B = 0 when A and B are parallel
  • Self-cross: A × A = 0

Right-Hand Rule

The direction of A × B follows the right-hand rule: point your fingers in the direction of A, curl them toward B, and your thumb points in the direction of A × B.

Applications of Cross Product

  • Finding vectors perpendicular to a plane
  • Calculating area of parallelograms and triangles
  • Computing torque (τ = r × F)
  • Angular momentum (L = r × p)
  • Normal vectors for 3D surfaces

Vector Magnitude (Length)

The magnitude of a vector is its length, calculated using the 3D distance formula (generalized Pythagorean theorem).

Magnitude Formula

|v| = √(x² + y² + z²)

Example: |(3, 4, 0)| = √(9 + 16 + 0) = 5

Unit Vectors

A unit vector has magnitude 1 and indicates direction only. Any non-zero vector can be converted to a unit vector (normalized) by dividing by its magnitude.

Unit Vector Formula

û = v / |v| = (x/|v|, y/|v|, z/|v|)

Standard Unit Vectors

  • i = (1, 0, 0): Unit vector along x-axis
  • j = (0, 1, 0): Unit vector along y-axis
  • k = (0, 0, 1): Unit vector along z-axis

Angle Between Vectors

The angle between two vectors can be found using the dot product formula rearranged:

Angle Formula

cos(θ) = (A · B) / (|A| |B|)

θ = arccos((A · B) / (|A| |B|))

Vector Projection

The projection of A onto B gives the component of A in the direction of B. It's useful for decomposing vectors and calculating work.

Projection Formula

projBA = ((A · B) / |B|²) × B

Scalar component: (A · B) / |B|

Applications in Physics

Force and Motion

Forces are vectors. The net force is the vector sum of all forces. Work is the dot product of force and displacement: W = F · d.

Velocity and Acceleration

Both velocity and acceleration are vectors. Position changes by velocity vectors, velocity changes by acceleration vectors.

Electromagnetic Fields

Electric and magnetic fields are vector fields. The Lorentz force uses cross product: F = qv × B.

Applications in Computer Graphics

Surface Normals

Cross products calculate surface normals for lighting. Given two edge vectors of a triangle, their cross product gives the normal vector perpendicular to the surface.

Collision Detection

Dot products test if objects face each other. Projections calculate penetration depths in collision response.

Camera Systems

Camera orientation uses orthogonal vectors for right, up, and forward directions, maintained using cross products.

Frequently Asked Questions

When do I use dot product vs cross product?

Use dot product when you need a scalar result: angles, projections, work, checking perpendicularity. Use cross product when you need a perpendicular vector: normals, torque, area calculations.

Can I take the cross product of 2D vectors?

Not directly—cross product is only defined in 3D (and 7D). For 2D vectors, you can set z=0 and the result will be a vector pointing along the z-axis, giving a "pseudo-scalar" for 2D calculations.

What does it mean when the dot product is zero?

A zero dot product means the vectors are perpendicular (orthogonal). This is a key test in geometry and linear algebra.

Why is the cross product anti-commutative?

Because switching the order reverses the perpendicular direction (right-hand rule). A × B points "up" while B × A points "down" (opposite direction).