The quickest path bends at the boundary
Measure every angle from the vertical, the normal to a flat boundary. A ray starts at point P in rock with speed c1 and ends at point Q in rock with speed c2. Inside each rock it runs straight, so the only freedom is where it crosses the boundary.
Fermat’s principle says the ray takes a path of stationary travel time. Write the time as a function of the crossing point, set its derivative to zero, and the two square-root terms turn into the sines of the two angles. The result is Snell’s law. The MIT notes for 12.201 do this in Section 4.14, Eqs. 4.91 to 4.94.
One ray parameter for every wave
The quantity p is the ray parameter. It is the horizontal component of the slowness, the inverse of the speed at which a wavefront sweeps along the boundary. Every wave created at the boundary must keep step with the incident wave along it, so all of them share the same p, including the S waves converted from an incident P wave. Section 4.15 of the MIT notes writes this as Eq. 4.95.
The ray parameter also stays fixed through a stack of flat layers, and it equals the slope of the travel-time curve along the surface (Eq. 4.98). Two stations a known distance apart that time the same arrival therefore measure p directly.
Past the critical angle the wave cannot enter
When the lower rock is faster, the transmitted angle is larger than the incident one. At the critical incidence the transmitted sine reaches one and the transmitted ray runs along the boundary. Beyond it Snell’s law asks for a sine larger than one.
The wave still exists, but its vertical slowness becomes imaginary. Its amplitude then decays with depth below the boundary instead of oscillating, and it carries no energy down into the lower rock. Intermezzo 4.4 of the MIT notes works this out for a wave along a free surface (Eqs. 4.104 to 4.106). Saavedra and Moro show in their Section 3.2 that the reflected wavelet changes shape past the critical angle because it picks up a phase shift.
A wave travelling along the boundary at the lower rock’s speed keeps sending energy back up at the critical angle. Receivers above record it as the head wave. Far enough away it arrives before the direct wave, because it spent most of its path in the fast rock.
Worked example
Angles and head-wave times for one boundary
The first preset of the interface Lab puts rock with a P speed of 2000 m/s and an S speed of 1000 m/s over rock with 4000 m/s and 2200 m/s. The transmitted P wave has a critical angle where the sine equals 2000 over 4000, which is 30.0 degrees. The transmitted S wave is faster than the incident P wave too, so it has its own critical angle, where the sine is 2000 over 2200: 65.4 degrees.
At the Lab’s default incidence of 40 degrees the ray parameter is the sine of 40 degrees over 2000 m/s, 0.3214 s/km. The reflected S wave leaves at 18.7 degrees and the transmitted S wave at 45.0 degrees. The transmitted P wave would need a sine of 1.29, so it is evanescent: the Lab shows zero transmitted P energy.
Now put a source and a line of receivers on a flat surface 750 m above this boundary. The head wave travels down at the critical angle, along the boundary at 4000 m/s and up again. Its arrival time is the distance divided by 4000 m/s plus a fixed delay of 0.650 s. It first appears 866 m from the source and overtakes the direct wave beyond 2.60 km.