← Back to all lessons
Class 12Geometry21:23Published 3 Mar 2024

3D Geometry Formulae (Part 1)

A formula walkthrough of three dimensional geometry: direction cosines and ratios, the equations of a line, the angle between two lines, and the distance between skew and parallel lines.

This Class 12 lesson sets up the standard formula sheet for three dimensional geometry. It starts with direction cosines and direction ratios and the relation between them, then builds the vector and Cartesian equations of a line through a point and through two points. From there it covers the angle between two lines, the conditions for lines to be perpendicular or parallel, and finishes with the distance between two skew lines and between two parallel lines.

What you'll learn

  • How direction cosines and direction ratios are defined and how they relate to each other
  • The vector and Cartesian equations of a line through a point and through two points
  • How to find the angle between two lines and the conditions for them to be perpendicular or parallel
  • How to find the distance between two skew lines and between two parallel lines

Lesson chapters

0:00The three axes and direction cosines
1:10Direction ratios and their relation to cosines
3:44Equation of a line through a point
6:36Equation of a line through two points
8:28Angle between two lines
11:01Perpendicular and parallel conditions
16:32Distance between skew and parallel lines

Lesson notes

This lesson collects the key formulae of three dimensional geometry: direction cosines and ratios, the equations of a line, the angle between two lines, and the distances involving skew and parallel lines.

The three axes and direction cosines

In three dimensions there are three mutually perpendicular axes: the xx, yy and zz axes. A line in space makes angles α\alpha, β\beta, γ\gamma with these axes. These are the direction angles, and their cosines are the direction cosines, written ll, mm, nn:

l=cosα,m=cosβ,n=cosγl = \cos\alpha, \qquad m = \cos\beta, \qquad n = \cos\gamma

The direction cosines always satisfy

l2+m2+n2=1,l^2 + m^2 + n^2 = 1,

which is the same as

cos2α+cos2β+cos2γ=1.\cos^2\alpha + \cos^2\beta + \cos^2\gamma = 1.

Direction ratios

Numbers proportional to the direction cosines are called direction ratios, written aa, bb, cc. The direction cosines are recovered from them by dividing by the length:

l=±aa2+b2+c2,m=±ba2+b2+c2,n=±ca2+b2+c2.l = \pm\frac{a}{\sqrt{a^2 + b^2 + c^2}}, \qquad m = \pm\frac{b}{\sqrt{a^2 + b^2 + c^2}}, \qquad n = \pm\frac{c}{\sqrt{a^2 + b^2 + c^2}}.

The sign depends on the octant, but in most cases we take the positive values.

Equation of a line through a point

For a line through the point P(x1,y1,z1)P(x_1, y_1, z_1) and parallel to a vector b\vec b, there are two forms.

Vector form. With a\vec a the position vector of PP,

r=a+λb.\vec r = \vec a + \lambda\,\vec b.

Cartesian form. With aa, bb, cc the direction ratios of the parallel vector,

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

Equation of a line through two points

For a line through P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2), with position vectors a\vec a and b\vec b:

Vector form.

r=a+λ(ba).\vec r = \vec a + \lambda\,(\vec b - \vec a).

Cartesian form.

xx1x2x1=yy1y2y1=zz1z2z1.\frac{x - x_1}{x_2 - x_1} = \frac{y - y_1}{y_2 - y_1} = \frac{z - z_1}{z_2 - z_1}.

Angle between two lines

Take two lines with direction vectors b1\vec b_1 and b2\vec b_2, or direction ratios a1,b1,c1a_1, b_1, c_1 and a2,b2,c2a_2, b_2, c_2.

Vector form.

cosθ=b1b2b1b2.\cos\theta = \frac{\vec b_1 \cdot \vec b_2}{|\vec b_1|\,|\vec b_2|}.

Cartesian form.

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}}.

Perpendicular and parallel conditions

Perpendicular lines. The lines meet at right angles when

b1b2=0,ora1a2+b1b2+c1c2=0.\vec b_1 \cdot \vec b_2 = 0, \qquad \text{or} \qquad a_1 a_2 + b_1 b_2 + c_1 c_2 = 0.

Parallel lines. The direction vectors are proportional:

b1×b2=0,orb1=λb2,\vec b_1 \times \vec b_2 = \vec 0, \qquad \text{or} \qquad \vec b_1 = \lambda\,\vec b_2,

which in Cartesian form is

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

Distance between skew and parallel lines

Skew lines. For r=a1+λb1\vec r = \vec a_1 + \lambda\,\vec b_1 and r=a2+μb2\vec r = \vec a_2 + \mu\,\vec b_2 (here b1\vec b_1 and b2\vec b_2 differ), the shortest distance is

d=(b1×b2)(a2a1)b1×b2.d = \frac{\bigl|(\vec b_1 \times \vec b_2) \cdot (\vec a_2 - \vec a_1)\bigr|}{|\vec b_1 \times \vec b_2|}.

In Cartesian form this is

d=x2x1y2y1z2z1a1b1c1a2b2c2(a1b2a2b1)2+(b1c2b2c1)2+(c1a2c2a1)2.d = \frac{\left| \begin{matrix} 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{matrix} \right|}{\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}}.

Parallel lines. For r=a1+λb\vec r = \vec a_1 + \lambda\,\vec b and r=a2+μb\vec r = \vec a_2 + \mu\,\vec b (the same b\vec b), the distance is

d=b×(a2a1)b.d = \frac{\bigl|\vec b \times (\vec a_2 - \vec a_1)\bigr|}{|\vec b|}.

Key takeaways

  • Direction cosines satisfy l2+m2+n2=1l^2 + m^2 + n^2 = 1, and direction ratios are any numbers proportional to them.
  • A line is fixed by a point and a direction, giving matching vector and Cartesian equations.
  • Two lines are perpendicular when b1b2=0\vec b_1 \cdot \vec b_2 = 0 and parallel when b1×b2=0\vec b_1 \times \vec b_2 = \vec 0.
  • The skew line distance uses b1×b2\vec b_1 \times \vec b_2, while the parallel line distance uses the single shared direction b\vec b.