Updated Math

Vector Calculator

Compute vector magnitude, unit vectors, dot and cross products, angles, projections, and build scalar tables with optional CSV export.

Magnitude Dot & Angle Cross & Area Projection

Vector Operations & Geometry Toolkit

Enter vectors A and B in 2D or 3D to compute core operations, angles, projections, and generate tables for scalar combinations.

What a Vector Represents

A vector is a mathematical object that captures both size and direction. Unlike a simple number, which only has magnitude, a vector points somewhere. In coordinate form, a vector is written as components. In two dimensions, a vector is commonly written as ⟨x, y⟩, and in three dimensions as ⟨x, y, z⟩. These components tell you how far the vector moves in each coordinate direction.

Vectors appear in many contexts. In physics, velocity and force are vectors because direction matters. In geometry, vectors describe displacement, lines, and planes. In computer graphics, vectors control movement, lighting, and transformations. In data science and machine learning, vectors represent feature sets and embedding coordinates. This Vector Calculator focuses on the most-used operations: magnitude, unit vectors, dot and cross products, angle between vectors, and projections.

Component Form and Coordinate Geometry

If you view a vector as an arrow from one point to another, the components describe the difference between the endpoint and the starting point. For example, if a vector points from P(x₁,y₁) to Q(x₂,y₂), then the displacement vector is ⟨x₂−x₁, y₂−y₁⟩. In 3D, it becomes ⟨x₂−x₁, y₂−y₁, z₂−z₁⟩. Many practical problems reduce to finding these component differences and then applying vector operations.

In this calculator, you can treat A and B as free vectors (arrows positioned anywhere) or as position vectors anchored at the origin. When you compute the distance between A and B, the tool interprets them as points in space and returns the distance between those points, which is the magnitude of the difference vector A − B.

Magnitude as Vector Length

The magnitude of a vector is its length. For a 2D vector A = ⟨x, y⟩, the magnitude is √(x² + y²). For a 3D vector A = ⟨x, y, z⟩, it is √(x² + y² + z²). This follows directly from the Pythagorean theorem and is one of the most important definitions in vector algebra.

Magnitude formulas
|⟨x, y⟩| = √(x² + y²)
|⟨x, y, z⟩| = √(x² + y² + z²)

Magnitude is used to measure speed (the magnitude of velocity), strength (the magnitude of force), distance (the magnitude of a displacement), and how large a parameter is in a model. If a vector has magnitude zero, it is the zero vector, and it has no direction. That matters because some operations, like making a unit vector, require a nonzero magnitude.

Unit Vectors and Direction Only

A unit vector is a vector with magnitude 1 that points in the same direction as a given vector. Unit vectors are used to represent pure direction. You create a unit vector by dividing each component of the vector by its magnitude.

Unit vector
û = A / |A|

Unit vectors are central in projections and directional derivatives. When you want a directional quantity, such as “move 1 unit in this direction,” you use a unit vector. If the vector is the zero vector, unit direction is not defined, and the calculator will indicate that a unit vector cannot be computed.

Vector Addition and Subtraction

Adding vectors combines their components. If A = ⟨a₁, a₂, a₃⟩ and B = ⟨b₁, b₂, b₃⟩, then A + B = ⟨a₁+b₁, a₂+b₂, a₃+b₃⟩. Subtraction works the same way: A − B = ⟨a₁−b₁, a₂−b₂, a₃−b₃⟩. Geometrically, addition corresponds to placing vectors head-to-tail, and subtraction corresponds to adding the opposite vector.

These operations power many real problems: adding forces, combining velocities, or computing net displacement. In coordinate geometry, A − B can describe a direction from B to A. In data contexts, subtraction forms differences between feature vectors or embeddings.

Scalar Multiplication and Scaling

Scalar multiplication stretches or shrinks a vector. Multiplying a vector by k scales its magnitude by |k| and reverses direction if k is negative. This is used for resizing directions, forming parametric lines, building linear combinations, and controlling step sizes in optimization and numerical methods.

Scalar multiplication
k⟨x, y, z⟩ = ⟨kx, ky, kz⟩

The Scalar Table tab in this tool builds rows of kA + mB over a range of k values. That is a common pattern in linear algebra: exploring how combinations of two vectors span a line (in 2D) or a plane (in 3D), and how magnitude responds as you vary a parameter.

Dot Product and Alignment

The dot product converts two vectors into a single number that reflects how aligned they are. For vectors A and B, the dot product is the sum of componentwise products. If the dot product is positive, the vectors point generally in the same direction. If it is negative, they point more opposite. If it is zero, they are perpendicular.

Dot product
A · B = a₁b₁ + a₂b₂ (+ a₃b₃ in 3D)

Dot products are used for projections, angles, detecting orthogonality, and computing work in physics. In graphics, dot products measure how much a surface normal aligns with a light direction, which controls brightness. In data problems, dot products measure similarity between vectors.

Angle Between Two Vectors

The dot product connects directly to the angle θ between vectors through the identity: A · B = |A||B|cos(θ). Rearranging yields cos(θ) = (A · B) / (|A||B|). The calculator uses this relationship and reports the angle in degrees or radians. Angles are only defined when both vectors have nonzero magnitude.

Angle formula
cos(θ) = (A · B) / (|A||B|),   θ = arccos(cos(θ))

Angle interpretation helps in geometry and applied modeling. For example, if two force vectors have a small angle between them, they reinforce each other more strongly than if they are nearly perpendicular. In navigation, angles relate headings and turn directions. In machine learning, cosine similarity is essentially cos(θ) for normalized vectors, which gives a scale-independent similarity measure.

Cross Product and Perpendicular Direction

The cross product is a 3D operation that produces a vector perpendicular to both inputs. Its direction follows the right-hand rule. Its magnitude equals |A||B|sin(θ), which is also the area of the parallelogram spanned by A and B.

Cross product magnitude and area
|A × B| = |A||B|sin(θ) = parallelogram area

In 2D problems, you often use the z-component of the 3D cross product by treating vectors as lying in the xy-plane with z = 0. The calculator supports this by reporting the cross result in 2D mode as a vector in the k-direction (or equivalently, a signed scalar z-component), along with the associated areas.

Vector Projection and Component Decomposition

A projection answers “how much of vector A points in the direction of vector B.” The scalar projection is the signed length of A in the B direction. The vector projection is an actual vector that lies along B. These ideas are crucial in physics (component of force along a ramp), in geometry (splitting motion into parallel/perpendicular parts), and in optimization (removing a component in a constrained direction).

Projection of A onto B
projB(A) = ((A·B)/(B·B)) B

Once you have the projection, you can decompose A into two orthogonal parts: the parallel component (along B) and the perpendicular component (the remainder). The perpendicular component is sometimes called the rejection of A from B: A⊥ = A − projB(A). This decomposition is one of the cleanest ways to understand geometry in vector form.

Distance Between Two Points Using Vectors

Distance in coordinate geometry is a direct application of magnitude. If you interpret A and B as points, then the displacement from B to A is A − B, and the distance is |A − B|. This is the multidimensional generalization of the distance formula you learn in algebra.

This calculator includes distance in the Basics tab because it is frequently needed. It supports 2D and 3D distances, and it also helps confirm that subtraction and magnitude steps were applied correctly.

How to Use the Scalar Table for Linear Combinations

The Scalar Table tab is designed for exploration. You choose vectors A and B, fix m, and vary k across a range. Each row computes kA, mB, and the combination kA + mB along with its magnitude. This is useful in many settings:

  • Understanding how a line of combinations behaves when B is fixed
  • Finding k values that make vectors cancel or align
  • Studying how magnitude changes as you scale one component
  • Generating CSV data for plots such as |kA + mB| versus k

Exporting to CSV allows you to graph results quickly in a spreadsheet. That can reveal patterns like minima (closest approach to the origin) or steady growth, depending on the geometry of A and B.

Input Tips for Reliable Results

Choose 2D mode when you only need x and y. Choose 3D mode when you want full spatial operations. If you switch modes, the calculator treats unused z components as zero. Units are optional and are displayed as a label to improve readability, but they do not change the math. For consistent results, keep units consistent within a problem; for example, do not mix meters and centimeters unless you convert first.

Some outputs depend on nonzero magnitudes. Angles require both |A| and |B| to be nonzero. Projections require the target vector (the vector you project onto) to be nonzero. If a required vector is zero, the calculator reports undefined results rather than returning misleading numbers.

FAQ

Vector Calculator – Frequently Asked Questions

Answers about magnitude, unit vectors, dot and cross products, angles, projections, and exporting tables.

A vector is a quantity with both magnitude and direction. In coordinates it is represented by components such as ⟨x, y⟩ in 2D or ⟨x, y, z⟩ in 3D.

Magnitude is the length of the vector. In 2D it is √(x² + y²) and in 3D it is √(x² + y² + z²).

A unit vector has magnitude 1 and points in the same direction as the original vector. It is found by dividing the vector by its magnitude.

The dot product measures how aligned two vectors are. It helps compute angles, projections, and determines orthogonality (dot product equals 0 for perpendicular vectors).

The cross product produces a vector perpendicular to both input vectors (in 3D). Its magnitude equals the area of the parallelogram formed by the vectors.

Use cos(θ) = (A · B) / (|A||B|). Then θ = arccos(cos(θ)). The calculator reports the angle in degrees and radians.

A projection is the component of one vector in the direction of another. The vector projection of A onto B is proj_B(A) = ((A·B)/(B·B)) B when B is nonzero.

Yes. Choose 2D or 3D mode. In 2D mode, z is treated as 0 for operations such as cross product (reported as a z-component and equivalent area).

Yes. You can generate a scalar table (like kA + mB across a range of k values) and export it as CSV for spreadsheet analysis.

Results are computed using standard vector algebra. Ensure consistent units and note that angles and projections require nonzero vectors.