Vector calculator: magnitude, dot and cross product
Work out the magnitude, sum, difference, dot product and cross product of two vectors in 2D or 3D, the angle between them and the projection of one on the other.
A vector has magnitude (size), direction and sense: a force, a velocity, a displacement. It is written with its components along the axes, u = (ux, uy, uz). With two vectors, the calculator gives their magnitudes, sum and difference, dot product, cross product, the angle between them and the projection of one on the other, on the plane (z = 0) or in space. Drag the arrow tips on the drawing to see everything change.
Magnitude, sum and difference
They are added component by component; on the drawing it is the parallelogram rule (or placing one vector after the other). The sum of forces is the resultant. Example: u = (3, 4) has magnitude 5; with v = (4, −1), u + v = (7, 3), magnitude 7.62.
Dot product and angle
It gives a number. It is positive if the vectors make less than 90°, zero if they are perpendicular and negative if more. Solving, cos θ = u · v / (|u| · |v|). With (3, 4) and (4, −1): u · v = 12 − 4 = 8 and θ = arccos(8 / (5 · 4.123)) = 67.2°. The work of a force is a dot product: W = F · d.
The projection is the shadow of u on the direction of v: 8 / 4.123 = 1.94.
Cross product
It gives a vector perpendicular to both, with the sense of the right-hand rule, and its magnitude is the area of the parallelogram they form. It only exists in 3D (in 2D only the z component comes out). It is the moment of a force (M = r × F) and the force on a charge or a conductor in a magnetic field (F = q · v × B).
Several ways to get each value
- Everything from the components of both vectors. Drag their tips on the drawing.
- A missing component from the magnitude: enter the magnitude of u and clear, for example, uy. With ux = 5 and |u| = 13, uy = 12.
- From magnitude and angle to components: ux = |u| · cos α, uy = |u| · sin α (α from the x axis); the angle of u with the x axis is in the results.
Frequently asked questions
How is the magnitude of a vector calculated?
With Pythagoras: |u| = √(ux² + uy² + uz²). The vector (3, 4) has magnitude √(9 + 16) = 5.
How is the dot product calculated?
Multiply component by component and add: u · v = ux·vx + uy·vy + uz·vz. With (3, 4) and (4, −1): 12 − 4 = 8. If it is zero, the vectors are perpendicular.
What angle do two vectors make?
cos θ = u · v / (|u| · |v|). With (3, 4) and (4, −1): 8 / (5 · 4.123) = 0.388, θ = 67.2°.
What is the cross product used for?
It gives a vector perpendicular to both, with magnitude equal to the area of the parallelogram they form. In physics it is the moment of a force (M = r × F) or the force on a conductor in a magnetic field.
