3D geometry calculator: lines, planes and direction cosines
Favorites
No favorites yet. Press Favorite on any page to keep it here.
Solve three-dimensional geometry problems of the kind in the NCERT Class 12 chapter “Three Dimensional Geometry”, distances, direction cosines, lines and planes, and the angles and shortest distances between them. Each answer comes with the vector working and exact values such as 3√2/2.
Any linear form in x, y and z.
Show the working, step by step
Direction ratios of AB. Subtract A from B.
(4 − 1, 6 − 2, 15 − 3) = (3, 4, 12)
Distance: |AB| = √(a² + b² + c²).
√(3² + 4² + 12²) = √169 = 13
Direction cosines: divide each ratio by the length. They satisfy l² + m² + n² = 1.
l, m, n = 3/13, 4/13, 12/13
Line through A with direction AB.
vector: r = (î + 2ĵ + 3k̂) + λ(3î + 4ĵ + 12k̂) Cartesian: (x − 1)/3 = (y − 2)/4 = (z − 3)/12
3D geometry formulas
Distance AB: √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²) Direction cosines: l, m, n = a/r, b/r, c/r, r = √(a² + b² + c²) Line through A and B: r = a + λ(b − a) Plane through A, B, C: n = AB × AC, n · (r − a) = 0 Angle between lines: cos θ = |b₁ · b₂| / (|b₁||b₂|) Skew lines: d = |(a₂ − a₁) · (b₁ × b₂)| / |b₁ × b₂| Angle between planes: cos θ = |n₁ · n₂| / (|n₁||n₂|) Point to plane: d = |ax₁ + by₁ + cz₁ + d| / √(a² + b² + c²)
Worked examples
Two points. The calculator opens with A(1, 2, 3) and B(4, 6, 15). The direction ratios of AB are 3, 4, 12, and |AB| = √(9 + 16 + 144) = √169 = 13. The direction cosines are 3/13, 4/13, 12/13, and the line is r = (î + 2ĵ + 3k̂) + λ(3î + 4ĵ + 12k̂), or (x − 1)/3 = (y − 2)/4 = (z − 3)/12.
Plane through three points. For (1, 1, 0), (1, 2, 1) and (−2, 2, −1), AB = (0, 1, 1) and AC = (−3, 1, −1). Then AB × AC = (−2, −3, 3), so a normal is (2, 3, −3), and the plane through (1, 1, 0) is 2(x − 1) + 3(y − 1) − 3z = 0, which is 2x + 3y − 3z = 5.
Skew lines. For r = (î + 2ĵ + k̂) + λ(î − ĵ + k̂) and r = (2î − ĵ − k̂) + μ(2î + ĵ + 2k̂): a₂ − a₁ = (1, −3, −2) and b₁ × b₂ = (−3, 0, 3), with magnitude 3√2. The scalar triple product is −3 + 0 − 6 = −9, so the shortest distance is 9 ÷ 3√2 = 3√2/2 ≈ 2.121. The angle between the lines is arccos(√3/3) ≈ 54.74°.
Two planes. 2x + y − 2z = 5 and 3x − 6y − 2z = 7 have normals (2, 1, −2) and (3, −6, −2), with dot product 6 − 6 + 4 = 4 and magnitudes 3 and 7. So cos θ = 4/21 and θ ≈ 79.02°.
Point to plane. From (2, 5, −3) to 6x − 3y + 2z − 4 = 0 the distance is |12 − 15 − 6 − 4| ÷ 7 = 13/7.
How two lines in space can relate
| Case | Test | Distance |
|---|---|---|
| Parallel | b₁ × b₂ = 0 | |(a₂ − a₁) × b| / |b| |
| Same line | Parallel and the distance is 0 | 0 |
| Intersecting | b₁ × b₂ ≠ 0 and (a₂ − a₁) · (b₁ × b₂) = 0 | 0, and they meet at one point |
| Skew | (a₂ − a₁) · (b₁ × b₂) ≠ 0 | |(a₂ − a₁) · (b₁ × b₂)| / |b₁ × b₂| |
Common mistakes
- Treating direction ratios as direction cosines. Divide by the magnitude first. Check that l² + m² + n² = 1.
- Getting the cross product signs wrong. The middle component is a₃b₁ − a₁b₃, not a₁b₃ − a₃b₁. A normal with every sign flipped is still correct.
- Forgetting the absolute value in the angle formulas. The angle between lines or planes is taken as acute. Without it you may get the obtuse supplement.
- Leaving the plane as ax + by + cz = d in the distance formula. Move d across first, so its sign flips.
Common questions
What is the difference between direction ratios and direction cosines?
Direction ratios are any three numbers a, b, c proportional to the direction of a line. 3, 4, 12 and 6, 8, 24 describe the same direction. Direction cosines are the one set that also satisfies l² + m² + n² = 1, found by dividing each ratio by √(a² + b² + c²). For 3, 4, 12 that is 13, so l, m, n = 3/13, 4/13, 12/13. They are the cosines of the angles the line makes with the x-, y- and z-axes.
How do you find the equation of a line through two points in 3D?
Take the direction as B − A and write r = a + λ(b − a) in vector form, or
(x − x₁)/(x₂ − x₁) = (y − y₁)/(y₂ − y₁) = (z − z₁)/(z₂ − z₁) in Cartesian form.
Through (1, 2, 3) and (4, 6, 15): (x − 1)/3 = (y − 2)/4 = (z − 3)/12. If one ratio is 0,
write that coordinate as a constant instead of dividing by 0.
How do you find the plane through three points?
Form two vectors in the plane, AB and AC. Their cross product is a normal n = (a, b, c), and the plane is a(x − x₁) + b(y − y₁) + c(z − z₁) = 0. If AB × AC = 0 the points are collinear and no single plane is fixed. The NCERT example through (1, 1, 0), (1, 2, 1) and (−2, 2, −1) gives 2x + 3y − 3z = 5.
What is the shortest distance between two skew lines?
For r = a₁ + λb₁ and r = a₂ + μb₂, d = |(a₂ − a₁) · (b₁ × b₂)| ÷ |b₁ × b₂|.
Skew lines are neither parallel nor intersecting, which only happens in three dimensions. If
the result is 0 the lines meet. If b₁ × b₂ = 0 they are parallel, and the distance is
|(a₂ − a₁) × b| ÷ |b|.
How do you find the distance from a point to a plane?
Write the plane as ax + by + cz + d = 0 and use
|ax₁ + by₁ + cz₁ + d| ÷ √(a² + b² + c²). For (2, 5, −3) and
6x − 3y + 2z − 4 = 0: |12 − 15 − 6 − 4| ÷ √49 = 13/7. The calculator also gives the foot of
the perpendicular and the mirror image of the point in the plane.
Related calculators
-
Distance and midpoint
Distance and midpoint in 2D or 3D, with exact surds.
-
Cross product calculator
a × b with the determinant working.
-
Vector calculator
Add, subtract and take dot products of vectors.
-
Line calculator (2D)
Intersection and angle of two lines in the plane.