Skip to the calculator
Rule Calculator

Dot and Cross Product

With a — x 1, a — y 2, a — z 3, b — x 4 and 2 more fields, dot and cross product comes to 32.0000 — dot product. It is reached in 8 steps, the last of which is 1 * 4 + 2 * 5 + 3 * 6, and each one is printed on the page with its numbers filled in. The formula is the one published by NIST Digital Library of Mathematical Functions, not an approximation fitted to it.

Dot product, cross product, magnitudes and the angle between two 3-D vectors. The dot returns a number, the cross returns a vector — that is the difficulty.

Formula and sources checked · How we check

a — x 1, a — y 2, a — z 3, b — x 4

32.0000

Dot product for the example below. Editing a field recomputes the calculator below; this figure holds the answer the page was loaded with.

It is written into the HTML rather than drawn by a script, so a search engine reading this page without running JavaScript still finds an answer.

Dot product
32.0000
Dot product, a · b
1 * 4 + 2 * 5 + 3 * 632
Cross product, x component
2 * 6 - 3 * 5-3
Cross product, y component
3 * 4 - 1 * 66
Cross product, z component
1 * 5 - 2 * 4-3
Length of a
sqrt(1 * 1 + 2 * 2 + 3 * 3)3.742
Length of b
sqrt(4 * 4 + 5 * 5 + 6 * 6)8.775
Length of the cross product
sqrt(-3 * -3 + 6 * 6 + -3 * -3)7.348
Angle between them
acos(max(-1, min(1, 32 / (3.7416574 * 8.7749644)))) * 180 / pi12.933 deg

Ask about this in the chat

Worked example

(1, 2, 3) · (4, 5, 6) = 32, and their cross product is (−3, 6, −3). The dot is a single number; the cross is a vector perpendicular to both, and its length 7.348 is the area of the parallelogram the two vectors span.

How to work it out yourself

  1. 1.Use the dot product for projection and for angles. It is positive when the vectors point the same way, zero when they are perpendicular, and negative when they oppose.
  2. 2.Use the cross product for a direction perpendicular to both — a surface normal, a torque, a magnetic force. Its length is the area of the parallelogram the two vectors span.
  3. 3.The cross product is anti-commutative: b × a is the negative of a × b. The dot product does not care about order.
  4. 4.For two-dimensional vectors, set the z components to zero. The dot product works unchanged and the cross product collapses to its z component alone, which is the signed area.

Dot product against the z component of b

01632-6 b — z: -4-4 b — z: 2-2 b — z: 8-1 b — z: 110 b — z: 141 b — z: 172 b — z: 203 b — z: 234 b — z: 265 b — z: 296 b — z: 32-66b — z
Dot product against the z component of b
b — zDot productAngle between themLength of the cross product
-6-4.000097 deg32.59
-42.000085.94 deg28.18
-28.000071.41 deg23.79
-111.000063.02 deg21.61
014.000054.24 deg19.44
117.000045.49 deg17.29
220.000037.17 deg15.17
323.000029.62 deg13.08
426.000023.02 deg11.05
529.000017.44 deg9.11
632.000012.93 deg7.35

The dot product passes through zero exactly where the angle passes through 90°. That is the test the dot product exists for: two vectors are perpendicular if and only if their dot product is zero.

The formula

  1. Dot product, a · b1 * 4 + 2 * 5 + 3 * 6
  2. Cross product, x component2 * 6 - 3 * 5
  3. Cross product, y component3 * 4 - 1 * 6
  4. Cross product, z component1 * 5 - 2 * 4
  5. Length of asqrt(1 * 1 + 2 * 2 + 3 * 3)
  6. Length of bsqrt(4 * 4 + 5 * 5 + 6 * 6)
  7. Length of the cross productsqrt(-3 * -3 + 6 * 6 + -3 * -3)
  8. Angle between themacos(max(-1, min(1, 32 / (3.7416574 * 8.7749644)))) * 180 / pi

Source: NIST Digital Library of Mathematical Functions — vectors and vector operations, NIST SP 811 — vector quantities and their units

Questions people actually ask

What is the difference between the dot and cross product?
The dot product returns a number, the cross product returns a vector. The dot measures how much two vectors point the same way; the cross produces a third vector perpendicular to both, with a length equal to the area they span. The dot exists in any number of dimensions; the cross product is specific to three.
How do you find the angle between two vectors?
cos θ = (a · b) ÷ (|a| |b|), then take the inverse cosine. For (1, 2, 3) and (4, 5, 6) that gives 12.93°. The formula fails if either vector has zero length, because a point has no direction.
What does a dot product of zero mean?
The vectors are perpendicular — or one of them is the zero vector. It is the cleanest test for a right angle there is, and it needs no trigonometry at all.
What is the right-hand rule?
Point the fingers of your right hand along a, curl them towards b, and your thumb points along a × b. It fixes the sign, which the algebra alone does not: the same two vectors could have a perpendicular pointing either way.
Can you take a cross product in two dimensions?
Not properly. Treating 2-D vectors as 3-D ones with z = 0 gives a cross product pointing purely along z, and that single number — ax·by − ay·bx — is the signed area of the parallelogram. It is used constantly in graphics for deciding which side of a line a point falls on.

Related

Put this calculator on your site

Free, no attribution required beyond the link.

<iframe src="https://rulecalculators.com/embed/vector-product" width="100%" height="420" style="border:1px solid #e7e4de;border-radius:12px" title="Dot and Cross Product"></iframe>
Did this answer your question?