General Drinking Horse (axial-symmetry shortest path)

technique

Use axial symmetry to turn "sum of distances from a moving point on a line to two fixed points" into a single straight-segment problem between two fixed points.

Axial-symmetry shortest path (General Drinks His Horse) — the standard model for a moving point on a line with an "equal-coefficient two-leg distance sum". Reflect AA across \ell to get AA', which straightens the polyline into the segment AB|A'B|.

Universal form

minP(PA+PB)\min_{P \in \ell}\,\big(\, PA + PB \,\big)

Classical model

  • Moving point PP: on a line \ell
  • Fixed points A,BA, B: two fixed points on the same side of \ell
  • Key constraint: both legs carry weight 11 (use Hu-Bu-Gui (Different-Speed Minimum, sin-Angle Method) for non-unit coefficients); in the opposite-side case, just connect ABAB and intersect with \ell — no reflection needed (see "Variants / generalizations" below)

Moving point P (orange, sliding along ℓ) + two fixed points A, B on the same side of ℓ; minimize PA + PB

When to use

  • A moving point PP lies on a line (river / road / mirror), and you want to minimize PA+PBPA + PB (with A,BA, B two fixed points)
  • More generally: a sum of two distances tied to a single moving point, or any "polyline" wrapped around a set of fixed points
  • The problem often mentions "General drinks his horse at the river" (将军饮马), "light path", "mirror reflection", or "fetch water from a river then deliver to B"

The core move

Move one of the two points to the opposite side — reflect AA across \ell. The polyline then straightens out into AB|A'B|.

A and B on the same side of ℓ, plus A' the reflection of A across ℓ: the intersection of the segment A'B with ℓ is the optimal P

Construction

Given a line \ell in the plane with two fixed points A,BA, B on the same side and a moving point PP \in \ell:

  1. Reflect: take AA', the reflection of AA across \ell (so \ell is the perpendicular bisector of AAAA').

    Constructing the reflection A → A': perpendicular plus equal distance

  2. Swap distances: for any PP \in \ell, PA=PAPA = PA', so PA+PB=PA+PBPA + PB = PA' + PB.

  3. Straighten: by [[triangle-inequality]], PA+PBABPA' + PB \geq |A'B|, with equality when A,P,BA', P, B are collinear.

  4. Locate PP: PP is the intersection of segment ABA'B with \ell. The minimum equals AB|A'B|.

Why it works

Axial symmetry is a distance-preserving isometry (a reflection): every point on \ell has the same distance to AA as to AA'. So the unmanageable distance "from the moving point PP to AA" can be replaced, with no loss, by "from PP to AA'". After the swap, both legs start at PP, so the triangle inequality (polyline \geq straight segment) applies directly.

Worked examples

  • [[0001-shortest-path]] — the canonical "General drinks his horse" problem
  • Light leaves AA, reflects off a mirror \ell, and reaches BB — find the shortest light path (Fermat's principle = General Drinking Horse)

Variants / generalizations

When A and B are on opposite sides of ℓ, simply connect AB and take its intersection with ℓ — no reflection needed

  • Opposite-side case: if A,BA, B lie on opposite sides of \ell, just connect ABAB and intersect with \ell — no reflection needed.

Two lines, two reflections: unfold the polyline into a straight segment

  • Two lines + one moving point each: a moving point PP on 1\ell_1 and another QQ on 2\ell_2; minimize AP+PQ+QBAP + PQ + QB — reflect AA across 1\ell_1, BB across 2\ell_2, then connect with a straight line.
  • One line + several moving points: chain reflections to "unfold" the path into a single straight segment.
  • Weighted variant: when w1PA+w2PBw_1 \cdot PA + w_2 \cdot PB has unequal coefficients, reflection no longer applies — switch to Hu-Bu-Gui (Different-Speed Minimum, sin-Angle Method) / Weighted Fermat Point (rotation + scaling lemma).