Three-Dimensional Geometry

Direction Cosines and Direction Ratios of a Line

If α\alpha, β\beta, and γ\gamma are the angles which a vector OP\mathbf{OP} makes with the positive directions of the coordinate axes OXOX, OYOY, and OZOZ respectively, then cos(α)\cos(\alpha), cos(β)\cos(\beta), and cos(γ)\cos(\gamma) are known as the direction cosines of OP\mathbf{OP}. These direction cosines are generally denoted by the letters ll, mm, and nn, such that l=cos(α)l = \cos(\alpha), m=cos(β)m = \cos(\beta), and n=cos(γ)n = \cos(\gamma). The angles α\alpha, β\beta, and γ\gamma are called direction angles and satisfy the condition 0α,β,γπ0 \le \alpha, \beta, \gamma \le \pi. From geometric considerations, the direction cosines relate to the coordinates of point P(x,y,z)P(x, y, z) via:

cos(α)=xOP\cos(\alpha) = \frac{x}{|\mathbf{OP}|} cos(β)=yOP\cos(\beta) = \frac{y}{|\mathbf{OP}|} cos(γ)=zOP\cos(\gamma) = \frac{z}{|\mathbf{OP}|}

Here, OP|\mathbf{OP}| represents the magnitude of the position vector of PP, defined as OP=x2+y2+z2|\mathbf{OP}| = \sqrt{x^2 + y^2 + z^2}.

Squaring and summing the direction cosines yields the fundamental relation:

l2+m2+n2=cos2(α)+cos2(β)+cos2(γ)=x2+y2+z2OP2=x2+y2+z2x2+y2+z2=1l^2 + m^2 + n^2 = \cos^2(\alpha) + \cos^2(\beta) + \cos^2(\gamma) = \frac{x^2 + y^2 + z^2}{|\mathbf{OP}|^2} = \frac{x^2 + y^2 + z^2}{x^2 + y^2 + z^2} = 1

If the position vector is r=OP=xi^+yj^+zk^\mathbf{r} = \mathbf{OP} = x\mathbf{\hat{i}} + y\mathbf{\hat{j}} + z\mathbf{\hat{k}}, then the corresponding unit vector along r\mathbf{r} is given by:

r^=li^+mj^+nk^\mathbf{\hat{r}} = l\mathbf{\hat{i}} + m\mathbf{\hat{j}} + n\mathbf{\hat{k}}

By definition, the direction cosines of the XX-axis are (cos(0),cos(90),cos(90))=(1,0,0)(\cos(0^\circ), \cos(90^\circ), \cos(90^\circ)) = (1, 0, 0). Similarly, the direction cosines of the YY-axis and ZZ-axis are (0,1,0)(0, 1, 0) and (0,0,1)(0, 0, 1), respectively.

Let ll, mm, and nn be the direction cosines of a vector r\mathbf{r}. Any three numbers aa, bb, and cc that are proportional to ll, mm, and nn are called the direction ratios of the vector. Mathematically, this proportion is expressed as:

la=mb=nc=k\frac{l}{a} = \frac{m}{b} = \frac{n}{c} = k

This implies that (l,m,n)=(ka,kb,kc)(l, m, n) = (ka, kb, kc), establishing (a,b,c)(a, b, c) as direction ratios. For example, if (13,13,13)\left(\frac{1}{\sqrt{3}}, -\frac{1}{\sqrt{3}}, \frac{1}{\sqrt{3}}\right) are direction cosines of a vector r\mathbf{r}, then its direction ratios can be expressed as (1,1,1)(1, -1, 1), (1,1,1)(-1, 1, -1), (2,2,2)(2, -2, 2), or generally (λ,λ,λ)(\lambda, -\lambda, \lambda). 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 aa, bb, and cc, let l=λal = \lambda a, m=λbm = \lambda b, and n=λcn = \lambda c for a scalar λ\lambda. Applying the identity l2+m2+n2=1l^2 + m^2 + n^2 = 1 gives:

a2λ2+b2λ2+c2λ2=1a^2\lambda^2 + b^2\lambda^2 + c^2\lambda^2 = 1 λ2(a2+b2+c2)=1\lambda^2(a^2 + b^2 + c^2) = 1 λ=±1a2+b2+c2\lambda = \pm \frac{1}{\sqrt{a^2 + b^2 + c^2}}

Substituting this back into the equations for ll, mm, and nn yields the direction cosines in terms of direction ratios:

l=±aa2+b2+c2l = \pm \frac{a}{\sqrt{a^2 + b^2 + c^2}} m=±ba2+b2+c2m = \pm \frac{b}{\sqrt{a^2 + b^2 + c^2}} n=±ca2+b2+c2n = \pm \frac{c}{\sqrt{a^2 + b^2 + c^2}}

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)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2) can be determined. Let ll, mm, and nn be the direction cosines of line PQPQ, making angles α\alpha, β\beta, and γ\gamma with the XX, YY, and ZZ axes respectively. Dropping perpendiculars from PP and QQ to the XYXY-plane meeting at RR and SS, and drawing a perpendicular from PP to QSQS meeting at NN, forms a right-angled triangle PNQPNQ where PQN=γ\angle PQN = \gamma. In right triangle PNQPNQ:

cos(γ)=NQPQ=z2z1PQ\cos(\gamma) = \frac{NQ}{PQ} = \frac{z_2 - z_1}{PQ}

By similar geometric projections along the other coordinate axes:

cos(α)=x2x1PQ\cos(\alpha) = \frac{x_2 - x_1}{PQ} cos(β)=y2y1PQ\cos(\beta) = \frac{y_2 - y_1}{PQ}

Therefore, the direction cosines of the line segment joining P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2) are:

(x2x1PQ,y2y1PQ,z2z1PQ)\left(\frac{x_2 - x_1}{PQ}, \frac{y_2 - y_1}{PQ}, \frac{z_2 - z_1}{PQ}\right)

where the distance PQPQ is given by:

PQ=(x2x1)2+(y2y1)2+(z2z1)2PQ = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^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 AA with position vector a\mathbf{a} relative to an origin OO, and parallel to a given vector b\mathbf{b}. Let PP be any point on the line with position vector r\mathbf{r}. Since AP\mathbf{AP} is parallel to b\mathbf{b}, AP=λb\mathbf{AP} = \lambda \mathbf{b} for some scalar parameter λ\lambda. By vector addition:

r=OP=OA+AP=a+λb\mathbf{r} = \mathbf{OP} = \mathbf{OA} + \mathbf{AP} = \mathbf{a} + \lambda \mathbf{b}

Thus, the vector equation of the straight line is:

r=a+λb\mathbf{r} = \mathbf{a} + \lambda \mathbf{b}

Here, r\mathbf{r} is the position vector of any point P(x,y,z)P(x, y, z) on the line, given by r=xi^+yj^+zk^\mathbf{r} = x\mathbf{\hat{i}} + y\mathbf{\hat{j}} + z\mathbf{\hat{k}}. In particular, the equation of a straight line through the origin and parallel to b\mathbf{b} is r=λb\mathbf{r} = \lambda \mathbf{b}.

To derive the Cartesian form from the vector form, let the coordinates of the given point AA be (x1,y1,z1)(x_1, y_1, z_1) and the direction ratios of the line be aa, bb, and cc. Let the coordinates of any point PP be (x,y,z)(x, y, z). Writing the position vectors:

r=xi^+yj^+zk^\mathbf{r} = x\mathbf{\hat{i}} + y\mathbf{\hat{j}} + z\mathbf{\hat{k}} a=x1i^+y1j^+z1k^\mathbf{a} = x_1\mathbf{\hat{i}} + y_1\mathbf{\hat{j}} + z_1\mathbf{\hat{k}} b=ai^+bj^+ck^\mathbf{b} = a\mathbf{\hat{i}} + b\mathbf{\hat{j}} + c\mathbf{\hat{k}}

Substituting these into the vector equation and equating the coefficients of i^\mathbf{\hat{i}}, j^\mathbf{\hat{j}}, and k^\mathbf{\hat{k}} gives the parametric equations of the line:

x=x1+λax = x_1 + \lambda a y=y1+λby = y_1 + \lambda b z=z1+λcz = z_1 + \lambda c

Eliminating the parameter λ\lambda yields the Cartesian form:

xx1a=yy1b=zz1c\frac{x - x_1}{a} = \frac{y - y_1}{b} = \frac{z - z_1}{c}

If ll, mm, and nn are the direction cosines of the line, the equation of the line is:

xx1l=yy1m=zz1n\frac{x - x_1}{l} = \frac{y - y_1}{m} = \frac{z - z_1}{n}

Angle Between Two Lines

Let L1L_1 and L2L_2 be two lines passing through the origin with direction ratios a1,b1,c1a_1, b_1, c_1 and a2,b2,c2a_2, b_2, c_2 respectively. Let PP be a point on L1L_1 and QQ be a point on L2L_2. The directed line segments OPOP and OQOQ are vectors with components a1,b1,c1a_1, b_1, c_1 and a2,b2,c2a_2, b_2, c_2. The acute angle θ\theta between them is given by:

cos(θ)=a1a2+b1b2+c1c2a12+b12+c12a22+b22+c22\cos(\theta) = \left| \frac{a_1 a_2 + b_1 b_2 + c_1 c_2}{\sqrt{a_1^2 + b_1^2 + c_1^2}\sqrt{a_2^2 + b_2^2 + c_2^2}} \right|

Using sin(θ)=1cos2(θ)\sin(\theta) = \sqrt{1 - \cos^2(\theta)}, the angle in terms of sin(θ)\sin(\theta) is:

sin(θ)=1(a1a2+b1b2+c1c2)2(a12+b12+c12)(a22+b22+c22)\sin(\theta) = \sqrt{1 - \frac{(a_1 a_2 + b_1 b_2 + c_1 c_2)^2}{(a_1^2 + b_1^2 + c_1^2)(a_2^2 + b_2^2 + c_2^2)}} sin(θ)=(a12+b12+c12)(a22+b22+c22)(a1a2+b1b2+c1c2)2a12+b12+c12a22+b22+c22\sin(\theta) = \frac{\sqrt{(a_1^2 + b_1^2 + c_1^2)(a_2^2 + b_2^2 + c_2^2) - (a_1 a_2 + b_1 b_2 + c_1 c_2)^2}}{\sqrt{a_1^2 + b_1^2 + c_1^2}\sqrt{a_2^2 + b_2^2 + c_2^2}} sin(θ)=(a1b2a2b1)2+(b1c2b2c1)2+(c1a2c2a1)2a12+b12+c12a22+b22+c22\sin(\theta) = \frac{\sqrt{(a_1 b_2 - a_2 b_1)^2 + (b_1 c_2 - b_2 c_1)^2 + (c_1 a_2 - c_2 a_1)^2}}{\sqrt{a_1^2 + b_1^2 + c_1^2}\sqrt{a_2^2 + b_2^2 + c_2^2}}

If direction cosines l1,m1,n1l_1, m_1, n_1 for L1L_1 and l2,m2,n2l_2, m_2, n_2 for L2L_2 are given instead of direction ratios, using l12+m12+n12=1=l22+m22+n22l_1^2 + m_1^2 + n_1^2 = 1 = l_2^2 + m_2^2 + n_2^2, the expressions take the following forms:

cos(θ)=l1l2+m1m2+n1n2\cos(\theta) = |l_1 l_2 + m_1 m_2 + n_1 n_2| sin(θ)=(l1m2l2m1)2+(m1n2m2n1)2+(n1l2n2l1)2\sin(\theta) = \sqrt{(l_1 m_2 - l_2 m_1)^2 + (m_1 n_2 - m_2 n_1)^2 + (n_1 l_2 - n_2 l_1)^2}

Two lines with direction ratios a1,b1,c1a_1, b_1, c_1 and a2,b2,c2a_2, b_2, c_2 satisfy key conditions for orientation. They are perpendicular (θ=90\theta = 90^\circ) if:

a1a2+b1b2+c1c2=0a_1 a_2 + b_1 b_2 + c_1 c_2 = 0

They are parallel (θ=0\theta = 0^\circ) if:

a1a2=b1b2=c1c2\frac{a_1}{a_2} = \frac{b_1}{b_2} = \frac{c_1}{c_2}

If θ\theta is the acute angle between lines given in vector form r=a1+λb1\mathbf{r} = \mathbf{a}_1 + \lambda \mathbf{b}_1 and r=a2+μb2\mathbf{r} = \mathbf{a}_2 + \mu \mathbf{b}_2, the cosine of the angle is:

cos(θ)=b1b2b1b2\cos(\theta) = \left| \frac{\mathbf{b}_1 \cdot \mathbf{b}_2}{|\mathbf{b}_1||\mathbf{b}_2|} \right|

In Cartesian form, given two straight lines:

xx1a1=yy1b1=zz1c1\frac{x - x_1}{a_1} = \frac{y - y_1}{b_1} = \frac{z - z_1}{c_1} xx2a2=yy2b2=zz2c2\frac{x - x_2}{a_2} = \frac{y - y_2}{b_2} = \frac{z - z_2}{c_2}

The direction vectors are b1=a1i^+b1j^+c1k^\mathbf{b}_1 = a_1\mathbf{\hat{i}} + b_1\mathbf{\hat{j}} + c_1\mathbf{\hat{k}} and b2=a2i^+b2j^+c2k^\mathbf{b}_2 = a_2\mathbf{\hat{i}} + b_2\mathbf{\hat{j}} + c_2\mathbf{\hat{k}}. The dot product is b1b2=a1a2+b1b2+c1c2\mathbf{b}_1 \cdot \mathbf{b}_2 = a_1 a_2 + b_1 b_2 + c_1 c_2, 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:

cos(θ)=a1a2+b1b2+c1c2a12+b12+c12a22+b22+c22\cos(\theta) = \frac{a_1 a_2 + b_1 b_2 + c_1 c_2}{\sqrt{a_1^2 + b_1^2 + c_1^2}\sqrt{a_2^2 + b_2^2 + c_2^2}}

The condition for perpendicularity is b1b2=0    a1a2+b1b2+c1c2=0\mathbf{b}_1 \cdot \mathbf{b}_2 = 0 \implies a_1 a_2 + b_1 b_2 + c_1 c_2 = 0. The condition for parallelism is b1=λb2    a1a2=b1b2=c1c2\mathbf{b}_1 = \lambda \mathbf{b}_2 \implies \frac{a_1}{a_2} = \frac{b_1}{b_2} = \frac{c_1}{c_2}.

Shortest Distance Between Two Lines

If l1l_1 and l2l_2 are two skew lines, there is one and only one line perpendicular to both l1l_1 and l2l_2, known as the line of shortest distance. The distance PQPQ along this perpendicular is the shortest distance. Let l1l_1 and l2l_2 be two lines whose vector equations are r=a1+λb1\mathbf{r} = \mathbf{a}_1 + \lambda \mathbf{b}_1 and r=a2+μb2\mathbf{r} = \mathbf{a}_2 + \mu \mathbf{b}_2. These lines pass through points AA and BB with position vectors a1\mathbf{a}_1 and a2\mathbf{a}_2 respectively, and are parallel to vectors b1\mathbf{b}_1 and b2\mathbf{b}_2. Since PQPQ is perpendicular to both l1l_1 and l2l_2, it is parallel to b1×b2\mathbf{b}_1 \times \mathbf{b}_2. Let n^\mathbf{\hat{n}} be a unit vector along PQPQ:

n^=±b1×b2b1×b2\mathbf{\hat{n}} = \pm \frac{\mathbf{b}_1 \times \mathbf{b}_2}{|\mathbf{b}_1 \times \mathbf{b}_2|}

The shortest distance PQPQ equals the magnitude of the projection of AB\mathbf{AB} on PQPQ:

PQ=ABn^=±(a2a1)b1×b2b1×b2=(b1×b2)(a2a1)b1×b2PQ = |\mathbf{AB} \cdot \mathbf{\hat{n}}| = \left| \pm (\mathbf{a}_2 - \mathbf{a}_1) \cdot \frac{\mathbf{b}_1 \times \mathbf{b}_2}{|\mathbf{b}_1 \times \mathbf{b}_2|} \right| = \left| \frac{(\mathbf{b}_1 \times \mathbf{b}_2) \cdot (\mathbf{a}_2 - \mathbf{a}_1)}{|\mathbf{b}_1 \times \mathbf{b}_2|} \right|

In scalar triple product form, this is expressed as:

d=[b1b2(a2a1)]b1×b2d = \frac{|[\mathbf{b}_1\, \mathbf{b}_2\, (\mathbf{a}_2 - \mathbf{a}_1)]|}{|\mathbf{b}_1 \times \mathbf{b}_2|}

Two lines intersect if and only if the shortest distance between them is zero. Setting d=0d = 0 gives the condition for intersection:

(b1×b2)(a2a1)=0(\mathbf{b}_1 \times \mathbf{b}_2) \cdot (\mathbf{a}_2 - \mathbf{a}_1) = 0

In Cartesian form, let the two skew lines be:

xx1a1=yy1b1=zz1c1\frac{x - x_1}{a_1} = \frac{y - y_1}{b_1} = \frac{z - z_1}{c_1} xx2a2=yy2b2=zz2c2\frac{x - x_2}{a_2} = \frac{y - y_2}{b_2} = \frac{z - z_2}{c_2}

The vector equations for these lines are r=(x1i^+y1j^+z1k^)+λ(a1i^+b1j^+c1k^)\mathbf{r} = (x_1\mathbf{\hat{i}} + y_1\mathbf{\hat{j}} + z_1\mathbf{\hat{k}}) + \lambda(a_1\mathbf{\hat{i}} + b_1\mathbf{\hat{j}} + c_1\mathbf{\hat{k}}) and r=(x2i^+y2j^+z2k^)+μ(a2i^+b2j^+c2k^)\mathbf{r} = (x_2\mathbf{\hat{i}} + y_2\mathbf{\hat{j}} + z_2\mathbf{\hat{k}}) + \mu(a_2\mathbf{\hat{i}} + b_2\mathbf{\hat{j}} + c_2\mathbf{\hat{k}}). Applying (a2a1)(b1×b2)b1×b2\frac{(\mathbf{a}_2 - \mathbf{a}_1) \cdot (\mathbf{b}_1 \times \mathbf{b}_2)}{|\mathbf{b}_1 \times \mathbf{b}_2|} yields the shortest distance formula dd in Cartesian form:

d=x2x1y2y1z2z1a1b1c1a2b2c2(b1c2b2c1)2+(c1a2a1c2)2+(a1b2a2b1)2d = \left| \frac{\begin{vmatrix} x_2 - x_1 & y_2 - y_1 & z_2 - z_1 \\ a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \end{vmatrix}}{\sqrt{(b_1 c_2 - b_2 c_1)^2 + (c_1 a_2 - a_1 c_2)^2 + (a_1 b_2 - a_2 b_1)^2}} \right|

Let l1l_1 and l2l_2 be two parallel lines whose equations are r=a1+λb\mathbf{r} = \mathbf{a}_1 + \lambda \mathbf{b} and r=a2+μb\mathbf{r} = \mathbf{a}_2 + \mu \mathbf{b} respectively. The lines pass through points AA and BB with position vectors a1\mathbf{a}_1 and a2\mathbf{a}_2 respectively, and both are parallel to b\mathbf{b}. Let BMBM be the shortest distance between l1l_1 and l2l_2, and let θ\theta be the angle between AB\mathbf{AB} and l1l_1. In right triangle AMBAMB:

sin(θ)=BMAB    BM=ABsin(θ)=ABsin(θ)\sin(\theta) = \frac{BM}{AB} \implies BM = AB \sin(\theta) = |\mathbf{AB}| \sin(\theta)

Using the definition of cross product:

AB×b=ABbsin(πθ)=ABbsin(θ)=(ABsin(θ))b=BMb|\mathbf{AB} \times \mathbf{b}| = |\mathbf{AB}||\mathbf{b}| \sin(\pi - \theta) = |\mathbf{AB}||\mathbf{b}| \sin(\theta) = (|\mathbf{AB}| \sin(\theta))|\mathbf{b}| = BM |\mathbf{b}|

Solving for BMBM yields:

BM=AB×bb=(a2a1)×bbBM = \frac{|\mathbf{AB} \times \mathbf{b}|}{|\mathbf{b}|} = \frac{|(\mathbf{a}_2 - \mathbf{a}_1) \times \mathbf{b}|}{|\mathbf{b}|}

Therefore, the shortest distance dd between two parallel lines r=a1+λb\mathbf{r} = \mathbf{a}_1 + \lambda \mathbf{b} and r=a2+μb\mathbf{r} = \mathbf{a}_2 + \mu \mathbf{b} is:

d=(a2a1)×bbd = \frac{|(\mathbf{a}_2 - \mathbf{a}_1) \times \mathbf{b}|}{|\mathbf{b}|}