📘 CodingMarble Learn

Shortest Path by Reflection

To go from A to a straight road and then to B (both on the same side), flip B over the road to get B′. The shortest route is the straight line from A to B′; where it crosses the road is the best stop P. It works because PB = PB′ for every point P on the road, so AP + PB = AP + PB′, and a straight line is the shortest way from A to B′.

🎬 Step-by-step story

  1. A and B are on the same side of a straight road. You must walk from A to the road, then to B. Which spot P on the road is best?
  2. Pick any spot P. The path is A to P to B. The total length is shown below.
  3. Slide P to another spot. The total changes. Some spots are short, some are long.
  4. Flip B over the road like in a mirror. The new point is B′. For every P on the road, PB and PB′ are equal.
  5. So A to P to B is as long as A to P to B′. The shortest way from A to B′ is a straight line. The place where it meets the road is the best P.
  6. Now you try. Slide P and watch the total. When the path turns green, you have found the shortest path.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why not just walk to the nearest point of the road?

The nearest point only helps A. You also have to walk on to B. Slide P in the 3D: the total changes and the best spot is usually not the nearest one.

Why do we flip B and not just measure?

The flip turns the bent path into a straight one, and a straight line is the only path we know is shortest. Then we can find P exactly instead of guessing.

Why is PB equal to PB′?

The road is the mirror, and B and B′ are the same distance from it with BB′ at 90° to the road. Two matching right triangles share the side from P to the foot, so PB = PB′. See the two thin lines in the 3D.

Why is the straight line AB′ the shortest?

In any triangle, two sides together are longer than the third. So any bent path from A to B′ is longer than the straight one.

What angle does the path make at P?

The road makes equal angles with PA and PB. This is how light bounces off a mirror.

What if A and B are on opposite sides of the road?

Then you do not reflect at all. The straight line AB already crosses the road, and that crossing is P.

The problem: one stop on a straight line

A straight road is a line. Point A and point B are on the same side of it. You start at A, touch the road at some point P, and then go to B. We want the shortest total walk, that is, the smallest value of AP + PB.

If A and B were on opposite sides of the road, it would be easy: walk straight from A to B and you cross the road on the way. The hard case is when both are on the same side. Then a straight walk from A to B never touches the road.

The mirror trick: reflect B

Think of the road as a mirror. Put B in front of the mirror and look at its image. The image is the point B′. It is the same distance behind the road as B is in front, and the line BB′ meets the road at a right angle.

Now take any point P on the road. The mirror makes triangle P-B-foot and triangle P-B′-foot exactly the same, so PB = PB′. This is the key fact. It means

AP + PB = AP + PB′

The mirror has turned a bent path into a path from A to B′ that goes through P. Now the road is not in our way, because B′ is on the other side. The shortest way from A to B′ is the straight line AB′. That line must cross the road, and the crossing point is the best P.

Steps to solve any such problem

  1. Check that A and B are on the same side of the line. (If not, just join A and B.)
  2. Reflect B in the line to get B′. Reflect it straight across, along a line at 90° to the road.
  3. Join A to B′ with a straight line.
  4. Mark P where AB′ meets the road. This P is the best stop.
  5. The shortest length is AB′. Find it with the Pythagoras theorem or the distance formula.

You can reflect A instead of B. The answer is the same.

Why no other point can do better

Take any other point Q on the road. Then AQ + QB = AQ + QB′. In the triangle A-Q-B′, two sides together are longer than the third side, so AQ + QB′ is more than AB′. So every other stop gives a longer walk than the stop on the straight line. Only when Q lies on AB′ do the two become equal.

There is one more thing to see. At the best P, the road makes equal angles with PA and PB. This is how light bounces off a mirror, and it is why light is said to choose the shortest path.

Try it: string and paper

On paper: Draw a long line for the road. Mark A and B on one side. Fold the paper along the road and prick through B with a pin to mark B′ on the other side. Open the paper, join A to B′ with a ruler, and mark P. Now pick a different point Q on the road and measure AQ + QB with a thread. Check that it is longer than the path through P.

In the 3D above: predict where the best P will be, then slide P and check the green colour.

Key formulas and definitions

Worked examples

1. A is 3 units from a straight road and B is 2 units from it. Their feet on the road are 9 units apart. Find the shortest path from A to the road to B.

Reflect B to B′, which is 2 units on the other side. Then A and B′ are a + b = 3 + 2 = 5 units apart across the road and 9 units apart along it. AB′ = √(9² + 5²) = √106 ≈ 10.3 units. P is 9 × 3 ÷ 5 = 5.4 units from the foot of A.

2. A and B are both 4 m from a road and their feet are 6 m apart. Where is the best stop and how long is the shortest walk?

B′ is 4 m on the other side, so A and B′ are 8 m apart across the road and 6 m along it. AB′ = √(6² + 8²) = 10 m. P is 6 × 4 ÷ 8 = 3 m from each foot, exactly in the middle.

3. On a grid the road is the x-axis. A = (0, 2) and B = (6, 4). Find the best point P on the road.

Reflect B in the x-axis: B′ = (6, −4). The line from A (0, 2) to B′ (6, −4) goes down 6 while going right 6, so its slope is −1. It meets y = 0 when x = 2. So P = (2, 0). The shortest length is AB′ = √(6² + 6²) = 6√2 ≈ 8.49.

4. A tent is 120 m from a straight river bank and a hut is 180 m from it, on the same side. The two feet are 400 m apart. A girl goes from the tent to the river to fill a pot, then to the hut. What is the shortest distance she must walk?

Reflect the hut to the other bank: it is 180 m behind the river. Across the river the tent and the image are 120 + 180 = 300 m apart, and along it 400 m. Distance = √(400² + 300²) = 500 m. She fills the pot 400 × 120 ÷ 300 = 160 m from the foot of the tent.

5. In Example 2, suppose the person stops 1 m from the foot of A instead of 3 m. How much longer is the walk?

AP = √(1² + 4²) = √17 ≈ 4.12 m. PB: P is 5 m from the foot of B, so PB = √(5² + 4²) = √41 ≈ 6.40 m. Total ≈ 10.52 m. That is about 0.52 m more than the shortest 10 m.

6. A mirror lies along the x-axis. A light ray goes from A (1, 3) to the mirror and then to B (7, 1). Where does it hit the mirror?

Reflect B to B′ = (7, −1). The line from A (1, 3) to B′ (7, −1) goes right 6 and down 4. It reaches y = 0 after going down 3, which is 3 ÷ 4 of the way, so x = 1 + 6 × 3/4 = 5.5. The ray hits the mirror at (5.5, 0). The shortest length is √(6² + 4²) = √52 ≈ 7.21.

Common mistakes

Practice quiz

1. The shortest way between two points is:
2. For any point P on the road, PB is equal to:
3. B′ is found by:
4. The best stop P is where the road meets the line:
5. A and B are each 4 units from the road and their feet are 6 apart. The shortest path is:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

How do you find the shortest path using reflection?

Reflect one point in the line, join the other point to the image with a straight line, and mark where it crosses the line. That crossing point gives the shortest route.

Why does reflection work for shortest path problems?

The mirror makes PB equal to PB′ for every point P on the line. So the bent path A-P-B has the same length as A-P-B′, and the shortest path to B′ is a straight line.

Does it matter whether I reflect A or B?

No. Both give the same point P and the same shortest length.

Where this is taught

China八年级(初二)Ch.15 Axial symmetry

Learn first

Related lessons

All Maths lessons