Vector Dot Product and Angle Between Two Vectors
Many physics and engineering quantities — work done by a force, projection of one direction onto another, or the angle between two structural members — reduce to the dot product of two vectors. Because the dot product also encodes the cosine of the angle between the vectors, it is a direct route from raw components to a physically meaningful angle.This calculation is a building block used everywhere from computing the component of gravity along an inclined surface to testing whether two vectors are perpendicular (dot product = 0) or nearly parallel (dot product close to the product of the magnitudes).
The dot product is a·b = a_1b_1+a_2b_2+a_3b_3, and the angle between the vectors is θ = arccos(a·b/(|a||b|)). where a_1v, a_2v, a_3v are the components of vector a, b_1v, b_2v, b_3v are the components of vector b, mag_a and mag_b are their magnitudes, and theta_v is the angle between them.
Multiply matching components together and sum them — this is the definition of the dot product.
The magnitude of a vector is the square root of the sum of its squared components, i.e. its length by the Pythagorean theorem in 3D.
Compute the magnitude of the second vector the same way.
The dot product equals |a||b|cos θ, so dividing it by the product of the magnitudes and taking the inverse cosine recovers the angle between the two vectors.
Results
The two vectors here point in noticeably different directions, so the computed angle is a moderate value well short of parallel (near 0) or perpendicular (π/2). A result near zero would mean the vectors are nearly aligned, while a result near π/2 radians would mean they are nearly perpendicular — both useful sanity checks when the vectors represent physical directions like force or velocity.