TTKTheTextKit

Vector Calculator

Enter two vectors, in the plane or in space, and a scalar. The calculator gives the sum, the difference, the scalar multiple, the dot product, the cross product, the length of each vector, their unit vectors, the angle between them and the projection of A onto B. It also tells you when the vectors are perpendicular or parallel. Everything runs in your browser.

Write a vector as 1, 2, 3 or (1, 2, 3), with the numbers separated by commas, semicolons or spaces.

A + B
(5, 7, 9)
A - B
(-3, -3, -3)
k x A
(2, 4, 6)
With k = 2
Dot product A . B
32
Cross product A x B
(-3, 6, -3)
Perpendicular to both vectors
Length of A
3.7416573868
Length of B
8.7749643874
Unit vector of A
(0.2672612419, 0.5345224838, 0.8017837257)
Unit vector of B
(0.4558423058, 0.5698028823, 0.6837634588)
Angle between A and B
12.9331544919 degrees
Projection of A onto B
(1.6623376623, 2.0779220779, 2.4935064935)
Signed length 3.6467384467

The dot product multiplies the matching components and adds them, so (1, 2, 3) . (4, 5, 6) is 4 + 10 + 18, which is 32. It is zero exactly when two non-zero vectors are perpendicular, and it gives the angle through cos(angle) = A . B / (|A| |B|). The cross product of two vectors in space is a vector perpendicular to both, with a length equal to the area of the parallelogram they span, and it changes sign when the order changes. In the plane there is no third direction, so the tool shows its z part, the single number a1 b2 - a2 b1. The unit vector has length 1 and points the same way, and the projection of A onto B is the part of A that lies along B. A zero vector has no direction, so its unit vector, angle and projection are not defined. Everything runs in your browser.

Related Tools

[5 suggestions]

About the Vector Calculator

The dot product multiplies the matching components and adds them. For A = (1, 2, 3) and B = (4, 5, 6) it is 4 + 10 + 18, which is 32. The lengths are the square root of 14, about 3.7417, and the square root of 77, about 8.775, so the angle is the arccosine of 32 divided by their product, which is about 12.93 degrees. The sum is (5, 7, 9) and the difference is (-3, -3, -3). The cross product is (-3, 6, -3), a vector that is perpendicular to both A and B, and it changes sign when you swap the order. In the plane there is no third direction, so the tool shows the z part, the single number a1 b2 minus a2 b1. For (3, 4) and (4, -3) the dot product is 0, so the vectors are perpendicular, and the z part of the cross product is -25. The unit vector of (3, 4) is (0.6, 0.8). The projection of A onto B is the dot product divided by the squared length of B, times B, and for (3, 4) onto (1, 0) it is (3, 0). A zero vector has no direction, so its unit vector, angle and projection are not defined.

How do you calculate the dot product of two vectors?▾

Multiply the matching components and add the results. For (1, 2, 3) and (4, 5, 6) that is 1 times 4, plus 2 times 5, plus 3 times 6, which is 32. Two non-zero vectors are perpendicular exactly when the dot product is zero.

How do you find the angle between two vectors?▾

Divide the dot product by the product of the two lengths and take the arccosine. For (1, 2, 3) and (4, 5, 6), 32 divided by the square root of 14 times the square root of 77 is about 0.9746, so the angle is about 12.93 degrees.

What is the cross product?▾

In 3D it is a vector perpendicular to both inputs, with a length equal to the area of the parallelogram they span. For (1, 2, 3) and (4, 5, 6) it is (-3, 6, -3). Swapping the two vectors flips every sign.

Can I use two dimensions?▾

Yes. Choose 2D and the same results are shown, except that the cross product becomes one number, a1 times b2 minus a2 times b1, which is the signed area of the parallelogram.

Is my data uploaded?▾

No. The calculation runs in your browser and nothing you enter is sent anywhere.