NOTACAL logo

Vector Calculator

Vector Calculator

Give us your feedback! Was this useful?

Introduction

A vector is a mathematical object that has both magnitude (length) and direction. Vectors are used to represent quantities such as force, velocity, displacement, and acceleration, which cannot be described by a single number alone. A vector in two dimensions is written as (x, y), and in three dimensions as (x, y, z). Vector algebra gives us a compact language for combining and comparing these directed quantities [lay].

The idea of a vector dates back to the nineteenth century, when Josiah Willard Gibbs and Oliver Heaviside reformulated the laws of electromagnetism using vector notation. Before that, physicists wrote out components laboriously. Today vectors appear everywhere: in computer graphics to position and rotate objects, in physics to sum forces, in machine learning as feature arrays, and in navigation to describe headings.

This vector calculator performs five common operations. Magnitude (or norm) gives the length of a vector. Addition combines two vectors component by component, modeling the net effect of two displacements or forces. The dot product measures how much two vectors align and lets you compute the angle between them. The cross product, defined only in three dimensions, produces a vector perpendicular to both inputs and equals the area of the parallelogram they span. Finally, the angle-between operation reports the separation of two directions in degrees.

How to Use

Select an operation from the Operation menu: Magnitude, Add / Subtract, Dot Product, Cross Product, or Angle Between. The inputs update to match the chosen operation.

For Magnitude, choose 2D or 3D and enter the components. A 2D vector (3, 4) has magnitude √(3² + 4²) = 5. A 3D vector (1, 2, 2) has magnitude √(1 + 4 + 4) = 3.

For Add / Subtract, enter two vectors A and B and pick plus or minus. Adding (1, 2, 3) and (4, 5, 6) gives (5, 7, 9); subtracting gives (-3, -3, -3). This mirrors placing arrows tip-to-tail.

For Dot Product, enter A and B. The dot product of (1, 2, 3) and (4, 5, 6) is 1·4 + 2·5 + 3·6 = 32. The calculator also reports the angle between them using the identity cos θ = (A·B) / (‖A‖‖B‖).

For Cross Product, enter two 3D vectors. The cross product of (1, 0, 0) and (0, 1, 0) is (0, 0, 1), a vector pointing along the z-axis. Switching the order flips the sign: (0, 1, 0) × (1, 0, 0) = (0, 0, -1).

For Angle Between, enter two 3D vectors and read the angle in degrees. Perpendicular vectors give 90°, while identical vectors give 0°.

Edge cases: a zero vector (0, 0, 0) has magnitude 0, and the angle to any other vector is undefined because division by zero occurs in the dot-product formula. The calculator returns a result only when both vectors are non-zero. A negative scalar in a direction does not change the magnitude's formula; it simply reverses orientation.

yxv (magnitude)
Figure 1: A 2D vector (x, y) forms a right triangle with its magnitude as the hypotenuse — magnitude is √(x² + y²) by the Pythagorean theorem.

How It's Calculated

The magnitude (or Euclidean norm) of a vector is the square root of the sum of squared components. In three dimensions:

v=vx2+vy2+vz2\|\mathbf{v}\| = \sqrt{v_x^2 + v_y^2 + v_z^2}
[lay]

Vector addition is componentwise:

A+B=(Ax+Bx,  Ay+By,  Az+Bz)\mathbf{A} + \mathbf{B} = (A_x + B_x,\; A_y + B_y,\; A_z + B_z)

The dot product is the sum of componentwise products:

AB=AxBx+AyBy+AzBz\mathbf{A} \cdot \mathbf{B} = A_x B_x + A_y B_y + A_z B_z

It relates to the angle θ between the vectors through:

AB=ABcosθ\mathbf{A} \cdot \mathbf{B} = \|\mathbf{A}\|\,\|\mathbf{B}\|\cos\theta

The cross product of two 3D vectors is:

A×B=(AyBzAzBy,  AzBxAxBz,  AxByAyBx)\mathbf{A} \times \mathbf{B} = (A_y B_z - A_z B_y,\; A_z B_x - A_x B_z,\; A_x B_y - A_y B_x)

The angle between vectors follows from rearranging the dot-product identity:

θ=arccos(ABAB)\theta = \arccos\left(\frac{\mathbf{A} \cdot \mathbf{B}}{\|\mathbf{A}\|\,\|\mathbf{B}\|}\right)

Manual example: find the angle between A = (1, 0, 0) and B = (1, 1, 0). The dot product is 1·1 + 0·1 + 0·0 = 1. ‖A‖ = 1, ‖B‖ = √2. So cos θ = 1 / √2, and θ = arccos(0.7071) = 45°. The calculator reproduces this exactly.

Reference Values

Dot Products of Unit Basis Vectors

PairDot ProductInterpretation
(1,0,0)·(1,0,0)1Same direction
(1,0,0)·(0,1,0)0Perpendicular
(1,0,0)·(-1,0,0)-1Opposite direction
(1,0,0)·(1,1,0)145° apart
(1,0,0)·(0,0,1)0Perpendicular (z)
Dot products quantify alignment: 1 means parallel, 0 means perpendicular, -1 means anti-parallel. The dot product is the cosine of the angle scaled by the lengths.

The dot product's sign tells you whether two vectors point roughly the same way (positive), are perpendicular (zero), or oppose each other (negative). This single number summarizes the entire angular relationship and is the basis for projection and work calculations in physics.

More Worked Examples

A couple of additional checks you can reproduce with the calculator.

Example A — magnitude of (6, 8): √(36 + 64) = 10, a scaled 3-4-5 right triangle, confirming the formula on a familiar case.

Example B — cross product of (2, 3, 1) and (1, 0, 4): using the component formula gives (12, -7, -3), a vector perpendicular to both inputs and with magnitude equal to the parallelogram area they span.

Practical Tips

  • Use the dot product to test orthogonality. If A · B = 0 and neither vector is zero, the two directions are exactly perpendicular.
  • The cross product is only defined in three dimensions. For 2D work, treat the z-component as 0 or use the scalar 2D "cross" (the z-component of the 3D result).
  • Normalize a vector by dividing it by its magnitude to get a unit vector pointing the same way; unit vectors simplify angle and projection formulas.
  • Remember the cross product is anti-commutative: A × B = - (B × A). Reversing the order flips the resulting direction.
  • For the angle between two vectors, ensure neither is the zero vector; the formula divides by both magnitudes and breaks down at zero.
  • Combine operations: the projection of A onto B is ((A · B) / (B · B)) B, computed from a dot product and a magnitude.

Limitations

  • 3D Cross Product Only: The cross product has no direct 2D analog here; a 2D cross yields only a scalar (the z-component), which this calculator does not output separately.
  • Zero-Vector Angle: The angle-between operation is undefined when either vector is the zero vector, because the cosine formula divides by zero magnitude.
  • Euclidean Norm Only: Magnitude uses the standard Euclidean length. Other norms (Manhattan, maximum) are not computed.
  • No Graphical Output: The calculator returns numbers, not a plot; visualizing the arrows still requires manual sketching or separate software.
  • Finite Precision: Floating-point arithmetic gives results accurate to about 15 digits, so a dot product that should be exactly 0 may show a tiny residual like 1e-16.

Frequently Asked Questions

What is the difference between a vector and a scalar?
A scalar is a single number with magnitude only, like temperature or mass. A vector has both magnitude and direction, like velocity or force, and is written as a list of components.
Why is the cross product only for 3D vectors?
The cross product produces a vector perpendicular to two inputs, which is a genuinely three-dimensional concept. In 2D the result would point out of the plane, represented by a single scalar.
What does a dot product of zero mean?
It means the two vectors are perpendicular (orthogonal), provided neither is the zero vector. The cosine of the angle between them is zero, so the angle is 90°.
How do I find the angle between two vectors?
Compute the dot product and divide by the product of the magnitudes, then take the arccosine. The calculator does this automatically and reports degrees.
Is vector addition commutative?
Yes. A + B = B + A because addition is componentwise and ordinary addition of numbers commutes. The same holds for subtraction only in the sense that A - B = -(B - A).
What is the magnitude of a vector?
It is the vector's length, the square root of the sum of its squared components. For (3, 4) the magnitude is 5.
Can I add vectors of different dimensions?
No. Both vectors must have the same number of components. A 2D and a 3D vector cannot be added directly without padding or projection.
What does the cross product represent geometrically?
Its magnitude equals the area of the parallelogram spanned by the two vectors, and its direction is perpendicular to both, following the right-hand rule.
Why is A × B the negative of B × A?
Because reversing the order of the two inputs reverses the perpendicular direction according to the right-hand rule; the magnitude stays the same.
How are vectors used outside mathematics?
Vectors model forces in engineering, velocities in physics, positions in computer graphics, and feature arrays in machine learning. Any quantity with direction and size is naturally a vector.

Real-World Applications and Extended Examples

Vectors are how the physical world is actually described. A temperature is a scalar, but the wind has both a speed and a direction, so it is a vector; a mass is a scalar, but the gravitational pull on it is a vector. Learning to add, scale, and compare vectors is learning to reason about direction as well as size.

Extended example 1 — net force on an object: two forces act on a block, A = (3, 4) newtons and B = (-1, 2) newtons. Their sum is (2, 6) newtons, the single force that has the same effect. The magnitude √(4 + 36) ≈ 6.32 N tells you the total push, and its direction is atan2(6, 2) ≈ 71.6° above the x-axis. This is vector addition in action.

Extended example 2 — work done by a force: the work when a force F moves an object through displacement d is the dot product F · d. If F = (5, 0) N and the object moves d = (3, 4) m, the work is 15 joules — only the component of force along the motion contributes. A force perpendicular to the motion does zero work, exactly as the dot product predicts.

Extended example 3 — finding a perpendicular direction: the cross product gives a vector orthogonal to two others, which is how a computer builds a surface normal for lighting a 3D model. Given two edges of a triangle, their cross product points out of the face; its magnitude is the triangle's area. Graphics engines compute this millions of times per frame.

Extended example 4 — navigation and bearing: a plane flies with airspeed vector A while wind adds vector W; the ground velocity is A + W. Pilots and autopilots solve this addition constantly to stay on course. A crosswind that seems small can accumulate a large drift over a long flight.

Extended example 5 — projecting onto a line: the projection of A onto B is ((A · B)/(B · B))B. This decomposes a force into components parallel and perpendicular to a surface — essential in incline-plane problems, where only the parallel component accelerates the object and the perpendicular one is balanced by the normal force.

Extended example 6 — testing orthogonality in data: in statistics and machine learning, two feature vectors are uncorrelated when their dot product (after centering) is near zero. The same geometry that tells you two arrows are perpendicular tells you two signals carry independent information.

Extended example 7 — the right-hand rule: the direction of A × B follows the right-hand rule — point fingers along A, curl toward B, and the thumb gives the result. This convention is why reversing the order flips the sign, a fact the cross-product mode demonstrates directly with (1,0,0) × (0,1,0) = (0,0,1) versus the reversed order.

Extended example 8 — torque: torque is the cross product of the lever arm r and the applied force F. A wrench turned at the end of a long handle produces more torque because r is longer; the perpendicular component of force matters most. Mechanics, robotics, and engine design all reduce to this single vector operation.

When using the tool, keep dimensions consistent: a 2D vector has two components and a 3D vector three, and you cannot add across dimensions. For angles, remember the result is the smaller angle (between 0° and 180°) given by the arccosine of the normalized dot product; to recover a signed or oriented angle you would need extra context such as the cross product's sign.

A vector space is defined by more than just arrows; it is any collection of objects that can be added and scaled while preserving certain rules. Functions, polynomials, and even matrices form vector spaces, so the operations here — addition, scaling, dot product — apply far beyond physical arrows in space.

The dot product is the gateway to projection, which is how you decompose one vector into components parallel and perpendicular to another. This decomposition is the heart of statics problems, where a force is split into a part that moves an object and a part that presses against a surface.

The cross product's magnitude equals the area of the parallelogram two vectors span, which is why it appears in torque, magnetic force, and surface-area computations. Its direction, set by the right-hand rule, encodes orientation — information a scalar area alone cannot carry.

Coordinate choice is arbitrary. The same physical vector has different components in a rotated frame, but its magnitude and the angle between it and another vector are invariant. This invariance is why vectors are the preferred language whenever a result must not depend on how you happened to draw your axes.

The concept of linear independence is expressed naturally through vectors. Two vectors are independent when neither is a scaled copy of the other, and three are independent when none lies in the plane the other two span. The dot and cross products here give quick tests for those relationships without drawing a single picture.

Vectors also formalize the idea of a basis, the minimal set of directions from which every other vector in a space can be built by scaling and adding. The standard unit vectors along the axes are one such basis, but there are infinitely many, and switching bases is how rotated coordinate systems are described.

In physics the same vector addition that sums forces also sums velocities, fields, and momenta. The parallelogram law — placing two arrows tail to tail and completing the parallelogram — is the geometric statement of componentwise addition, and it is the reason this calculator's addition mode mirrors the tip-to-tail picture taught in every mechanics course.

Last updated: July 20, 2026

1b

UnByte — Independent Software Engineering

Every calculator references authoritative sources — Editorial policy