Lines & Planes in Space

Study Sheet

Lines & Planes in Space

Normals, distances, and intersections

Equations of Lines and Planes

Tip
A plane is a point and a normal
xyz(1, 2, 1)n363
The plane 2x+y+2z=62x + y + 2z = 6, cut off by the axes at 33, 66, 33, with its normal (2,1,2)(2, 1, 2) standing at (1,2,1)(1, 2, 1).

Every plane in space is captured by ONE linear equation ax+by+cz=dax + by + cz = d, and the coefficient vector n=(a,b,c)\mathbf n = (a, b, c) is no accident: it is the NORMAL, perpendicular to the plane. For example, 2x+y+2z=62x + y + 2z = 6 has normal (2,1,2)(2, 1, 2) and contains (1,2,1)(1, 2, 1), since 2+2+2=62 + 2 + 2 = 6.

Why: if P0P_0 lies on the plane and PP is any other plane point, the displacement P−P0P - P_0 lies in the plane, and the equation says exactly n⋅(P−P0)=0\mathbf n\cdot(P - P_0) = 0 — the normal is perpendicular to every in-plane direction. So building planes is mechanical: given a point and a normal, dot them; given three points, form two edge vectors and take their CROSS PRODUCT for the normal. Given the equation, read the normal straight off the coefficients. Parallel planes share a normal and differ only in dd; perpendicular planes have perpendicular normals — every geometric relationship between planes translates into a dot- or cross-product statement about their normals.

Side note
Why lines need a parameter but planes need an equation

In 3D a single linear equation removes ONE degree of freedom, leaving a 2-dimensional plane — so a line (1-dimensional) needs TWO equations, or more usefully a parametric form r(t)=p+tv\mathbf r(t) = \mathbf p + t\mathbf v: start at a point, walk along a direction. The dimension count (3−equations=dimension3 - \text{equations} = \text{dimension}) is rank–nullity from linear algebra wearing geometric clothes — one of many places these two courses are secretly the same course.

Tip
All distances are projections onto the normal

Distance from a point P0=(x0,y0,z0)P_0 = (x_0, y_0, z_0) to the plane ax+by+cz=dax + by + cz = d: ∣ax0+by0+cz0−d∣a2+b2+c2\dfrac{|ax_0 + by_0 + cz_0 - d|}{\sqrt{a^2 + b^2 + c^2}}. The logic: take any plane point QQ, and project the displacement P0−QP_0 - Q onto the unit normal — only the normal component carries you away from the plane.

The numerator is the (signed) un-normalized projection; dividing by ∣n∣|\mathbf n| finishes it. The same idea handles parallel planes (∣d1−d2∣∣n∣\tfrac{|d_1 - d_2|}{|\mathbf n|}) and, with a cross product replacing the dot, point-to-line distances. One projection, every distance formula in the chapter.

Try it
Try it: a plane through three points

Find the plane through (1,0,0)(1, 0, 0), (0,2,0)(0, 2, 0) and (0,0,3)(0, 0, 3).

Show the answer

Two edge vectors from the first point lie in the plane: (−1,2,0)(-1, 2, 0) and (−1,0,3)(-1, 0, 3). Their cross product is perpendicular to both, so it is a normal: (2⋅3−0⋅0, 0⋅(−1)−(−1)⋅3, (−1)⋅0−2⋅(−1))=(6,3,2)(2\cdot3 - 0\cdot0,\ 0\cdot(-1) - (-1)\cdot3,\ (-1)\cdot0 - 2\cdot(-1)) = (6, 3, 2). The plane is 6x+3y+2z=d6x + 3y + 2z = d, and the point (1,0,0)(1, 0, 0) fixes d=6d = 6. Check the other two points: 3⋅2=63\cdot2 = 6 and 2⋅3=62\cdot3 = 6. A shortcut worth knowing: intercepts p,q,rp, q, r give xp+yq+zr=1\tfrac xp + \tfrac yq + \tfrac zr = 1 at once; here x+y2+z3=1x + \tfrac y2 + \tfrac z3 = 1, which is the same plane multiplied through by 66.

Lines in Space and How Two Lines Meet

Concept
A line is a point and a direction

The line through P0=(x0,y0,z0)P_0 = (x_0, y_0, z_0) with direction v=(a,b,c)\mathbf v = (a, b, c) is r(t)=P0+tv\mathbf r(t) = P_0 + t\mathbf v, that is x=x0+atx = x_0 + at, y=y0+bty = y_0 + bt, z=z0+ctz = z_0 + ct. Eliminating tt gives the symmetric form x−x0a=y−y0b=z−z0c\dfrac{x - x_0}{a} = \dfrac{y - y_0}{b} = \dfrac{z - z_0}{c} (when a,b,c≠0a, b, c \ne 0). Two lines in space are parallel (proportional directions), intersecting, or skew: not parallel and never meeting.

Why a parameter: a line has one degree of freedom, and tt is that freedom. Each value of tt picks one point, and equal steps in tt are equal steps along the line. Skew lines are the case with no counterpart in the plane: there, two lines that are not parallel must cross, but in space one line can pass over another like two roads at an overpass. To decide which case holds, set the two parametrizations equal. That gives three equations in only two unknowns, tt and ss, and the question is whether all three can hold at once.

Example
Example: the line through two points

Find the line through P=(1,−2,3)P = (1, -2, 3) and Q=(4,0,2)Q = (4, 0, 2), and the point where it crosses the xyxy-plane. The direction is the displacement v=Q−P=(3,2,−1)\mathbf v = Q - P = (3, 2, -1), so r(t)=(1,−2,3)+t(3,2,−1)\mathbf r(t) = (1, -2, 3) + t(3, 2, -1), or x−13=y+22=z−3−1\dfrac{x - 1}{3} = \dfrac{y + 2}{2} = \dfrac{z - 3}{-1}.

As a check, t=0t = 0 gives PP and t=1t = 1 gives QQ. The xyxy-plane is where z=0z = 0, so solve 3−t=03 - t = 0: t=3t = 3. The crossing point is (1+9, −2+6, 0)=(10,4,0)(1 + 9,\ -2 + 6,\ 0) = (10, 4, 0). Any line question reduces to choosing tt: first write the condition on the point, then solve for tt.

Example
Example: intersecting or skew?

Do L1:(1,1,0)+t(1,−1,2)L_1: (1, 1, 0) + t(1, -1, 2) and L2:(2,0,2)+s(0,1,−1)L_2: (2, 0, 2) + s(0, 1, -1) meet? The directions are not proportional, so the lines are not parallel. Setting the coordinates equal gives three equations: 1+t=21 + t = 2,  1−t=s\ 1 - t = s,  2t=2−s\ 2t = 2 - s.

The first equation gives t=1t = 1, and the second then gives s=0s = 0. The third equation has not been used yet, so it is the real test: 2(1)=2−02(1) = 2 - 0 holds. All three equations are satisfied, so the lines meet, at t=1t = 1 on L1L_1: the point (2,0,2)(2, 0, 2), which is also s=0s = 0 on L2L_2.

Example
Example: how far apart are two skew lines?
L₁L₂1
The two skew lines and their common perpendicular (dashed), of length 11.

Take L1:(1,0,2)+t(1,2,0)L_1: (1, 0, 2) + t(1, 2, 0) and L2:(0,1,−1)+s(1,0,1)L_2: (0, 1, -1) + s(1, 0, 1). The shortest segment between them is perpendicular to both directions, so it runs along n=(1,2,0)×(1,0,1)=(2⋅1−0⋅0, 0⋅1−1⋅1, 1⋅0−2⋅1)=(2,−1,−2)\mathbf n = (1, 2, 0)\times(1, 0, 1) = (2\cdot1 - 0\cdot0,\ 0\cdot1 - 1\cdot1,\ 1\cdot0 - 2\cdot1) = (2, -1, -2), with ∣n∣=3|\mathbf n| = 3.

Every segment joining the two lines has the same component along n\mathbf n: moving either endpoint along its line adds a multiple of (1,2,0)(1, 2, 0) or (1,0,1)(1, 0, 1), and both are perpendicular to n\mathbf n. So take the easiest segment, from (1,0,2)(1, 0, 2) to (0,1,−1)(0, 1, -1): it is (−1,1,−3)(-1, 1, -3), and (−1,1,−3)⋅(2,−1,−2)=−2−1+6=3(-1, 1, -3)\cdot(2, -1, -2) = -2 - 1 + 6 = 3. The distance is ∣3∣3=1\tfrac{|3|}{3} = 1. It is not zero, and the directions are not proportional, so the lines are skew. The closest points are t=23t = \tfrac23 on L1L_1 and s=73s = \tfrac73 on L2L_2, namely (53,43,2)\left(\tfrac53, \tfrac43, 2\right) and (73,1,43)\left(\tfrac73, 1, \tfrac43\right).

Side note
Where it goes wrong

Take L1:(1,0,0)+t(1,1,1)L_1: (1, 0, 0) + t(1, 1, 1) and L2:(0,0,5)+s(2,1,0)L_2: (0, 0, 5) + s(2, 1, 0). The xx and yy equations, 1+t=2s1 + t = 2s and t=st = s, give s=t=1s = t = 1, and it is tempting to stop there and say the lines meet. But at t=1t = 1, L1L_1 is at height z=1z = 1, while L2L_2 is at height 55 for every ss. The point (2,1,1)(2, 1, 1) on L1L_1 sits directly below (2,1,5)(2, 1, 5) on L2L_2: same xx and yy, different height. With three equations and two unknowns, the equation left over is the whole test.

Try it
Try it: do these lines meet?

Do L1:(2,1,0)+t(1,−1,1)L_1: (2, 1, 0) + t(1, -1, 1) and L2:(3,3,−1)+s(0,2,−2)L_2: (3, 3, -1) + s(0, 2, -2) intersect? If not, how far apart are they?

Show the answer

Set the coordinates equal. From xx: 2+t=32 + t = 3, so t=1t = 1. From yy: 1−t=3+2s1 - t = 3 + 2s, so 0=3+2s0 = 3 + 2s and s=−32s = -\tfrac32. Now test zz: t=−1−2st = -1 - 2s would need 1=−1+3=21 = -1 + 3 = 2, which is false. The directions (1,−1,1)(1, -1, 1) and (0,2,−2)(0, 2, -2) are not proportional either, so the lines are skew. For the distance, n=(1,−1,1)×(0,2,−2)=((−1)(−2)−1⋅2, 1⋅0−1⋅(−2), 1⋅2−(−1)⋅0)=(0,2,2)\mathbf n = (1, -1, 1)\times(0, 2, -2) = ((-1)(-2) - 1\cdot2,\ 1\cdot0 - 1\cdot(-2),\ 1\cdot2 - (-1)\cdot0) = (0, 2, 2), with ∣n∣=22|\mathbf n| = 2\sqrt2. The segment between the base points is (3,3,−1)−(2,1,0)=(1,2,−1)(3, 3, -1) - (2, 1, 0) = (1, 2, -1), and (1,2,−1)⋅(0,2,2)=2(1, 2, -1)\cdot(0, 2, 2) = 2. The distance is 222=22≈0.707\tfrac{2}{2\sqrt2} = \tfrac{\sqrt2}{2} \approx 0.707.

Angles, Intersections, and Distances

Tip
Normals do the work

The angle between two planes is the angle between their normals: cos⁡θ=∣n1⋅n2∣∣n1∣∣n2∣\cos\theta = \dfrac{|\mathbf n_1\cdot\mathbf n_2|}{|\mathbf n_1||\mathbf n_2|}. A line r(t)=P0+tv\mathbf r(t) = P_0 + t\mathbf v meets the plane n⋅x=d\mathbf n\cdot\mathbf x = d where n⋅(P0+tv)=d\mathbf n\cdot(P_0 + t\mathbf v) = d, one linear equation for tt; if n⋅v=0\mathbf n\cdot\mathbf v = 0 the line is parallel to the plane. A point P0P_0 is at distance ∣n⋅P0−d∣∣n∣\dfrac{|\mathbf n\cdot P_0 - d|}{|\mathbf n|} from the plane.

Why normals: a plane's tilt is completely described by its normal, so a question about how two planes sit is a question about two vectors. Substituting a line into a plane works because the plane's equation is linear and each coordinate of r(t)\mathbf r(t) is linear in tt, so n⋅r(t)=d\mathbf n\cdot\mathbf r(t) = d is a linear equation in tt. It has exactly one solution unless the coefficient of tt, which is n⋅v\mathbf n\cdot\mathbf v, is zero; that happens exactly when the line runs perpendicular to the normal, that is, parallel to the plane.

Example
Example: where a line pierces a plane
xyz(3, 0, 6)(1, 2, 0)
The line from (1,2,0)(1, 2, 0) passes behind the plane x+y+z=9x + y + z = 9 (dashed) and comes through at (3,0,6)(3, 0, 6).

Where does r(t)=(1,2,0)+t(1,−1,3)\mathbf r(t) = (1, 2, 0) + t(1, -1, 3) meet the plane x+y+z=9x + y + z = 9? Substitute the coordinates of r(t)\mathbf r(t) into the plane: (1+t)+(2−t)+3t=9(1 + t) + (2 - t) + 3t = 9, so 3+3t=93 + 3t = 9 and t=2t = 2.

The point is r(2)=(3,0,6)\mathbf r(2) = (3, 0, 6); check 3+0+6=93 + 0 + 6 = 9. The angle α\alpha between the line and the plane uses a sine, sin⁡α=∣n⋅v∣∣n∣∣v∣=∣1−1+3∣3 11=333≈0.522\sin\alpha = \dfrac{|\mathbf n\cdot\mathbf v|}{|\mathbf n||\mathbf v|} = \dfrac{|1 - 1 + 3|}{\sqrt3\,\sqrt{11}} = \dfrac{3}{\sqrt{33}} \approx 0.522, so α≈31.5∘\alpha \approx 31.5^\circ. It is a sine because the angle between v\mathbf v and the normal is the complement of the angle between v\mathbf v and the plane.

Example
Example: the angle between two planes

Find the angle between the planes x+y=1x + y = 1 and y+z=3y + z = 3. Their normals are (1,1,0)(1, 1, 0) and (0,1,1)(0, 1, 1), with dot product 11 and lengths 2\sqrt2 each, so cos⁡θ=12\cos\theta = \tfrac12.

So θ=60∘\theta = 60^\circ. The two planes meet in a line, and its direction must be perpendicular to both normals, so it is their cross product: (1,1,0)×(0,1,1)=(1⋅1−0⋅1, 0⋅0−1⋅1, 1⋅1−1⋅0)=(1,−1,1)(1, 1, 0)\times(0, 1, 1) = (1\cdot1 - 0\cdot1,\ 0\cdot0 - 1\cdot1,\ 1\cdot1 - 1\cdot0) = (1, -1, 1). Normals answer both questions: the dot product gives the angle, the cross product gives the hinge.

Example
Example: distance from a point to a plane

How far is P=(3,1,−2)P = (3, 1, -2) from the plane 2x−y+2z=52x - y + 2z = 5? The normal n=(2,−1,2)\mathbf n = (2, -1, 2) has length 4+1+4=3\sqrt{4 + 1 + 4} = 3, and n⋅P−d=6−1−4−5=−4\mathbf n\cdot P - d = 6 - 1 - 4 - 5 = -4.

The distance is ∣−4∣3=43\tfrac{|-4|}{3} = \tfrac43; the negative sign only says that PP lies on the side the normal points away from. To find the nearest point of the plane, walk from PP along the normal: F=P−n⋅P−d∣n∣2 n=(3,1,−2)+49(2,−1,2)=(359,59,−109)F = P - \dfrac{\mathbf n\cdot P - d}{|\mathbf n|^2}\,\mathbf n = (3, 1, -2) + \tfrac49(2, -1, 2) = \left(\tfrac{35}{9}, \tfrac59, -\tfrac{10}{9}\right). It lies on the plane, since 70−5−209=5\tfrac{70 - 5 - 20}{9} = 5, and ∣F−P∣=49⋅3=43|F - P| = \tfrac49\cdot3 = \tfrac43, as the formula said.

Side note
Where it goes wrong

Using the numerator alone as the distance. For P=(3,1,−2)P = (3, 1, -2) and 2x−y+2z=52x - y + 2z = 5 the numerator is ∣−4∣=4|-4| = 4, but the same plane written as 4x−2y+4z=104x - 2y + 4z = 10 gives ∣12−2−8−10∣=8|12 - 2 - 8 - 10| = 8. A distance cannot depend on how the equation is scaled. Dividing by ∣n∣|\mathbf n| — 33 in the first form, 66 in the second — gives 43\tfrac43 both times.

Try it
Try it: two parallel planes

How far apart are the planes x+2y−2z=3x + 2y - 2z = 3 and 2x+4y−4z=182x + 4y - 4z = 18?

Show the answer

First give both planes the same normal: dividing the second by 22 gives x+2y−2z=9x + 2y - 2z = 9. Now both have n=(1,2,−2)\mathbf n = (1, 2, -2) with ∣n∣=3|\mathbf n| = 3, and the distance is ∣9−3∣3=2\tfrac{|9 - 3|}{3} = 2. Check with a point: (3,0,0)(3, 0, 0) lies on the first plane, and its distance to the second is ∣3−9∣3=2\tfrac{|3 - 9|}{3} = 2. Subtracting 33 from 1818 without rescaling would give 153=5\tfrac{15}{3} = 5, which is wrong because the two equations were written with different normals.

Proofs & Why It Matters

Tip
Proof: the point-to-plane distance formula

Let QQ be any point on the plane (n⋅Q=d\mathbf n\cdot Q = d) and P0P_0 the outside point. The distance is the length of the projection of P0−QP_0 - Q onto the unit normal: ∣n⋅(P0−Q)∣n∣∣=∣n⋅P0−n⋅Q∣∣n∣=∣ax0+by0+cz0−d∣a2+b2+c2\left|\dfrac{\mathbf n\cdot(P_0 - Q)}{|\mathbf n|}\right| = \dfrac{|\mathbf n\cdot P_0 - \mathbf n\cdot Q|}{|\mathbf n|} = \dfrac{|ax_0 + by_0 + cz_0 - d|}{\sqrt{a^2+b^2+c^2}} — the arbitrary QQ vanished into dd, which is why the formula needs no particular plane point. ■\blacksquare SIGNIFICANCE: this projection pattern is the template for every "distance to a flat object" problem — and in machine learning it is literally the margin of a linear classifier.

Reminder — Distance and midpoint:  d=(x2−x1)2+(y2−y1)2,M=(x1+x22, y1+y22)d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}, \qquad M=\left(\frac{x_1+x_2}{2},\ \frac{y_1+y_2}{2}\right)
Side note
Where this leads

Planes are the first example of the general idea "linear equation = flat object + normal vector." In linear algebra the same picture becomes hyperplanes and the row space; in optimization, constraint surfaces and Lagrange multipliers; in graphics, every triangle of every 3D model carries its normal for lighting. The dot-product test you just learned is computed billions of times per frame in a video game.

Going Deeper: Worked Problems

Example
Worked: the line where two planes meet

Find parametric equations for the intersection of x+y+z=6x + y + z = 6 and x−y+2z=3x - y + 2z = 3.

Step 1 — the direction of the line is perpendicular to BOTH normals, so take the cross product (1,1,1)×(1,−1,2)=(1⋅2−1⋅(−1),  1⋅1−1⋅2,  1⋅(−1)−1⋅1)=(3,−1,−2)(1,1,1)\times(1,-1,2) = (1\cdot2 - 1\cdot(-1),\; 1\cdot1 - 1\cdot2,\; 1\cdot(-1) - 1\cdot1) = (3, -1, -2).

Step 2 — find one point on both planes: set z=0z = 0 and solve x+y=6x + y = 6, x−y=3x - y = 3: x=4.5x = 4.5, y=1.5y = 1.5.

Step 3 — assemble: r(t)=(4.5,1.5,0)+t(3,−1,−2)\mathbf r(t) = (4.5, 1.5, 0) + t(3, -1, -2).

Step 4 — verify at t=1t = 1: the point (7.5,0.5,−2)(7.5, 0.5, -2) gives 7.5+0.5−2=67.5 + 0.5 - 2 = 6 ✓ and 7.5−0.5−4=37.5 - 0.5 - 4 = 3 ✓. Two planes, one cross product, one small system.

Example
Worked: distance from a point to a line in space

Find the distance from P=(1,2,3)P = (1, 2, 3) to the line through A=(0,0,1)A = (0, 0, 1) with direction v=(1,1,0)\mathbf v = (1, 1, 0).

Step 1 — displacement w=P−A=(1,2,2)\mathbf w = P - A = (1, 2, 2).

Step 2 — the perpendicular distance is ∣w×v∣∣v∣\dfrac{|\mathbf w\times\mathbf v|}{|\mathbf v|} (the parallelogram area divided by its base). Compute w×v=(2⋅0−2⋅1,  2⋅1−1⋅0,  1⋅1−2⋅1)=(−2,2,−1)\mathbf w\times\mathbf v = (2\cdot0 - 2\cdot1,\; 2\cdot1 - 1\cdot0,\; 1\cdot1 - 2\cdot1) = (-2, 2, -1), magnitude 33.

Step 3 — divide by ∣v∣=2|\mathbf v| = \sqrt2: distance 32=322\dfrac{3}{\sqrt2} = \dfrac{3\sqrt2}{2}.

Step 4 — cross-check by projection: the component of w\mathbf w along v\mathbf v is 32\tfrac{3}{\sqrt2}, and ∣w∣2−(32)2=9−4.5=4.5=(322)2|\mathbf w|^2 - \left(\tfrac{3}{\sqrt2}\right)^2 = 9 - 4.5 = 4.5 = \left(\tfrac{3\sqrt2}{2}\right)^2 ✓ — Pythagoras agrees with the cross product.