Angle between two lines

Two lines in space can point in almost the same direction, in exactly opposite directions, or anywhere in between — and the number that captures this is the angle between them. In three-dimensional geometry, this angle is found without ever locating where the lines cross: it comes straight from their direction vectors (or direction ratios) through the dot product, the same tool built in Vector Algebra. This topic sits inside the Three-Dimensional Geometry chapter of CBSE Class 12 Mathematics, right after the equation of a line, and it is a favourite short-answer question because it rewards a clean, mechanical formula rather than a long argument. The idea also quietly powers two other standard questions: showing two lines are parallel, and showing two lines are perpendicular, both of which fall out of the same single formula as special cases.

The core insight

The angle between two lines is the acute angle between their direction vectors, found from cos⁡θ=∣b1⃗⋅b2⃗∣/(∣b1⃗∣∣b2⃗∣)\cos\theta = |\vec{b_1}\cdot\vec{b_2}| / (|\vec{b_1}||\vec{b_2}|).

The core idea

Every line in space, however it is written, boils down to a direction — a vector b⃗\vec b (or a triple of direction ratios (a,b,c)(a,b,c)) that tells you which way the line runs. Position along the line does not matter for this question at all; two lines on opposite sides of the room, pointing the same way, are still said to make an angle of 0°0° with each other. Given two lines with direction vectors b1⃗\vec{b_1} and b2⃗\vec{b_2}, the angle θ\theta between them is defined through the dot product:

cos⁡θ=∣b1⃗⋅b2⃗∣b1⃗∣ ∣b2⃗∣∣\cos\theta = \left|\frac{\vec{b_1}\cdot\vec{b_2}}{|\vec{b_1}|\,|\vec{b_2}|}\right|

where: b1⃗⋅b2⃗\vec{b_1}\cdot\vec{b_2} is the dot product of the two direction vectors, ∣b1⃗∣|\vec{b_1}| and ∣b2⃗∣|\vec{b_2}| are their magnitudes, and the outer modulus forces θ\theta to come out acute (0°≤θ≤90°0° \le \theta \le 90°). In Cartesian form, if the lines have direction ratios (a1,b1,c1)(a_1,b_1,c_1) and (a2,b2,c2)(a_2,b_2,c_2), the same formula reads:

cos⁡θ=∣a1a2+b1b2+c1c2a12+b12+c12 a22+b22+c22∣\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|

where: the numerator is the sum of products of matching direction ratios, and each square root under it is the length of that line's direction triple. If direction cosines (l1,m1,n1)(l_1,m_1,n_1) and (l2,m2,n2)(l_2,m_2,n_2) are used instead of raw direction ratios, both vectors are already unit vectors, so the formula collapses to the neat cos⁡θ=∣l1l2+m1m2+n1n2∣\cos\theta = |l_1l_2+m_1m_2+n_1n_2|, with no division needed. Two special cases fall straight out of this single formula and are worth memorising as separate facts, since exam questions often ask for them directly instead of the general angle: The lines are parallel exactly when θ=0\theta = 0, which happens when the direction ratios are proportional, a1a2=b1b2=c1c2\dfrac{a_1}{a_2}=\dfrac{b_1}{b_2}=\dfrac{c_1}{c_2}. Geometrically this means the two direction vectors point the same way (or exactly opposite ways), so one is a scalar multiple of the other. The lines are perpendicular exactly when θ=90°\theta = 90°, which happens when the dot product of the direction ratios vanishes, a1a2+b1b2+c1c2=0a_1a_2+b_1b_2+c_1c_2 = 0. This is the fastest check available: whenever a question only asks you to verify perpendicularity rather than compute a general angle, there is no need to touch the square roots in the denominator at all — just add up the three products and check whether the total is zero. It is worth being clear about what this formula does and does not need. It uses only the direction of each line, never any point that lies on it, so the two position vectors that appear in a vector-form equation of a line (or the numerators x−x1x - x_1, y−y1y - y_1, z−z1z - z_1 in a Cartesian equation) play no role whatsoever in finding the angle — they matter for other three-dimensional geometry questions, such as finding where two lines meet or how far apart two skew lines are, but not for this one.

Figure
Two direction vectors starting from a common point with the acute angle theta marked between them
Angle between two direction vectors b2 b1 theta common start point (direction only matters, not location)
Derivation AWhere the dot-product angle formula comes from

The goal is to show, starting only from the standard definition of the dot product of two vectors, exactly why dividing the dot product by the two magnitudes and taking a modulus produces the cosine of the acute angle between two lines — so that the formula stops being a fact to memorise and becomes something you could rebuild from scratch under exam pressure if you forgot it.

Step 1. Recall the geometric definition of the dot product for any two nonzero vectors b1⃗\vec{b_1} and b2⃗\vec{b_2} drawn from a common point: b1⃗⋅b2⃗=∣b1⃗∣ ∣b2⃗∣cos⁡α\vec{b_1}\cdot\vec{b_2} = |\vec{b_1}|\,|\vec{b_2}|\cos\alpha, where α\alpha is the angle actually swept out between the two vectors as drawn, which can be anywhere from 0°0° to 180°180°.

Step 2. Divide both sides by ∣b1⃗∣ ∣b2⃗∣|\vec{b_1}|\,|\vec{b_2}|, which is always a positive number since both vectors are nonzero. This isolates the cosine on its own: cos⁡α=b1⃗⋅b2⃗∣b1⃗∣∣b2⃗∣\cos\alpha = \dfrac{\vec{b_1}\cdot\vec{b_2}}{|\vec{b_1}||\vec{b_2}|}.

Step 3. Notice that α\alpha depends on an arbitrary choice — a line has no built-in sense of direction, so either b1⃗\vec{b_1} or b2⃗\vec{b_2} could just as validly have been written pointing the opposite way. Reversing one of them flips the sign of the dot product and swaps α\alpha for its supplement 180°−α180°-\alpha, since cos⁡(180°−α)=−cos⁡α\cos(180°-\alpha) = -\cos\alpha. The two possible values of α\alpha are therefore always a pair that add to 180°180°, one acute and one obtuse (or both 90°90°).

Step 4. Since the angle between two lines is conventionally reported as the acute member of that pair, take the absolute value of the cosine before inverting it: cos⁡θ=∣b1⃗⋅b2⃗∣b1⃗∣∣b2⃗∣∣\cos\theta = \left|\dfrac{\vec{b_1}\cdot\vec{b_2}}{|\vec{b_1}||\vec{b_2}|}\right|, which is guaranteed to be non-negative and so gives θ\theta in the range 0°0° to 90°90° regardless of which of the two possible direction vectors was used for either line. Writing b1⃗=(a1,b1,c1)\vec{b_1}=(a_1,b_1,c_1) and b2⃗=(a2,b2,c2)\vec{b_2}=(a_2,b_2,c_2) and expanding the dot product and magnitudes in components recovers the Cartesian version of the same formula.

Worked example

Problem. Find the angle between the lines r⃗=(2ı^−5ȷ^+k^)+λ(3ı^+2ȷ^+6k^)\vec r = (2\hat\imath - 5\hat\jmath + \hat k) + \lambda(3\hat\imath+2\hat\jmath+6\hat k) and r⃗=(7ı^−6k^)+μ(ı^+2ȷ^+2k^)\vec r = (7\hat\imath - 6\hat k) + \mu(\hat\imath+2\hat\jmath+2\hat k).

Step 1. Read off the direction vectors, ignoring the position vectors entirely: b1⃗=3ı^+2ȷ^+6k^\vec{b_1} = 3\hat\imath+2\hat\jmath+6\hat k and b2⃗=ı^+2ȷ^+2k^\vec{b_2} = \hat\imath+2\hat\jmath+2\hat k.

Step 2. Compute the dot product: b1⃗⋅b2⃗=(3)(1)+(2)(2)+(6)(2)=3+4+12=19\vec{b_1}\cdot\vec{b_2} = (3)(1)+(2)(2)+(6)(2) = 3+4+12 = 19.

Step 3. Compute each magnitude: ∣b1⃗∣=32+22+62=49=7|\vec{b_1}| = \sqrt{3^2+2^2+6^2} = \sqrt{49} = 7 and ∣b2⃗∣=12+22+22=9=3|\vec{b_2}| = \sqrt{1^2+2^2+2^2} = \sqrt{9} = 3.

Step 4. Substitute into the formula: cos⁡θ=∣197×3∣=1921\cos\theta = \left|\dfrac{19}{7\times 3}\right| = \dfrac{19}{21}, so θ=cos⁡−1(1921)\theta = \cos^{-1}\left(\dfrac{19}{21}\right).

Competitive stretch

Problem. Show that x−57=y+2−5=z1\dfrac{x-5}{7} = \dfrac{y+2}{-5} = \dfrac{z}{1} and x1=y2=z3\dfrac{x}{1}=\dfrac{y}{2}=\dfrac{z}{3} are perpendicular.

Step 1. Read off direction ratios: line 1 is (7,−5,1)(7,-5,1), line 2 is (1,2,3)(1,2,3).

Step 2. Compute a1a2+b1b2+c1c2=(7)(1)+(−5)(2)+(1)(3)=7−10+3=0a_1a_2+b_1b_2+c_1c_2 = (7)(1)+(-5)(2)+(1)(3) = 7-10+3 = 0.

Step 3. Since the dot product of the direction ratios is 00, cos⁡θ=0\cos\theta = 0, so θ=90°\theta = 90° and the lines are perpendicular — no need to ever compute the full angle when only perpendicularity is asked. Contrast the two examples: the first genuinely asks for an angle, so all four steps — dot product, both magnitudes, division, inverse cosine — are needed and the answer is left as cos⁡−1(19/21)\cos^{-1}(19/21) rather than forced into a decimal. The second only asks for a yes/no verification, so the magnitudes are never even computed; recognising which kind of question you are facing saves real time in an exam.

Common traps

  • Dropping the modulus. Without it, a negative numerator would suggest an obtuse angle, but the angle between two lines is conventionally reported as acute.
  • Treating proportional direction ratios as "the same line." Parallel direction only tells you about orientation, not location — the lines can still be distinct and non-intersecting.
  • Reading direction ratios off a non-standard Cartesian form, e.g. 2x=3y=6z2x=3y=6z, without first converting to symmetric form x1/2=y1/3=z1/6\dfrac{x}{1/2}=\dfrac{y}{1/3}=\dfrac{z}{1/6}.
  • Sign slips, especially with a negative direction ratio like y+2−5\dfrac{y+2}{-5} giving b1=−5b_1=-5 — dropping the sign wrecks the whole dot product.

Ask the tutor: Want to check whether two lines you have are parallel, perpendicular, or at some other angle — try it with the AI tutor.

Why does the formula use the modulus if cos theta can genuinely be negative for two vectors?

Two vectors pointing along a line could be chosen in either of two opposite senses, since a line itself has no built-in direction. Flipping one direction vector flips the sign of the dot product and turns an acute angle into its obtuse supplement. Since "the angle between two lines" should not depend on which of the two possible directions you happened to write down, the modulus is applied to always report the acute value.

Do I need the actual point of intersection to find the angle between two lines?

No. The angle depends only on direction, not position. Even if the lines never meet at all (skew lines in three dimensions), the angle between them is still perfectly well defined using their direction vectors, exactly as in the formula above.

What if a line is given only in Cartesian form with a coefficient in front of x, y or z?

Rewrite it in standard symmetric form first. For example 2x=3y=6z2x = 3y = 6z becomes x1/2=y1/3=z1/6\dfrac{x}{1/2}=\dfrac{y}{1/3}=\dfrac{z}{1/6}, from which the direction ratios 1/2,1/3,1/61/2, 1/3, 1/6 (or, after clearing fractions, 3,2,13, 2, 1) can be read off safely. Reading ratios straight from the raw coefficients without this step is a very common error.

Before this

Where this leads