Addition acts component by component, and scalar multiplication scales every component by the same factor. Together they give the vector space structure: is the diagonal of the parallelogram spanned by the two vectors, stretches it without changing direction (reversing it when is negative), and the zero vector acts as the additive identity. These two operations never produce a scalar β that is precisely what the dot and cross products are for.
Dot Product (Scalar Product)
The two expressions for the same quantity are the algebraic and geometric definitions, and their equality is the bridge between coordinates and angles. The algebraic form costs three multiplications and two additions; the geometric form needs the angle, which is usually what you are solving for.
Example: Dot Product
Find the angle between and .
Numerically , so β slightly obtuse, which the negative dot product already told you before any inverse cosine was taken. Rounding too early moves the angle by nearly a degree, so keep the exact radicals until the last step.
Reading the Dot Product Geometrically
The quantity is the scalar projection of onto : the length of the shadow casts when light shines along . The dot product is that projection multiplied by , and its sign answers three questions at once:
| Sign of | Angle | Geometric reading |
|---|---|---|
| positive | acute, below 90Β° | has a component along |
| zero | exactly 90Β° | the vectors are perpendicular |
| negative | obtuse, above 90Β° | has a component opposing |
Because , the test "" is the cheapest way to prove two vectors are perpendicular: three multiplications instead of an inverse trigonometric function. In physics the same quantity is work, β a force perpendicular to the displacement does no work, which is exactly the zero-dot-product case.
Two practical consequences: the dot product of a vector with itself gives the squared length, , so ; and decomposing into components parallel and perpendicular to uses the projection , which is how least-squares fitting and GramβSchmidt orthogonalisation are built.
Cross Product (Vector Product)
The determinant expansion produces a vector perpendicular to both inputs, with orientation given by the right-hand rule. Its magnitude is the area of the parallelogram the two vectors span β the same parallelogram whose diagonal is from the addition rule.
Example: Cross Product
Find for and .
Check perpendicularity: and . The result really is orthogonal to both inputs, and that dot-product test costs seconds and catches most expansion errors.
The angle comes out of both products at once: , , , so and . Meanwhile , and gives the same angle. The identity holds numerically: .
Properties of Cross Product
Anti-commutativity is a statement about orientation: swapping the order flips the direction, and the magnitude is unchanged because . Distributivity holds, but associativity does not: and are different vectors, related by the identity .
When the Cross Product Vanishes
exactly when , which happens if one vector is the zero vector or if , i.e. the vectors are parallel (or anti-parallel). This gives a coordinate-free collinearity test: three points , , are collinear if and only if . The dot product answers the perpendicularity question, the cross product answers the parallelism question, and neither needs an inverse trigonometric function.
Area of Triangle
For the vectors above, square units. The triangle whose vertices are , , has sides and , so it is exactly half the parallelogram they span.
Area of Parallelogram
Here the area is . If the two vectors are parallel the parallelogram collapses to a line segment and the area is 0, matching the vanishing cross product.
Scalar Triple Product
With , and , the determinant is , so the parallelepiped has volume 5. A value of 0 means the three vectors lie in one plane β the standard coplanarity test. Cyclic permutations leave the value unchanged, while swapping two vectors flips its sign.
Dot vs Cross: Side by Side
| Property | Dot product | Cross product |
|---|---|---|
| Result | scalar | vector |
| Formula | determinant with | |
| Angle use | ||
| Commutative | yes | no, order flips the sign |
| Zero result | vectors perpendicular | vectors parallel |
| Geometric meaning | projection times length | area of the spanned parallelogram |
Computing Products with Python
Both products are short enough to code directly, and the numbers they print match the hand calculations above.
import math
def dot(a, b):
return sum(x * y for x, y in zip(a, b))
def magnitude(v):
return math.sqrt(sum(x * x for x in v))
a = (2, -1, 2)
b = (1, 1, -1)
cos_theta = dot(a, b) / (magnitude(a) * magnitude(b))
print(round(cos_theta, 6), round(math.degrees(math.acos(cos_theta)), 2))
def cross(a, b):
return (
a[1]*b[2] - a[2]*b[1],
a[2]*b[0] - a[0]*b[2],
a[0]*b[1] - a[1]*b[0],
)
a = (1, 2, 3)
b = (2, -1, 1)
c = cross(a, b)
print(c) # (5, 5, -5)
area = 0.5 * sum(x * x for x in c) ** 0.5
print(round(area, 6)) # 4.330127
The first script prints and ; the second prints and the triangle area . A production geometry library performs the same arithmetic in compiled code, but the sign conventions β right-hand rule for the cross product, cosine for the angle β are identical to the ones used here.
Common Mistakes
Dropping the negative components when expanding the determinant
Fix: Write the middle term with an explicit minus sign: -j(a1b3 - a3b1); check the result by dotting it with both inputs.
Using the dot product when a direction is needed
Fix: The dot product returns a scalar; for an axis perpendicular to two vectors you need the cross product.
Assuming the cross product is commutative
Fix: Swap the operands and negate: a Γ b = -(b Γ a); the magnitude survives, the orientation does not.
Key Takeaways
- The dot product is component-wise multiplication summed up, and equals |a||b|cos(theta); it tests perpendicularity.
- The cross product expands a determinant, is perpendicular to both inputs, and its magnitude is the spanned area.
- A zero dot product means right angles; a zero cross product means parallel vectors β each is a coordinate-free test.
- Verify any cross product by taking dot products with both original vectors; both must come out zero.