Home › Math & Science › Vector Calculator
Vector Calculator
Use this vector calculator to work with vectors in two or three dimensions. Add and subtract vectors, find the dot product and cross product, measure a vector's magnitude, find the angle between two vectors, or turn a vector into a unit vector — all with the working shown step by step.
Enter the components of each vector. Negative numbers are fine — they point in the opposite direction along that axis.
How it works
A vector is a quantity with both size and direction. A speed of 30 miles per hour is only a number, but a velocity of 30 miles per hour heading north is a vector, because the direction matters. In maths, vectors are written as a list of components: (3, 4) in two dimensions, or (1, 2, 3) in three. Each component says how far to move along one axis, and the arrow from the origin to that point is the vector itself. Vectors turn up everywhere: forces in physics, movement in video games, and wind speed in weather forecasts.
Magnitude is the length of the vector — how big it is, ignoring direction. It comes straight from Pythagoras' theorem: square each component, add them up, and take the square root. A vector (3, 4) has magnitude 5, because 3² + 4² = 25 and √25 = 5. In three dimensions, add the square of the z component too.
Adding and subtracting vectors works component by component. To add A and B, add the x values together, then the y values, then the z values. (3, 4) + (1, 2) = (4, 6). Subtracting is the same idea with minus signs: (3, 4) − (1, 2) = (2, 2). Picture it as walking: follow vector A, then follow vector B from where you landed, and the result is the direct route from start to finish — the tip-to-tail method.
The dot product multiplies two vectors and gives back a single number, called a scalar. Multiply matching components and add the results: (3, 4) · (1, 2) = 3 × 1 + 4 × 2 = 11. The dot product measures how much two vectors agree in direction. If it is positive, the angle between them is less than 90 degrees; if it is zero, they are perpendicular; if it is negative, they point mostly in opposite directions. In physics, work is force dot distance.
The cross product is different: it multiplies two 3D vectors and gives back a third vector that is perpendicular to both of them. Its length equals the area of the parallelogram formed by the two vectors. For A = (a₁, a₂, a₃) and B = (b₁, b₂, b₃), the cross product is (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁). For example, (1, 2, 3) × (4, 5, 6) = (−3, 6, −3). It only works in three dimensions, because in two dimensions there is no direction perpendicular to the plane. It is used for torque, magnetic force, and surface normals in computer graphics.
The angle between two vectors comes from combining the dot product with the magnitudes. The cosine of the angle equals the dot product divided by the product of the two magnitudes, so the angle is the inverse cosine of that fraction. The angle between (1, 0) and (0, 1) is 90 degrees, because their dot product is 0 and cos⁻¹(0) = 90°.
A unit vector is a vector with magnitude 1 that points in the same direction as the original. To find it, divide each component by the magnitude. The unit vector of (3, 4) is (0.6, 0.8), because 3 ÷ 5 = 0.6 and 4 ÷ 5 = 0.8. Unit vectors are handy when you care about direction but not size — for example, the direction a light shines.
Worked example
Find the magnitude of the vector (3, 4). This is the 3-4-5 triangle in disguise.
Step 1: Write down the formula for magnitude in two dimensions: |A| = √(x² + y²).
Step 2: Put in the components. x = 3 and y = 4, so |A| = √(3² + 4²).
Step 3: Square each component. 3² = 9 and 4² = 16.
Step 4: Add them. 9 + 16 = 25.
Step 5: Take the square root. √25 = 5.
Try it yourself: choose "2D", pick "Magnitude |A|", enter x = 3 and y = 4, and press Calculate. The tool gives exactly the same answer — |A| = 5. The diagram draws the arrow from the origin to the point (3, 4), and you can see the length of 5 in the same way a 3-4-5 right triangle has a hypotenuse of 5.
FAQ
What is a vector?
A vector is a quantity that has both a size and a direction. A speed of 30 miles per hour is just a number, but a velocity of 30 miles per hour heading north is a vector, because the direction matters. Vectors are written as a list of components, such as (3, 4) in two dimensions or (1, 2, 3) in three dimensions, and each component tells you how far to move along that axis.
How do you find the magnitude of a vector?
The magnitude is the length of the vector, found with Pythagoras' theorem. For a 2D vector (x, y), the magnitude is the square root of x squared plus y squared. For example, the vector (3, 4) has magnitude equal to the square root of 9 plus 16, which is the square root of 25, or 5. In 3D, add the square of the z component under the square root as well.
What is the dot product used for?
The dot product multiplies two vectors to give a single number, and it measures how much the vectors point in the same direction. Multiply matching components and add the results: (3, 4) dot (1, 2) equals 3 times 1 plus 4 times 2, which is 11. A positive dot product means the angle between the vectors is less than 90 degrees, zero means they are perpendicular, and a negative value means they point mostly in opposite directions. In physics it is used to calculate work, which is force dot distance.
What is the cross product, and why does it need 3D?
The cross product multiplies two 3D vectors to give a third vector that is perpendicular to both of them. Its length equals the area of the parallelogram formed by the two vectors. It only works in three dimensions because in 2D there is no direction perpendicular to the plane. For example, (1, 2, 3) cross (4, 5, 6) equals (-3, 6, -3). The cross product is used for torque, magnetic force, and finding the normal to a surface.
How do you find the angle between two vectors?
Use the dot product formula rearranged: the cosine of the angle equals the dot product of the two vectors divided by the product of their magnitudes. Find the dot product, find both magnitudes, divide, and take the inverse cosine. For example, the angle between (1, 0) and (0, 1) is 90 degrees, because their dot product is 0 and the inverse cosine of 0 is 90 degrees. This calculator does all four steps for you and shows the angle in degrees.