I was trying to come up with the reason for why light refracts upon entering a new medium and after consulting with the internet I believe my theory is known as the marching soldiers analogy. This analogy describes how when light hits a boundary at an angle, the near side of the light beam will slow down first whereas the far side will take longer to get to the boundary and slow down. Obviously, this causes a change in direction dependent on the time it takes for the far side to get to the boundary, which directly correlates with the angle at which the beam of light is incident upon the boundary.
My question is, does this work with just a single photon? If one particle/wave of light crosses a boundary between media, will it refract? The only way I could imagine this happening is if you took the photon to be a wave and thus have a little width (the distance between opposite peaks). Is this right or would a single photon just pass through with only a change in speed, not direction?
After reading more about Fermat's Principle I have a lot more questions but I'll read more so I can narrow them down.