Vector
calculator.
Add, scale and multiply 2D or 3D vectors, and find lengths, unit vectors and angles.
Components can be whole numbers, decimals or fractions such as 1/2.
- |A|
- 3.1623
- |B|
- 2.2361
- A · B
- 5
- Angle θ
- 45°
Put the tail of B at the tip of A: the sum runs from the start of A to the end of B, the diagonal of the parallelogram.
The vectors as arrows
Drag a ringed tipA is ⟨3, 1⟩ and B is ⟨1, 2⟩, drawn from the origin. The result A + B = ⟨4, 3⟩. Drag the ringed tips, or use the arrow keys on them, to change A and B.
Every result for these vectors
Every result for these vectors
| Result | Value |
|---|---|
| A + B | ⟨4, 3⟩ |
| A − B | ⟨2, −1⟩ |
| A · B | 5 |
| Angle θ | 45° |
| kA | ⟨6, 2⟩ |
| |A| | √10 |
| |B| | √5 |
| Unit vector  | ⟨0.9487, 0.3162⟩ |
Working
- 1Add matching componentsA + B = ⟨3+1,1+2⟩ =⟨4,3⟩
- 2Check: take B away again to get A back(A + B) − B =⟨3,1⟩= A
How it's worked out
A vector is written by its components, one number per axis, such as ⟨3, 1⟩ in 2D or ⟨2, 2, −1⟩ in 3D. Adding vectors and multiplying by a scalar work one component at a time. A scalar is a plain number k, and kA stretches A by the size of k, flipping it when k is negative.
The length, or magnitude, comes from the Pythagorean theorem. A unit vector has length 1; you get one by dividing each component by the length, which is called normalizing.
The dot product multiplies matching components and adds the results, so it gives a number, not a vector. It also equals the two lengths times the cosine of the angle between them, which is how the tool finds the angle.
The cross product needs three components. It gives a vector at right angles to both A and B, and its length is the area of the parallelogram the two vectors span. For the angle, the tool uses the dot product and the length of the cross product together, which stays accurate when the two vectors point almost the same way.
Worked examples
Sam adds two pulls on a crate
Sam pulls a crate with 30 N toward the east while a friend pulls with 40 N toward the north. With east as x and north as y, the pulls are two vectors.
The total pull is ⟨30, 40⟩ newtons. Its length is 50 N, not the 70 N you get by adding the two sizes, because the pulls are at right angles. It points 53.1° north of east, the angle between the total and the x axis.
Is one direction at right angles to another?
A level designer wants a wall at right angles to a path that runs along ⟨2, 3⟩. She tries the direction ⟨−3, 2⟩, made by swapping the components and changing one sign.
Two vectors that are not zero are orthogonal exactly when their dot product is 0, and here it is 0. So the angle is 90°, and the wall is square to the path.
The angle between two 3D vectors
For ⟨2, 2, −1⟩ and ⟨5, −3, 2⟩ the dot product is 2. The lengths are 3 and √38, so the cosine is small.
That is about 0.1081, so θ is 83.79°, a little under a right angle. The exact view keeps the cosine as a root over a whole number until the last step.
Reading your result
The sign of the dot product. Positive means the angle is under 90°, zero means a right angle, and negative means over 90°. For ⟨1, 0⟩ and ⟨−1, 1⟩ the dot product is -1 and the angle is 135°.
Angles run from 0° to 180°. The angle between two vectors has no direction of turn, so it never goes past 180°. An angle of 0° means the vectors point the same way, and 180° means opposite ways.
A unit vector keeps only direction. ⟨3, 4⟩ has length 5, so its unit vector is ⟨0.6, 0.8⟩. The zero vector is the only vector without a direction, so it has no unit vector and no angle with anything.
The cross product has an order. ⟨1, 2, 3⟩ × ⟨4, 5, 6⟩ is ⟨−3, 6, −3⟩, while the other order gives ⟨3, −6, 3⟩. The two point in opposite directions with the same length.
Common mistakes
- Adding the sizes instead of the components. Two pulls of 30 N and 40 N at right angles give 50 N in total, not 70 N. Lengths add only when the vectors point the same way.
- Reading the dot product as a vector. A · B is one number. If your answer has components, you worked out something else, such as a sum or a cross product.
- Using a calculator set to the wrong angle unit. The inverse cosine of the same number gives degrees or radians depending on the setting. The tool lets you pick either, so match what your course uses.
- Trying a cross product in 2D. Put the vectors in 3D with a third component of 0 instead. The result then points straight along the z axis.