Distance from a Point to a Line (3D, vectors) Explained with Worked Examples

The distance from a point to the line through with direction is .

Write 2x or 2*x to multiply, ^ for powers, and ; between simultaneous equations. You can also type factor, expand, derivative of, integrate … from a to b, limit … as x->0 or 15% of 80.

Try an example

Before you start

This page is easier if you are comfortable with:

What Distance from a point to a line (3D, vectors) means

The magnitude of the cross product is the area of the parallelogram on those two vectors. Dividing by the base length gives the height, which is the shortest distance from to the line.

In two dimensions the same distance comes from the point-to-line formula. The vector method works in any dimension where the cross product is defined, and the line is given as in its vector equation.

Another way is to find the foot of the perpendicular by setting the scalar product of (to a general point on the line) with equal to zero.

What is it used for?

The shortest distance from a point to a line in space is measured along the perpendicular. The cross product gives it without finding the foot of the perpendicular.

How to use distance from a point to a line (3d, vectors)

  1. Find from a point on the line to .
  2. Compute .
  3. Take its magnitude and divide by .
  4. Check with the foot of the perpendicular if you like.

Graph

Perpendicular distance from P to a linePfoot-101234567-1012345Perpendicular distance from P to a linexylineGraph with x from -1 to 7 and y from -1 to 5. Shows the curve line; point P at (4, 3); point foot at (3.2, 1.6).

The shortest distance from P to the line is along the segment that meets the line at a right angle.

Worked examples

These examples are worked by hand, step by step, so you can compare your own working.

Example 1: a point and the x-axis

Find the distance from to the line through the origin in direction .

Worked example
Answer
13≈3.61\sqrt{13}\approx3.61
  1. The perpendicular distance uses the other two coordinates

Example 2: a vertical line

Find the distance from to the line through in direction .

Worked example
Answer
55
  1. Horizontal offsets
  2. Distance

Example 3: using the cross product

Find the distance from to the line through the origin with direction .

Worked example
Answer
32≈1.22\sqrt{\tfrac32}\approx1.22
  1. AP × d
  2. Magnitudes

Special cases

A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.

A = (0, 0, 0), d = (0, 0, 1), P = (3, 4, 0)

AP × d

(4, −3, 0).

same

|AP × d|

5.

same

distance = 5/|d|

5.

d = (0, 0, 2)

|AP × d|/|d| = 10/2

5.

Word problems

Distance from P to the line through A with direction d is |AP × d|/|d|.

AP × d

AP = (3, 4, 0), d = (0, 0, 1).

  1. (4·1 − 0, 0 − 3·1, 0)
  2. Check: (4, −3, 0) ✓4

Magnitude

√(16 + 9).

  1. 5
  2. Check: ✓5

Divide by |d| Higher

|d| = 1.

  1. 5/1
  2. Check: ✓5

Scaled d Higher

d = (0, 0, 2): 10 ÷ 2.

  1. 5
  2. Check: independent of the scale ✓5

Common mistakes

Forgetting to divide by |d|

|AP × d| ✗

divide by |d| ✓

Normalise.

Using the dot product

AP·d ✗

AP × d ✓

Cross product.

Using |AP|

distance to A ✗

perpendicular distance ✓

Shortest.

AP in the wrong direction

PA ✗

either works up to sign ✓

Magnitude.

Exam tips

  1. |AP × d| / |d|.
  2. Cross product magnitude.
  3. Scale-free.
  4. Check by projecting.
  5. Zero ⇒ on the line.

Practice questions

Try each one on paper, then open the answer. Use the solver above to see the full working.

1. Distance: A = 0, d = (1, 0, 0), P = (5, 3, 4) Foundation

5

2. Distance: A = 0, d = (0, 1, 0), P = (6, 9, 8) Foundation

10

3. Distance: A = 0, d = (0, 0, 3), P = (3, 4, 7) Foundation

5

4. |AP × d|: AP = (1, 0, 0), d = (0, 2, 0) Higher

2

5. Distance: AP = (1, 0, 0), d = (0, 2, 0) Higher

1

6. Distance: A = 0, d = (1, 1, 0), P = (1, 0, 0), 4 dp Higher

0.7071

Practice generator

Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.

Solve: …

Key terms

Distance from point to line
Shortest distance.
Cross product
AP × d.
Direction vector
d.
Perpendicular
Shortest path.
Parallelogram area
Position vector
From the origin.

Frequently asked questions

What is the distance from a point to a line?

|AP × d|/|d|.

Why does it work?

|AP × d| is the parallelogram area; divide by the base |d| for the height.

Does the scale of d matter?

No.

What does zero mean?

The point is on the line.

Which page covers skew lines?

shortest distance between skew lines.

Which page covers the vector form?

vector equation of a line.

More in Vectors and matrices and the formula sheets.