This sheet covers the three dimensional geometry class 12 formulas from NCERT Mathematics Part II, Chapter 11: direction cosines and direction ratios, equations of a line in vector and Cartesian form, the angle between two lines, the shortest distance between skew lines, and the distance between parallel lines.
Every formula is grouped by topic with its symbols explained, when-to-use guidance, and worked examples using original numbers. For the detailed explanations and derivations, see the Class 12 maths formulas hub, or browse every chapter’s sheets in the maths formulas index.
Formulas at a Glance
Every formula on this page in one index table; details and conditions follow in the grouped list.
| Purpose (what you are finding) | Formula |
|---|---|
| Direction cosines of a line whose direction ratios are given | \( l = \pm\frac{a}{\sqrt{a^2+b^2+c^2}}, \;\; m = \pm\frac{b}{\sqrt{a^2+b^2+c^2}}, \;\; n = \pm\frac{c}{\sqrt{a^2+b^2+c^2}} \) (same sign for all three) |
| Identity always satisfied by direction cosines | \( l^2 + m^2 + n^2 = 1 \) |
| Direction cosines of the coordinate axes | \( (1,0,0), \; (0,1,0), \; (0,0,1) \) |
| Direction cosines of the line joining two points | \( \frac{x_2-x_1}{PQ}, \; \frac{y_2-y_1}{PQ}, \; \frac{z_2-z_1}{PQ} \), where \( PQ = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2} \) |
| Vector equation of a line through a point, parallel to a vector | \( \vec{r} = \vec{a} + \lambda\vec{b} \) |
| Parametric equations of a line | \( x = x_1+\lambda a, \;\; y = y_1+\lambda b, \;\; z = z_1+\lambda c \) |
| Cartesian equation of a line through a point with direction ratios | \( \frac{x-x_1}{a} = \frac{y-y_1}{b} = \frac{z-z_1}{c} \) |
| Vector equation of a line through two points | \( \vec{r} = \vec{a} + \lambda(\vec{b}-\vec{a}) \) |
| Cartesian equation of a line through two points (derived from the point-and-direction form) | \( \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 from their direction ratios | \( \cos\theta = \left| \frac{a_1a_2 + b_1b_2 + c_1c_2}{\sqrt{a_1^2+b_1^2+c_1^2}\;\sqrt{a_2^2+b_2^2+c_2^2}} \right| \) |
| Angle between two lines from their direction cosines | \( \cos\theta = |l_1l_2 + m_1m_2 + n_1n_2| \) |
| Angle between two lines in vector form | \( \cos\theta = \left| \frac{\vec{b}_1 \cdot \vec{b}_2}{|\vec{b}_1|\;|\vec{b}_2|} \right| \) |
| Sine of the angle between two lines (alternative to the cosine form) | \( \sin\theta = \frac{\sqrt{(a_1b_2-a_2b_1)^2 + (b_1c_2-b_2c_1)^2 + (c_1a_2-c_2a_1)^2}}{\sqrt{a_1^2+b_1^2+c_1^2}\;\sqrt{a_2^2+b_2^2+c_2^2}} \) |
| Perpendicular lines test (direction ratios) | \( a_1a_2 + b_1b_2 + c_1c_2 = 0 \) |
| Parallel lines test (direction ratios) | \( \frac{a_1}{a_2} = \frac{b_1}{b_2} = \frac{c_1}{c_2} \) |
| Shortest distance between two skew lines (vector form) | \( d = \left| \frac{(\vec{b}_1 \times \vec{b}_2)\cdot(\vec{a}_2 – \vec{a}_1)}{|\vec{b}_1 \times \vec{b}_2|} \right| \) |
| Shortest distance between two skew lines (Cartesian form) | \( d = \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_1c_2-b_2c_1)^2 + (c_1a_2-c_2a_1)^2 + (a_1b_2-a_2b_1)^2}} \) |
| Distance between two parallel lines | \( d = \left| \frac{\vec{b} \times (\vec{a}_2 – \vec{a}_1)}{|\vec{b}|} \right| \) |
All Formulas, Grouped by Topic
Each group below follows the sub-topics of the chapter. Where a result needs a condition, the condition is stated with the formula.
Direction Cosines and Direction Ratios of a Line
If a directed line makes angles \(\alpha, \beta, \gamma\) with the positive \(x\), \(y\) and \(z\)-axes, its direction cosines are the cosines of these direction angles (NCERT, p. 378):
\[ l = \cos\alpha, \quad m = \cos\beta, \quad n = \cos\gamma \]
For any line, the direction cosines always satisfy (NCERT, p. 379):
\[ l^2 + m^2 + n^2 = 1 \]
Direction ratios \(a, b, c\) are any numbers proportional to the direction cosines, so \(\frac{l}{a} = \frac{m}{b} = \frac{n}{c}\). Converting direction ratios back to direction cosines (NCERT, p. 379):
\[ l = \pm\frac{a}{\sqrt{a^2+b^2+c^2}}, \quad m = \pm\frac{b}{\sqrt{a^2+b^2+c^2}}, \quad n = \pm\frac{c}{\sqrt{a^2+b^2+c^2}} \]
Choose the same sign for all three. Reversing the sign reverses the direction of the line, so a line has two sets of direction cosines and infinitely many sets of direction ratios.
The direction cosines of the coordinate axes are \(x\)-axis \((1,0,0)\), \(y\)-axis \((0,1,0)\) and \(z\)-axis \((0,0,1)\) (NCERT, Example 4, p. 381).
Direction Cosines of a Line through Two Points
For the line joining \(P(x_1, y_1, z_1)\) and \(Q(x_2, y_2, z_2)\), the direction cosines are (NCERT, p. 380):
\[ \frac{x_2-x_1}{PQ}, \quad \frac{y_2-y_1}{PQ}, \quad \frac{z_2-z_1}{PQ}, \quad \text{where } PQ = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 + (z_2-z_1)^2} \]
The direction ratios of the same segment may be taken as \(x_2-x_1,\; y_2-y_1,\; z_2-z_1\), or all three reversed.
The diagram below shows the right-triangle construction behind the formula: perpendiculars from P and Q to the XY-plane give a right triangle in which the vertical side is \(z_2 – z_1\), so \(\cos\gamma = \frac{z_2 – z_1}{PQ}\) (NCERT, p. 380).

Equation of a Line in Space
Vector form — the line through the point with position vector \(\vec{a}\), parallel to a given vector \(\vec{b}\) (NCERT, p. 382):
\[ \vec{r} = \vec{a} + \lambda\vec{b} \]
The diagram shows the construction: the line passes through the fixed point A; each real value of the parameter \(\lambda\) gives one point P on the line.

Comparing coefficients of \(\hat{i},\; \hat{j},\; \hat{k}\) in \(\vec{r} = \vec{a} + \lambda\vec{b}\) gives the parametric equations (NCERT, p. 382):
\[ x = x_1 + \lambda a, \quad y = y_1 + \lambda b, \quad z = z_1 + \lambda c \]
Eliminating \(\lambda\) gives the Cartesian form of the line through \((x_1, y_1, z_1)\) with direction ratios \(a, b, c\) (NCERT, p. 383):
\[ \frac{x-x_1}{a} = \frac{y-y_1}{b} = \frac{z-z_1}{c} \]
With direction cosines \(l, m, n\) in place of direction ratios:
\[ \frac{x-x_1}{l} = \frac{y-y_1}{m} = \frac{z-z_1}{n} \]
The fractional form assumes \(a, b, c \neq 0\). If one direction ratio is zero, that coordinate is constant for the whole line; the parametric form handles this directly.
Line through two points with position vectors \(\vec{a}\) and \(\vec{b}\) (NCERT, p. 392):
\[ \vec{r} = \vec{a} + \lambda(\vec{b} – \vec{a}) \]
Using the direction ratios of the segment in the point-and-direction form gives the Cartesian two-point form (derived form):
\[ \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
For two lines with direction ratios \(a_1, b_1, c_1\) and \(a_2, b_2, c_2\), the acute angle \(\theta\) between them is (NCERT, p. 384):
\[ \cos\theta = \left| \frac{a_1a_2 + b_1b_2 + c_1c_2}{\sqrt{a_1^2 + b_1^2 + c_1^2}\;\sqrt{a_2^2 + b_2^2 + c_2^2}} \right| \]
If the direction cosines \(l_1, m_1, n_1\) and \(l_2, m_2, n_2\) are given instead:
\[ \cos\theta = |l_1l_2 + m_1m_2 + n_1n_2| \]
In vector form, for lines \(\vec{r} = \vec{a}_1 + \lambda\vec{b}_1\) and \(\vec{r} = \vec{a}_2 + \mu\vec{b}_2\):
\[ \cos\theta = \left| \frac{\vec{b}_1 \cdot \vec{b}_2}{|\vec{b}_1|\;|\vec{b}_2|} \right| \]
The modulus keeps \(\theta\) acute, so \(\cos\theta \geq 0\). The angle between skew lines is defined the same way: draw lines through the origin parallel to each skew line and take the angle between them.
An alternative expression in terms of \(\sin\theta\):
\[ \sin\theta = \frac{\sqrt{(a_1b_2 – a_2b_1)^2 + (b_1c_2 – b_2c_1)^2 + (c_1a_2 – c_2a_1)^2}}{\sqrt{a_1^2 + b_1^2 + c_1^2}\;\sqrt{a_2^2 + b_2^2 + c_2^2}} \]
Special cases follow directly from the angle formula:
- Perpendicular lines: \(a_1a_2 + b_1b_2 + c_1c_2 = 0\).
- Parallel lines: \(\frac{a_1}{a_2} = \frac{b_1}{b_2} = \frac{c_1}{c_2}\).
The figure below shows the acute angle \(\theta\) between the directed lines OP and OQ drawn through the origin (NCERT, p. 384).

Shortest Distance between Two Skew Lines
Skew lines are non-coplanar lines: they are neither parallel nor intersecting (NCERT, p. 385). If two lines intersect, their shortest distance is zero. For genuinely skew lines, the shortest distance is the length of the segment that is perpendicular to both lines.

The room in the figure is the NCERT’s example: the ceiling diagonal GE and the wall diagonal DB are skew lines.
For lines \(\vec{r} = \vec{a}_1 + \lambda\vec{b}_1\) and \(\vec{r} = \vec{a}_2 + \mu\vec{b}_2\), the shortest distance is (NCERT, p. 387):
\[ d = \left| \frac{(\vec{b}_1 \times \vec{b}_2)\cdot(\vec{a}_2 – \vec{a}_1)}{|\vec{b}_1 \times \vec{b}_2|} \right| \]
The shortest-distance segment is perpendicular to both lines, so its direction is that of \(\vec{b}_1 \times \vec{b}_2\); the formula is the magnitude of the projection of \(\vec{a}_2 – \vec{a}_1\) onto this direction.

Cartesian form. For lines \(\frac{x-x_1}{a_1} = \frac{y-y_1}{b_1} = \frac{z-z_1}{c_1}\) and \(\frac{x-x_2}{a_2} = \frac{y-y_2}{b_2} = \frac{z-z_2}{c_2}\):
\[ d = \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_1c_2 – b_2c_1)^2 + (c_1a_2 – c_2a_1)^2 + (a_1b_2 – a_2b_1)^2}} \]
The denominator is \(|\vec{b}_1 \times \vec{b}_2|\), so both forms require the lines to be non-parallel.
Distance between Parallel Lines
For parallel lines \(\vec{r} = \vec{a}_1 + \lambda\vec{b}\) and \(\vec{r} = \vec{a}_2 + \mu\vec{b}\), the perpendicular distance is (NCERT, p. 388):
\[ d = \left| \frac{\vec{b} \times (\vec{a}_2 – \vec{a}_1)}{|\vec{b}|} \right| \]
Both lines share the same direction vector \(\vec{b}\), so the cross product is taken with \(\vec{b}\), not between two different direction vectors. The skew-line formula is not usable here, because its denominator \(|\vec{b}_1 \times \vec{b}_2|\) is zero for parallel lines.
What Each Symbol Means
This is a pure-mathematics chapter, so the unit column states the nature of each quantity instead.
| Symbol | What it means | Unit / nature |
|---|---|---|
| \( l, m, n \) | Direction cosines of a line: \(\cos\alpha, \cos\beta, \cos\gamma\) | dimensionless numbers, each in \([-1, 1]\); \(l^2 + m^2 + n^2 = 1\) |
| \( a, b, c \) | Direction ratios of a line, proportional to the direction cosines | dimensionless numbers |
| \( \alpha, \beta, \gamma \) | Direction angles made by the line with the positive \(x\), \(y\), \(z\)-axes | angle (degrees or radians) |
| \( (x_1,y_1,z_1),\; (x_2,y_2,z_2) \) | Coordinates of fixed points P and Q on the line | length (coordinate units) |
| \( (x,y,z) \) | Coordinates of a general point on the line | length (coordinate units) |
| \( PQ \) | Distance between the two points P and Q | length |
| \( \vec{r} \) | Position vector of a general point on the line | length |
| \( \vec{a}, \vec{a}_1, \vec{a}_2 \) | Position vectors of fixed points on a line | length |
| \( \vec{b}, \vec{b}_1, \vec{b}_2 \) | Direction vectors of lines; their components are direction ratios | length |
| \( \lambda, \mu \) | Real parameters that trace the points of a line as they vary | dimensionless |
| \( \theta \) | Acute angle between two lines | angle (degrees or radians) |
| \( \vec{b}_1 \times \vec{b}_2 \) | Cross product of the two direction vectors, perpendicular to both | vector whose magnitude appears in the skew-line distance denominator |
| \( d \) | Shortest distance between two lines | length |
When to Use Each Formula
Reach for the formula that matches the situation. Each row names the condition that must hold before you substitute.
| When you need to… | Reach for… | Hold this in mind |
|---|---|---|
| Convert direction ratios to direction cosines | \( l = \pm\frac{a}{\sqrt{a^2+b^2+c^2}} \), etc. | One sign for all three; the two sign choices give the two directed senses of the line. |
| Verify a direction-cosine triple | \( l^2 + m^2 + n^2 = 1 \) | Any triple that fails this identity is a set of direction ratios, not direction cosines. |
| Find the direction cosines of a side or segment joining two points | \( \frac{x_2-x_1}{PQ}, \frac{y_2-y_1}{PQ}, \frac{z_2-z_1}{PQ} \) | Subtract in the same order for all three coordinates; reversing the order reverses all three signs. |
| Write the equation of a line through a known point with a known direction | \( \vec{r} = \vec{a} + \lambda\vec{b} \) or \( \frac{x-x_1}{a} = \frac{y-y_1}{b} = \frac{z-z_1}{c} \) | The Cartesian form needs \(a, b, c \neq 0\); with a zero direction ratio, use the parametric form. |
| Write the equation of a line through two known points | \( \vec{r} = \vec{a} + \lambda(\vec{b}-\vec{a}) \); derived Cartesian form uses the differences as direction ratios | Use the point-and-direction form with \(x_2-x_1, y_2-y_1, z_2-z_1\) as direction ratios. |
| Find the angle between two lines from their equations | \( \cos\theta = \left| \frac{a_1a_2+b_1b_2+c_1c_2}{\sqrt{a_1^2+b_1^2+c_1^2}\;\sqrt{a_2^2+b_2^2+c_2^2}} \right| \) | Read the direction ratios from the denominators of the Cartesian form, or from the direction vectors in the vector form. |
| Show two lines are perpendicular | \( a_1a_2 + b_1b_2 + c_1c_2 = 0 \) | This is the numerator of the angle formula set equal to zero. |
| Show two lines are parallel | \( \frac{a_1}{a_2} = \frac{b_1}{b_2} = \frac{c_1}{c_2} \) | Equivalently, the two sets of direction ratios are proportional. |
| Check whether three points A, B, C are collinear | Compare the direction ratios of AB and BC | If the ratios are proportional, AB is parallel to BC; sharing point B then makes A, B, C collinear (NCERT, Example 5, p. 381). |
| Find the shortest distance between two skew lines | Vector or Cartesian skew-line distance formula | The lines must be non-parallel; if they intersect, the distance is 0. |
| Find the distance between two parallel lines | \( d = \left| \frac{\vec{b} \times (\vec{a}_2 – \vec{a}_1)}{|\vec{b}|} \right| \) | The lines must share the same direction vector \(\vec{b}\); the skew-line formula cannot be used here. |
Worked Examples
Three quick lookups: applying a formula directly, working backwards to find an unknown, and using the shortest-distance formula.
Worked Example 1: Direction cosines of a line joining two points
Find the direction cosines of the line joining \(P(1, 2, 3)\) and \(Q(4, 6, 7)\).
Step 1: Choose P as the first point.
The direction ratios of PQ are the differences \(x_2-x_1,\; y_2-y_1,\; z_2-z_1 = 3,\; 4,\; 4\).
Step 2: Find the distance between the points:
\[ PQ = \sqrt{3^2 + 4^2 + 4^2} = \sqrt{41} \]
Step 3: Divide each difference by \(PQ\) to get the direction cosines:
\[ l = \frac{3}{\sqrt{41}}, \quad m = \frac{4}{\sqrt{41}}, \quad n = \frac{4}{\sqrt{41}} \]
Step 4 (check): the identity \(l^2 + m^2 + n^2 = 1\) must hold:
\[ l^2 + m^2 + n^2 = \frac{9 + 16 + 16}{41} = 1 \]
Final answer: \(\left(\frac{3}{\sqrt{41}}, \frac{4}{\sqrt{41}}, \frac{4}{\sqrt{41}}\right)\).
Worked Example 2: Finding an unknown direction ratio for perpendicular lines
Find \(p\) so that the lines \(\frac{x-1}{3} = \frac{y+2}{4} = \frac{z-1}{p}\) and \(\frac{x-3}{2} = \frac{y-1}{1} = \frac{z+4}{-5}\) are perpendicular.
- Step 1: Read the direction ratios from the denominators: \((3, 4, p)\) and \((2, 1, -5)\).
- Step 2: Perpendicular lines satisfy \(a_1a_2 + b_1b_2 + c_1c_2 = 0\):
\[ 3(2) + 4(1) + p(-5) = 0 \]
\[ 10 – 5p = 0 \Rightarrow p = 2 \]
Step 3 (check): substitute \(p = 2\) back into the condition: \(6 + 4 – 10 = 0\).
Final answer: \(p = 2\).
Worked Example 3: Shortest distance between two skew lines
Find the shortest distance between the lines \(\vec{r} = (\hat{i} + \hat{j} + \hat{k}) + \lambda(\hat{i} + 2\hat{j} + 2\hat{k})\) and \(\vec{r} = (2\hat{i} + 3\hat{j} + 4\hat{k}) + \mu(2\hat{i} + 3\hat{j} + 6\hat{k})\).
- Step 1: Identify the vectors: \(\vec{a}_1 = (1,1,1)\), \(\vec{b}_1 = (1,2,2)\), \(\vec{a}_2 = (2,3,4)\), \(\vec{b}_2 = (2,3,6)\).
- Step 2: Confirm the lines are not parallel: \((1,2,2)\) is not proportional to \((2,3,6)\).
- Step 3: Compute \(\vec{a}_2 – \vec{a}_1 = (1,2,3)\) and the cross product:
\[ \vec{b}_1 \times \vec{b}_2 = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ 1 & 2 & 2 \\ 2 & 3 & 6 \end{vmatrix} = 6\hat{i} – 2\hat{j} – \hat{k} \]
\[ |\vec{b}_1 \times \vec{b}_2| = \sqrt{36 + 4 + 1} = \sqrt{41} \]
Step 4: Form the scalar triple product:
\[ (\vec{b}_1 \times \vec{b}_2)\cdot(\vec{a}_2 – \vec{a}_1) = 6(1) + (-2)(2) + (-1)(3) = -1 \]
Step 5: Divide by \(|\vec{b}_1 \times \vec{b}_2|\) and take the absolute value:
\[ d = \frac{|-1|}{\sqrt{41}} = \frac{1}{\sqrt{41}} \]
Final answer: \(d = \frac{1}{\sqrt{41}}\) units.
Common Mistakes to Avoid
These are the errors that appear most often when these formulas are applied in exams.
| Mistake | Correct rule | How to check your answer |
|---|---|---|
| Mixing the order of subtraction when a line through two points is involved | Subtract the same point from the same point in all three coordinates: \(x_2-x_1,\; y_2-y_1,\; z_2-z_1\), or reverse all three together. | The three differences must change sign together when the two points are swapped. |
| Quoting direction ratios as direction cosines | Divide each direction ratio by \(\sqrt{a^2 + b^2 + c^2}\). | Square the three values and add: true direction cosines give exactly 1. |
| Dropping the modulus in the angle-between-lines formula | \(\cos\theta = |\cdots|\) because the angle between two lines is taken as the acute angle. | Your value of \(\cos\theta\) must come out \(\geq 0\). |
| Using the skew-line distance formula on parallel lines | For parallel lines \(|\vec{b}_1 \times \vec{b}_2| = 0\); use \(d = \frac{|\vec{b} \times (\vec{a}_2 – \vec{a}_1)|}{|\vec{b}|}\) instead. | First check whether the direction ratios are proportional; if they are, the lines are parallel. |
| Sign slip in the scalar triple product | Take \(\vec{a}_2 – \vec{a}_1\) in that order and expand the cross product carefully; the absolute value removes only the overall sign. | Re-expand one component of \(\vec{b}_1 \times \vec{b}_2\), for example the \(\hat{i}\) component, and recompute the dot product. |
| Swapping the perpendicular and parallel tests | Perpendicular: \(a_1a_2 + b_1b_2 + c_1c_2 = 0\); parallel: \(\frac{a_1}{a_2} = \frac{b_1}{b_2} = \frac{c_1}{c_2}\). | Perpendicular lines make the sum zero; parallel lines make the three ratios equal. |
Frequently Asked Questions
What is the difference between direction cosines and direction ratios?
Direction cosines \(l, m, n\) are the cosines of the angles a line makes with the axes, so they always satisfy \(l^2 + m^2 + n^2 = 1\). A directed line has exactly two sets of direction cosines, differing only in sign.
Direction ratios are any numbers proportional to the direction cosines, so one line has infinitely many sets. Convert by dividing each ratio by \(\sqrt{a^2 + b^2 + c^2}\).
How can I recognise skew lines?
Skew lines are non-coplanar: they are neither parallel nor intersecting (NCERT, p. 385). First check whether the direction ratios are proportional — if they are, the lines are parallel, not skew. If they are not proportional, apply the shortest-distance formula: intersecting lines give \(d = 0\), while genuinely skew lines give a positive distance.
Does the angle formula give the acute or the obtuse angle?
The modulus in \(\cos\theta = \left| \frac{a_1a_2 + b_1b_2 + c_1c_2}{\sqrt{a_1^2 + b_1^2 + c_1^2}\;\sqrt{a_2^2 + b_2^2 + c_2^2}} \right|\) guarantees the acute angle, the angle the chapter uses between two lines. So \(\cos\theta\) is never negative, and the answer is written as \(\theta = \cos^{-1}\) (of a positive value).
How should I revise three dimensional geometry class 12 formulas quickly?
Start with the Formulas at a Glance table and write each formula from memory on paper. Then go to What Each Symbol Means for any symbol you cannot name, and attempt the three worked examples without looking. Finish with the mistakes table — each row names a check you can run on your own answer.
All formulas above follow the Rationalised NCERT Class 12 Mathematics Part II textbook, chapter 11; the complete chapter text is available on NCERT’s official website, where each formula can be verified against the printed pages cited above.
Reference: NCERT Class 12 Mathematics Part II textbook, chapter Three Dimensional Geometry.
Explore Class 12 Maths Formulas
More for this chapter:
- Three Dimensional Geometry Notes
Related chapters: