Vector Calculator: Addition, Dot and Cross Products, Magnitude and Angle
By FindMySum · Last reviewed
A vector calculator works with quantities that have both size and direction: forces, velocities, displacements and the arrows of geometry. Enter two vectors in two or three dimensions, as components or as a magnitude and direction, and this one gives their sum and difference, a scalar multiple, both magnitudes and unit vectors, the dot product, the cross product, the angle between them and the projection of one onto the other. In 2D it draws the tip-to-tail diagram of the resultant.
Components, magnitude and direction
A 2D vector a can be written by its components ⟨ax, ay⟩, the distances it moves along x and y. Its magnitude (length) comes from Pythagoras:
|a| = √(ax² + ay²), and in 3D, √(ax² + ay² + az²).
Its direction is the angle θ it makes with the positive x-axis, measured counter-clockwise: θ = atan2(ay, ax). Going the other way, a vector of magnitude r at angle θ has components x = r cos θ and y = r sin θ. This conversion is the heart of most physics problems with forces at angles, and the calculator does it when you choose "magnitude and direction".
Adding and subtracting
Vectors add component by component:
a + b = ⟨ax + bx, ay + by, az + bz⟩
Geometrically, this is the tip-to-tail rule: draw a, then draw b starting where a ends; the resultant runs from the start of a to the end of b. Subtraction adds the opposite vector: a − b = a + (−b). Multiplying by a scalar k stretches the vector by k, and a negative k also reverses it.
Worked example with the defaults
The calculator opens with a = ⟨3, 4⟩ and b = ⟨−2, 5⟩.
- Sum: ⟨3 + (−2), 4 + 5⟩ = ⟨1, 9⟩, with magnitude √(1 + 81) = √82 ≈ 9.0554, pointing 83.66° from the +x axis.
- Magnitudes: |a| = √(9 + 16) = 5 and |b| = √(4 + 25) = √29 ≈ 5.3852.
- Dot product: 3 × (−2) + 4 × 5 = 14.
- Angle between them: arccos(14 ÷ (5 × 5.3852)) ≈ 58.67°.
- Cross product: treating both as lying in the xy-plane, a × b = ⟨0, 0, 3 × 5 − 4 × (−2)⟩ = ⟨0, 0, 23⟩. The parallelogram spanned by a and b has an area of 23.
- Projection of b onto a: 14 ÷ 5 = 2.8 units along a.
The dot product
The dot product multiplies matching components and adds them, giving a single number:
a · b = ax·bx + ay·by + az·bz = |a| |b| cos θ
The second form explains what it means. When the vectors point the same way, cos θ = 1 and the dot product is as large as it can be. When they are perpendicular it is exactly zero, which is the standard test for perpendicular vectors. When they point in roughly opposite directions it is negative. Rearranged, it gives the angle between any two vectors: θ = arccos(a · b ÷ (|a| |b|)).
In physics, work is the dot product of force and displacement. Pushing a 50 N load 10 m along a floor with the force at 30° to the floor does 50 × 10 × cos 30° ≈ 433 J of work, because only the part of the force along the motion counts.
The cross product
The cross product of two 3D vectors is another vector:
a × b = ⟨ay·bz − az·by, az·bx − ax·bz, ax·by − ay·bx⟩
It is perpendicular to both a and b, its direction is given by the right-hand rule (curl the fingers of your right hand from a to b and your thumb points along a × b), and its length is |a| |b| sin θ, the area of the parallelogram the two vectors span. Torque (r × F), angular momentum and the magnetic force on a moving charge are all cross products. Two vectors are parallel exactly when their cross product is the zero vector.
Resultants in physics
When several forces act on an object, it accelerates as if one force, the resultant, acted alone. Two people pulling a sled with 30 N due east and 40 N due north produce a resultant of 50 N about 53° north of east. The same arithmetic combines a boat's velocity with the current, or an aircraft's airspeed with the wind. Enter each one as a magnitude and direction and read the resultant's magnitude, direction and compass bearing.
Checking your work
A few properties make good sanity checks. The magnitude of a sum is never more than the sum of the magnitudes (the triangle inequality). A unit vector always has magnitude 1. The cross product is perpendicular to both inputs, so its dot product with either one is zero. If a result breaks one of these, look for a sign error in a component.
More questions
Is a vector the same as a scalar with a direction?
A vector has both size and direction, while a scalar has only size. Speed (60 km/h) is a scalar; velocity (60 km/h due north) is a vector. Mass, temperature and energy are scalars; force, displacement and acceleration are vectors. Adding vectors has to account for direction, so 3 N and 4 N acting at right angles add up to 5 N, not 7 N.
Does the order matter in vector addition or the cross product?
Addition and the dot product are commutative: a + b = b + a and a · b = b · a. The cross product is not: b × a = −(a × b), the same length pointing the opposite way. Swap the vectors in the calculator and the cross product changes sign.
How do I add three or more vectors?
Add them in pairs: find a + b, then add c to that result. Vector addition is associative, so the order of the pairs doesn't change the final resultant. In components it is simply the sum of all the x components, all the y components and all the z components.
What is the scalar projection used for?
It gives how much of one vector lies along another. The component of gravity pulling a box down a ramp, or the part of the wind that acts along a runway (the headwind component), are projections. The vector projection is the same length pointing along the second vector.
Why does my angle come out as 180° minus what I expected?
The angle between two vectors is measured between their directions when placed tail to tail, and it is always 0° to 180°. If you drew one of them pointing the other way, as is common in force diagrams, you get the supplementary angle. Reverse one vector by changing the signs of its components to check.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.