Vector Calculator with Steps

Step-by-Step 13 Operations 2D & 3D Free · No Signup

Free online vector calculator with step-by-step solutions. Compute dot product, cross product, magnitude, projection, angle, and more for 2D and 3D vectors. Includes interactive graph, LaTeX export, and Python NumPy code.

Vector Calculator
x y z
x y z
Enter vector components above…

Result

Enter vectors and click Calculate

Supports 13 vector operations including dot product, cross product, projection, and more.

Interactive Graph

Calculate vectors to see the graph.

Python (NumPy)

What is a Vector?

A vector is a mathematical object with both magnitude (length) and direction. Unlike scalars (plain numbers), vectors encode directional information. In component form, a vector in 2D is written as v = (x, y) and in 3D as v = (x, y, z).

2D: &vec;v = (vx, vy)     3D: &vec;v = (vx, vy, vz)

Geometrically, a vector is represented as an arrow from the origin to a point. The magnitude is the arrow's length: |v| = √(x² + y²) in 2D or |v| = √(x² + y² + z²) in 3D. A unit vector has magnitude 1 and indicates pure direction.

Position Vector

Points from the origin to a point P. If P = (3, 4), the position vector is <3, 4> with magnitude 5.

Standard Unit Vectors

In 3D: î = (1,0,0), ĵ = (0,1,0), k̂ = (0,0,1). Any vector = xî + yĵ + zk̂.

Zero Vector

The vector 0 = (0, 0, 0) has no direction and zero magnitude. It is the additive identity.

Vector Addition & Subtraction

Vectors are added and subtracted component-wise. Geometrically, addition follows the parallelogram rule or tip-to-tail method.

a + b = (ax+bx, ay+by, az+bz)
a − b = (ax−bx, ay−by, az−bz)

Example: (1,2,3) + (4,−1,2) = (5, 1, 5)

Scalar multiplication scales each component: k·v = (kvx, kvy, kvz). If k > 0 the direction is preserved; if k < 0 the direction is reversed.

Dot Product (Scalar Product)

The dot product of two vectors produces a scalar. It has two equivalent definitions:

Algebraic: a · b = axbx + ayby + azbz
Geometric: a · b = |a| |b| cosθ

Key properties:

Cross Product (Vector Product)

The cross product of two 3D vectors produces a new vector perpendicular to both inputs. It is computed using the determinant of a 3×3 matrix:

a × b = det |î ĵ k̂| = (aybz − azby
            |ax ay az| − (axbz − azbx
            |bx by bz| + (axby − aybx)k̂

Key facts: |a × b| = |a||b|sinθ = area of the parallelogram. The direction follows the right-hand rule. The cross product is anti-commutative: a × b = −(b × a). It is only defined in 3D.

Vector Projection & Rejection

The projection of b onto a gives the component of b in the direction of a. The rejection is the perpendicular remainder.

proja(b) = [(a · b) / (a · a)] · a
reja(b) = b − proja(b)

The projection and rejection are always orthogonal: proj · rej = 0. Together they decompose b into parallel and perpendicular components relative to a. This decomposition is fundamental in physics (work = F · d), computer graphics (lighting), and signal processing.

Applications of Vectors

Physics

Force, velocity, acceleration, momentum, electric/magnetic fields are all vectors. Work = F · d (dot product). Torque = r × F (cross product).

Computer Graphics

Surface normals (cross product), lighting calculations (dot product), camera direction, ray tracing, and 3D transformations.

Engineering

Structural analysis, fluid dynamics, navigation (GPS vectors), robotics (joint angles), and electromagnetic field analysis.

Machine Learning

Feature vectors, cosine similarity (dot product), gradient descent, word embeddings, and high-dimensional data representation.

Vector Operations Quick Reference

OperationFormulaReturnsDim
Additiona + b = (ai+bi)Vector2D/3D
Subtractiona − b = (ai−bi)Vector2D/3D
Scalar Multiplyk·a = (k·ai)Vector2D/3D
Dot Product∑ aibiScalar2D/3D
Cross Productdet[î ĵ k̂; a; b]Vector3D only
Magnitude√(∑ ai²)Scalar2D/3D
Unit Vectora / |a|Vector2D/3D
Anglearccos(a·b / |a||b|)Angle2D/3D
Projection(a·b/a·a)·aVector2D/3D
Rejectionb − proja(b)Vector2D/3D
Area|a × b| or |axby−aybx|Scalar2D/3D
Triple Scalara · (b × c)Scalar3D only
Linear Indep.a × b ≠ 0 (3D) or det ≠ 0 (2D)Boolean2D/3D

Frequently Asked Questions

The dot product of vectors a and b is the sum of the products of their corresponding components: a · b = a1b1 + a2b2 + a3b3. It returns a scalar. If the dot product is zero, the vectors are perpendicular (orthogonal). The dot product also equals |a||b|cos(θ) where θ is the angle between them.
The cross product a × b is computed using the determinant of a 3×3 matrix with unit vectors î, ĵ, k̂ in the first row and the components of a and b in the second and third rows. The result is a new vector perpendicular to both a and b. The cross product is only defined for 3D vectors.
The projection of vector b onto vector a gives the component of b in the direction of a. The formula is proja(b) = (a · b)/(a · a) × a. The rejection is the complementary component: reja(b) = b − proja(b). Together they reconstruct the original vector b.
Use the formula θ = arccos((a · b) / (|a| × |b|)). First compute the dot product and the magnitudes of both vectors, then divide and take the inverse cosine. The result is in radians; multiply by 180/π to convert to degrees.
Two vectors are linearly independent if neither is a scalar multiple of the other. In 2D, check if the determinant of the matrix formed by the vectors is nonzero. In 3D, check if their cross product is nonzero. Linearly independent vectors span the full space and form a basis.

Support This Free Tool

Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site — you're helping me build what developers actually need.

500K+ users
200+ tools
100% private
Privacy Guarantee: Private keys you enter or generate are never stored on our servers. All tools are served over HTTPS.