079Mathematics · Plane trigonometry

Nearest point along a ray

Nearest point along a ray

Nearest point along a ray · d_min,t,Rₓ,Rᵧ

  • 95 bytes
  • COMP mode
01

Worked examples

Example 1

On an east–north map measured in kilometres, a ship starts at P=(0,−40) and travels on a bearing of 315° (enter 360−45). A station is at Q=(0,0). Find the ship’s shortest possible distance from the station along its forward route.

  1. A.20 km
  2. B.20√2 km
  3. C.40 km
  4. D.20√3 km
Answer
B — minimum distance 20√2 km≈28.28427125 km.
Standard solution (without a calculator)
  1. Set the direction: Bearing 315°=360°−45° gives u=(−√2/2,√2/2).
  2. Project the displacement: Q−P=(0,40), so s=(0,40)·u=20√2>0 km and t=20√2 km.
  3. Locate the nearest point: R=P+tu=(−20,−20) km.
  4. Find the distance: d_min=|Q−R|=√(20²+20²)=20√2 km≈28.28427125 km.
  5. Select the option: 20√2 km is B; the forward projection is valid because t>0.
Do it on the calculator

Example 2

A rescue route starts at P=(−12,4) km and proceeds on a bearing of 30° from north. A beacon is at Q=(0,4) km. Find the nearest point R on the forward route to the beacon, the distance travelled to R and the beacon’s minimum distance from the route.

Answer
R=(−9,4+3√3) km≈(−9,9.196152423) km; t=6 km; d_min=6√3 km≈10.39230485 km.
Standard solution (without a calculator)
  1. Set the direction and displacement: u=(sin30°,cos30°)=(1/2,√3/2); Q−P=(12,0) km.
  2. Project forward: s=(12,0)·u=6 km>0, so t=6 km.
  3. Find the nearest route point: R=P+tu=(−12,4)+6(1/2,√3/2)=(−9,4+3√3) km.
  4. Find the perpendicular distance: d_min=|Q−R|=6√3 km≈10.39230485 km.
  5. State the coordinates: Rₓ=−9 km and Rᵧ=4+3√3 km≈9.196152423 km.
Do it on the calculator

Example 3

A ray starts at P=(8,6) m and points due north on bearing 0°. A fixed point is Q=(0,0) m. Find the nearest point on the forward ray, its distance along the ray and its distance from Q.

Answer
R=(8,6) m; t=0 m; d_min=10 m.
Standard solution (without a calculator)
  1. Set the direction: Bearing 0° gives u=(0,1), pointing north.
  2. Project the point: Q−P=(−8,−6) m and s=(−8,−6)·u=−6 m.
  3. Apply the ray restriction: Since s<0, t=max(0,s)=0 and the nearest point is the starting point R=(8,6) m.
  4. Find the distance: d_min=|Q−P|=√(8²+6²)=10 m.
  5. Interpret the output: The supporting infinite line has a foot behind P; the forward ray’s minimum is at P.
Do it on the calculator
02

When to use it

A bearing X determines the unit direction (sin X,cos X) in east–north coordinates. Project the vector from ray origin P=(A,B) to fixed point Q=(C,D) onto that direction, but restrict the along-ray distance to t≥0. The nearest ray point is R=P+t(sin X,cos X).

Enter two points and the bearing

  • Enter A and B as the east and north coordinates of ray origin P, then C and D for fixed point Q. Enter X as a bearing clockwise from north in degrees; use Deg, the same coordinate unit and a consistent origin.
  • Negative coordinates are allowed. The ray includes P and extends only forward; an angle expression such as 360-45 may be entered directly. Any real bearing has an equivalent direction modulo 360°.

Read distance and nearest point

  • Read the shortest distance d_min, then forward distance t, then nearest east coordinate Rₓ and north coordinate Rᵧ. Press EXE at the three Disp pauses and AC after the last coordinate.
  • If the perpendicular projection lies behind P, t=0 and R=P; the distance is then |PQ|. Do not use the nearest point on the whole infinite line in that case.

Question types

  • Original HKDSE Mathematics Compulsory Part practice applies coordinate geometry, bearings and perpendicular distance to a route represented by a ray. State why the forward-ray constraint matters.

Before you start

  • Use COMP / Deg / Norm 1 and an empty P1 with at least 95 bytes. P1–P4 share 680 bytes. A, B, C, D, X, M and Y may be overwritten; save stored values first.
  • Coordinates use east as x and north as y. Bearing X is clockwise from north in degrees. Reversing axes or using a standard angle from east changes the answer.
  • Use a single coordinate-length unit for A, B, C and D. The distance and t use that unit; Rₓ and Rᵧ are coordinates in the original frame.
  • The ray begins at P=(A,B) and runs forward. The program clamps a negative along-line projection to t=0; a point behind P is nearest to the origin P.
  • Enter all five values. Blank EXE may retain a previous register value and is not a zero; input 0 explicitly where needed.
  • The program gives numerical results, not a geometric proof or a map. Keep exact roots when possible, and round only as the question requests.
  • Extreme coordinates can lose precision through subtraction or overflow squared terms. Check units and signs before relying on an unexpected display.

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.

Checking access…

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.