If α, β, and γ are the angles which a vector OP makes with the positive directions of the coordinate axes OX, OY, and OZ respectively, then cos(α), cos(β), and cos(γ) are known as the direction cosines of OP. These direction cosines are generally denoted by the letters l, m, and n, such that l=cos(α), m=cos(β), and n=cos(γ). The angles α, β, and γ are called direction angles and satisfy the condition 0≤α,β,γ≤π. From geometric considerations, the direction cosines relate to the coordinates of point P(x,y,z) via:
cos(α)=∣OP∣xcos(β)=∣OP∣ycos(γ)=∣OP∣z
Here, ∣OP∣ represents the magnitude of the position vector of P, defined as ∣OP∣=x2+y2+z2.
Squaring and summing the direction cosines yields the fundamental relation:
If the position vector is r=OP=xi^+yj^+zk^, then the corresponding unit vector along r is given by:
r^=li^+mj^+nk^
By definition, the direction cosines of the X-axis are (cos(0∘),cos(90∘),cos(90∘))=(1,0,0). Similarly, the direction cosines of the Y-axis and Z-axis are (0,1,0) and (0,0,1), respectively.
Let l, m, and n be the direction cosines of a vector r. Any three numbers a, b, and c that are proportional to l, m, and n are called the direction ratios of the vector. Mathematically, this proportion is expressed as:
al=bm=cn=k
This implies that (l,m,n)=(ka,kb,kc), establishing (a,b,c) as direction ratios. For example, if (31,−31,31) are direction cosines of a vector r, then its direction ratios can be expressed as (1,−1,1), (−1,1,−1), (2,−2,2), or generally (λ,−λ,λ). To obtain direction ratios from direction cosines, one simply multiplies the direction cosines by a common non-zero scalar. Consequently, a given vector possesses infinitely many direction ratios, whereas its direction cosines are strictly unique.
To obtain direction cosines from direction ratios a, b, and c, let l=λa, m=λb, and n=λc for a scalar λ. Applying the identity l2+m2+n2=1 gives:
a2λ2+b2λ2+c2λ2=1λ2(a2+b2+c2)=1λ=±a2+b2+c21
Substituting this back into the equations for l, m, and n yields the direction cosines in terms of direction ratios:
l=±a2+b2+c2am=±a2+b2+c2bn=±a2+b2+c2c
Direction Cosines of a Line Passing Through Two Points
Since exactly one straight line passes through two distinct given points, the direction cosines of a line passing through P(x1,y1,z1) and Q(x2,y2,z2) can be determined. Let l, m, and n be the direction cosines of line PQ, making angles α, β, and γ with the X, Y, and Z axes respectively. Dropping perpendiculars from P and Q to the XY-plane meeting at R and S, and drawing a perpendicular from P to QS meeting at N, forms a right-angled triangle PNQ where ∠PQN=γ. In right triangle PNQ:
cos(γ)=PQNQ=PQz2−z1
By similar geometric projections along the other coordinate axes:
cos(α)=PQx2−x1cos(β)=PQy2−y1
Therefore, the direction cosines of the line segment joining P(x1,y1,z1) and Q(x2,y2,z2) are:
(PQx2−x1,PQy2−y1,PQz2−z1)
where the distance PQ is given by:
PQ=(x2−x1)2+(y2−y1)2+(z2−z1)2
Equation of a Line in Space
A straight line in space is specified basically in two ways: passing through a given point and parallel to a given vector, or passing through two given points. Consider a line passing through a given point A with position vector a relative to an origin O, and parallel to a given vector b. Let P be any point on the line with position vector r. Since AP is parallel to b, AP=λb for some scalar parameter λ. By vector addition:
r=OP=OA+AP=a+λb
Thus, the vector equation of the straight line is:
r=a+λb
Here, r is the position vector of any point P(x,y,z) on the line, given by r=xi^+yj^+zk^. In particular, the equation of a straight line through the origin and parallel to b is r=λb.
To derive the Cartesian form from the vector form, let the coordinates of the given point A be (x1,y1,z1) and the direction ratios of the line be a, b, and c. Let the coordinates of any point P be (x,y,z). Writing the position vectors:
r=xi^+yj^+zk^a=x1i^+y1j^+z1k^b=ai^+bj^+ck^
Substituting these into the vector equation and equating the coefficients of i^, j^, and k^ gives the parametric equations of the line:
x=x1+λay=y1+λbz=z1+λc
Eliminating the parameter λ yields the Cartesian form:
ax−x1=by−y1=cz−z1
If l, m, and n are the direction cosines of the line, the equation of the line is:
lx−x1=my−y1=nz−z1
Angle Between Two Lines
Let L1 and L2 be two lines passing through the origin with direction ratios a1,b1,c1 and a2,b2,c2 respectively. Let P be a point on L1 and Q be a point on L2. The directed line segments OP and OQ are vectors with components a1,b1,c1 and a2,b2,c2. The acute angle θ between them is given by:
If direction cosines l1,m1,n1 for L1 and l2,m2,n2 for L2 are given instead of direction ratios, using l12+m12+n12=1=l22+m22+n22, the expressions take the following forms:
The direction vectors are b1=a1i^+b1j^+c1k^ and b2=a2i^+b2j^+c2k^. The dot product is b1⋅b2=a1a2+b1b2+c1c2, and magnitudes are $|\mathbf{b}_1| = \sqrt{a_1^2 + b_1^2 + c_1^2}, $|\mathbf{b}_2| = \sqrt{a_2^2 + b_2^2 + c_2^2}. Thus:
The condition for perpendicularity is b1⋅b2=0⟹a1a2+b1b2+c1c2=0. The condition for parallelism is b1=λb2⟹a2a1=b2b1=c2c1.
Shortest Distance Between Two Lines
If l1 and l2 are two skew lines, there is one and only one line perpendicular to both l1 and l2, known as the line of shortest distance. The distance PQ along this perpendicular is the shortest distance. Let l1 and l2 be two lines whose vector equations are r=a1+λb1 and r=a2+μb2. These lines pass through points A and B with position vectors a1 and a2 respectively, and are parallel to vectors b1 and b2. Since PQ is perpendicular to both l1 and l2, it is parallel to b1×b2. Let n^ be a unit vector along PQ:
n^=±∣b1×b2∣b1×b2
The shortest distance PQ equals the magnitude of the projection of AB on PQ:
The vector equations for these lines are r=(x1i^+y1j^+z1k^)+λ(a1i^+b1j^+c1k^) and r=(x2i^+y2j^+z2k^)+μ(a2i^+b2j^+c2k^). Applying ∣b1×b2∣(a2−a1)⋅(b1×b2) yields the shortest distance formula d in Cartesian form:
Let l1 and l2 be two parallel lines whose equations are r=a1+λb and r=a2+μb respectively. The lines pass through points A and B with position vectors a1 and a2 respectively, and both are parallel to b. Let BM be the shortest distance between l1 and l2, and let θ be the angle between AB and l1. In right triangle AMB: