Vector calculator
Enter two vectors, get the dot and cross products.
How do I find the dot product?
Multiply matching components and add: ⟨1, 2, 3⟩ · ⟨4, 5, 6⟩ = 4 + 10 + 18 = 32.
How do I find the angle between two vectors?
cos θ = (a · b) ÷ (|a| × |b|). For the vectors above, 32 ÷ (3.742 × 8.775) gives θ ≈ 12.93°.
How do I find the cross product?
For 3D vectors, a × b = ⟨a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁⟩: ⟨1, 2, 3⟩ × ⟨4, 5, 6⟩ = ⟨−3, 6, −3⟩. Its length is the area of the parallelogram the vectors span.
How do I find the length (magnitude) of a vector?
The square root of the sum of squared components: |⟨3, 4⟩| = √(9 + 16) = 5.
How can I tell if vectors are perpendicular?
Their dot product is 0: ⟨3, 4⟩ · ⟨4, −3⟩ = 12 − 12 = 0, so they meet at 90°.
How do I find the area of a triangle from its vertices?
Subtract to get two sides from one vertex, take their cross product, and halve its length (OpenStax Calculus Volume 3, section 2.4). For P(1, 0, 0), Q(0, 1, 0) and R(0, 0, 1) the sides are ⟨−1, 1, 0⟩ and ⟨−1, 0, 1⟩, the cross product is ⟨1, 1, 1⟩ with length 1.7321, and the triangle has area 0.8660, which is √3/2.
Does the order of the two vectors matter?
Not for the dot product, the lengths or the angle. For the cross product it does: a × b = −(b × a). For ⟨−1, 2, 5⟩ and ⟨4, 0, −3⟩ the result is ⟨−6, 17, −8⟩ one way and ⟨6, −17, 8⟩ the other. The projection of a on b also differs from that of b on a.
What is the projection the calculator shows?
The scalar projection of a on b, a · b ÷ |b|: the signed length of a’s shadow along b, negative above 90°. The vector projection is (a · b ÷ |b|²) b. For ⟨3, 5, 1⟩ on ⟨−1, 4, 3⟩ the scalar projection is 3.9223 and the vector projection is ⟨−0.7692, 3.0769, 2.3077⟩, the book’s ⟨−10/13, 40/13, 30/13⟩.
What each result means
The dot product a · b = a₁b₁ + a₂b₂ + a₃b₃ is a number equal to |a||b| cos θ, where θ is the angle between the vectors, from 0° to 180°; two nonzero vectors are perpendicular exactly when it is 0 (OpenStax Calculus Volume 3, section 2.3). The cross product exists for 3D vectors, is perpendicular to both, and has length |a||b| sin θ, the area of the parallelogram on a and b (section 2.4). For 2D input the vectors are treated as lying in the plane z = 0, so only the z-component a₁b₂ − a₂b₁ is shown. The angle and unit vector need nonzero vectors.
Worked example: ⟨−1, 2, 5⟩ and ⟨4, 0, −3⟩
These are the vectors of OpenStax Example 2.31. The dot product is (−1)(4) + 2(0) + 5(−3) = −19. The lengths are |p| = √30 = 5.4772 and |q| = 5, so cos θ = −19 ÷ (5.4772 × 5) and θ = 133.93°, an obtuse angle because the dot product is negative. The cross product is ⟨−6, 17, −8⟩, of length 19.7231. As a check, |p||q| sin θ = 19.7231, the same number. And ⟨2, 5, 6⟩ with ⟨−2, −4, 4⟩ gives a dot product of 0, so those two are perpendicular.
Common mistakes
Reversing the order in a cross product flips its sign, so keep a first. Reading a zero dot product as “perpendicular” fails if one vector is the zero vector, which has no direction. A cross product of zero means the vectors are parallel, not that one of them is zero. The angle returned is never above 180°.
Sources: OpenStax, Calculus Volume 3, section 2.3 “The Dot Product” and section 2.4 “The Cross Product” (definitions, projections, Examples 2.31 and 2.39). Related tools: matrix calculator, triangle calculator, distance formula calculator and polygon area from coordinates. How we check our calculators.