The Shortest Path That Touches a Line, Solved by Reflection
Find the shortest route from one point to a line and on to another by reflecting a point, with proof, examples and extensions.
Key takeaways
- Reflecting one endpoint across the line leaves the distance from every point of the line unchanged.
- The shortest touching path meets the line where segment AB′ crosses it, and its length equals AB′.
- At that best point, both legs of the path make equal angles with the line.
- If A and B are on opposite sides of the line, no reflection is needed.
- Reflecting twice solves paths that must touch two lines in a stated order.
You start at point A, must touch a straight line m, and then travel to point B on the same side of that line. To find the shortest route, reflect B across m to get B′, draw the straight segment AB′, and touch the line where that segment crosses it.
Think of walking from a tent to a straight riverbank for water and then on to a campfire. The reflection turns a bent route into a straight one, and straight is shortest.
Why the obvious guesses fail
Two natural guesses are to head for the point of the bank closest to A, or to aim for the spot halfway between A and B. The first makes leg one as short as possible but lengthens leg two. The second ignores that A and B may be at very different distances from the line.
The total length AP + PB depends on where P sits. As P slides far to either side, the total grows without limit, so somewhere in between it reaches a smallest value. The task is to locate that spot exactly.
The reflection argument
The reflection of B in line m is the point B′ on the other side such that m is the perpendicular bisector of BB′. Every point of a perpendicular bisector is equally far from the segment's ends. So for every P on m,
PB = PB′
AP + PB = AP + PB′ Each bent path to B has a twin to B′ with exactly the same length. Since A and B′ lie on opposite sides of m, the twin can be perfectly straight.
By the triangle inequality, AP + PB′ ≥ AB′, with equality only when P lies on segment AB′. That segment crosses m exactly once, at a point we call Q. Therefore Q gives the shortest path, and every other choice of P gives a strictly longer one.
The argument proves existence, finds the point and shows it is the only one, all at once.
A worked example with numbers
Let the line be the x-axis, A = (0, 3) and B = (8, 5). Then B′ = (8, −5).
The segment from (0, 3) to (8, −5) drops 8 units over 8 units, so its equation is y = 3 − x. It meets the axis at x = 3. The best point is Q = (3, 0).
AQ = √(3² + 3²) = 3√2
QB = √(5² + 5²) = 5√2
total = 8√2 ≈ 11.31
AB′ = √(8² + 8²) = 8√2 (same value) Compare other choices of P on the axis.
| Touching point P | Total length AP + PB (approximate) |
|---|---|
| (0, 0), closest to A | 12.43 |
| (3, 0), the reflection answer | 11.31 |
| (4, 0), halfway across | 11.40 |
| (8, 0), closest to B | 13.54 |
Notice how flat the bottom is. Missing the best point by one unit costs less than a tenth of a unit. Missing it badly costs much more.
Finding the point without coordinates
Drop perpendiculars AF and BG to the line. The right triangles AFQ and BGQ have equal angles at Q, so they are similar. Therefore
FQ / QG = AF / BG The touching point divides the span between the two feet in the ratio of the distances from the line. In the example, FG = 8, AF = 3 and BG = 5, so FQ is three eighths of 8, which is 3. Closer starting points get a touching point nearer to their own foot.
Equal angles and the behavior of light
Angle FQA is one of the angles between line m and line AB′. Its vertical angle is GQB′, and reflection makes GQB′ equal to GQB. So
∠AQF = ∠B′QG = ∠BQG The two legs of the shortest path make equal angles with the line. That is the law of reflection for a flat mirror. Heron of Alexandria used a shortest-path argument of this kind to explain why mirrors reflect at equal angles.
The modern statement, Fermat's principle, speaks of travel time and allows for paths that are stationary rather than strictly minimal, which matters for some curved mirrors. For a flat mirror in a uniform medium, shortest length and least time agree.
Variations on the setup
Opposite sides. If A and B are already separated by the line, segment AB crosses it. That segment is the answer.
One point on the line. If B lies on m, then B′ = B, and the shortest path is simply AB.
Largest difference. Ask instead which point P on m makes |PA − PB| as large as possible, with A and B on the same side. The triangle inequality gives |PA − PB| ≤ AB, with equality when P is where line AB meets m. If AB is parallel to m, no point attains that bound. If you ask for the same quantity with A and B on opposite sides, reflect one of them first.
Equal totals. All points P in the plane with PA + PB equal to a fixed number form an ellipse with foci A and B. Grow such an ellipse until it first touches line m. The touching point is Q. This picture connects the problem with the reflection property of ellipses.
Paths that touch two lines
Suppose you must go from A to a wall, then to a floor, then to B. Reflect A across the wall to get A′, and B across the floor to get B′. The length of any such route equals the length of a broken path from A′ to B′, so the straight segment A′B′ is the target.
Let the wall be the y-axis and the floor the x-axis, with A = (2, 5) and B = (6, 2). Then A′ = (−2, 5) and B′ = (6, −2).
slope of A′B′ = (−2 − 5) / (6 + 2) = −7/8
at x = 0: y = 5 − (7/8)(2) = 3.25 (point on the wall)
at y = 0: x = −2 + (8/7)(5) = 26/7 (point on the floor)
length = √(8² + 7²) = √113 ≈ 10.63 Both touching points lie on the real parts of the wall and floor, in the right order, so the answer is valid. Always make that check. If the straight segment misses a wall that has finite length, the best route bends at an end of the wall instead.
A loop inside an angle
Point P sits inside an acute angle with vertex O. You want points Q and R on the two sides making the perimeter of triangle PQR as small as possible. Reflect P in each side to get P₁ and P₂. The perimeter equals the length of the path P₁, Q, R, P₂, which is at least P₁P₂.
Since reflection preserves distance, OP₁ = OP₂ = OP, and the angle P₁OP₂ is twice the original angle. For an angle of 30°, triangle P₁OP₂ is equilateral, so the smallest perimeter is exactly OP.
The acute condition matters: with a right or wider angle, the segment P₁P₂ no longer crosses both sides away from O, and the loop collapses toward the vertex. The same unfolding idea drives Fagnano's problem about the shortest triangle inside a triangle.
When the line is slanted
Nothing in the argument depends on the line being horizontal. Take the line y = x, with A = (1, 4) and B = (3, 8), both above it.
Reflection in the line y = x swaps the two coordinates of a point, so B′ = (8, 3). The segment from A to B′ drops 1 unit while moving 7 to the right.
line AB′: y = 4 − (x − 1)/7
set y = x: 7x = 28 − x + 1
8x = 29, so x = 29/8 = 3.625
Q = (3.625, 3.625)
length AB′ = √(7² + 1²) = √50 ≈ 7.07 You can confirm the length by adding the legs: AQ ≈ 2.65 and QB ≈ 4.42, giving 7.07.
For a line in a general position, build the reflection geometrically. Drop a perpendicular from B to the line, then continue the same distance on the far side. With compass and straightedge, draw two arcs centered at two points of the line, each passing through B. Their second crossing is B′.
In three dimensions
Replace the line by a flat plane, such as a floor or a wall, and the same method works: reflect B through the plane and aim straight at the image.
A different problem arises when A, B and the line do not lie in one plane, for example when a path must touch a pipe running through a room. Reflection in the line is no longer the right move. Instead, rotate B about the line until it lands in the plane containing A and the line, on the side opposite A. Rotation about the line keeps every distance to points of the line unchanged, so the straight-segment argument applies again.
How to recognize the pattern
Use reflection when a problem asks for the least total of two distances and the shared point is confined to a line. Ask which endpoint to reflect (either works), draw the straight segment, then confirm that the crossing lies where the problem allows. If three or more fixed points are involved with no confining line, a different tool is needed, such as the construction of the Fermat point.