So now we know that rays, which are the normals to the phase fronts, travel in straight lines in homogeneous materials. We must not have just completely homogeneous materials in our designs, that is, empty boxes full of air, because those wouldn't be very interesting designs and we wouldn't get paid anything to design those. What we typically have, not exclusively but typically, is regions of, let's say air and then some bounded region of a different material, let's say glass. Our goal then is to understand how the rays change their direction, how the straight lines bend when they hit these boundaries. If we have that, then we can take an arbitrary distribution of materials that are all homogeneous and shoot rays, trace rays through those because they're going to go in straight lines until they hit a surface and at the surface they're going to bend. It turns out the solution to that, as I mentioned before, has been known since the 1600s, and that's Snell's laws. This is something you should have seen in a basic physics class but it's critical to this class so let's remind ourselves. The basic set-up of Snell's law is they have one material n, where our ray starts, and a second material, n_prime. We'll generally use the convention in this class that n and n_prime or variable and variable prime are before and after just to get a sort of uniform notation. So we have two materials, n and n_prime, and there's a planar boundary between them here. Now if this is a curved surface like a lens, then it's locally planar. When you look in a small enough scale, you can find a region you can generally describe as being planar. So this will describe lenses as well, we'll just have to deal with locally what's the slope of the surface. So if we imagine a ray coming in, how does it bend? It turns out this is a relatively simple thing to derive because we know that rays are the normal to the phase fronts. So let's go ahead and sketch in the phase fronts in the first medium. Remember that the distance between those phase fronts will have to be the free space or vacuum wavelength over n. And just as a reminder, by phase fronts here, what I mean is if you froze time, so you get a snapshot of this electromagnetic wave that's traveling along at the speed of light, and you pick any one phase between zero and two pi, which describes some position within one period of the wave, let's say the peak of the wave if you're looking at the real amplitude, then these would be the peaks of individual waves, and therefore the distance between them is the wavelength. If I then go into a material with a higher refractive index, the light must slow down, the local velocity must decrease, the temporal frequency stays the same, and therefore the distance between peaks must get smaller. A nice analogy for this is if these were a set of bicyclists racing, each one of these being a bicycle, when a bicycle race hits a hill and all the bicyclists slow down, they of course bunch up and they get closer together, just a physical analogy if you like. So it must be the case that along this boundary, the shape of the electromagnetic field, maybe not its amplitude, but the shape of the electromagnetic field must be conserved across the boundary. That is, if I have a peak and a valley and a peak going across here, just left to the boundary, I would expect just to the right to the boundary the same peak, valley, peak. So now if you wanted to figure out how rays bend, you realize that this fact that we have a conservation law on the boundary, that we have the same distance between peaks and troughs on the boundary, we can use that to derive how the rays bend. Because if you sit down to do the geometry, which is two seconds, this distance is the local wavelength divided by the sign of the right angle. So, if we then set those quantities equal on both sides using the local ray angle and the local wavelength, we derive Snell's law. So Snell's law, in this derivation is simply the conservation of the electric field shape across the boundary, and it tells us that n_sin_theta equals n_sin_theta, and that's the foundation of much of what we're going to do in this class. That is for refraction, for transmission through a boundary between two different refractive indices. The other one we need is reflection, it's much simpler, but it could be derived through the same technique, that if we come into a boundary, again, the phase fronts are normal to the ray, the ray that comes off the boundary must conserve that same period on the boundary because the boundary is basically an excitation that's sending the wave backwards, and in this case, it's pretty obvious that the incident and reflected angles will be the same. Notice that in the second case, it doesn't depend on refractive index at all. So, if your refractive index itself depends on the wavelength, which it does for essentially all materials, mirrors will send all light, independent of wavelength, off in the same direction if it comes in the same direction, while transmission, refraction at a boundary will tend to be a spread of angles here because the refractive indices on one or either side depend on wavelength. So, in reality, we have both of these things happen at all surfaces. Here's a picture of a pencil beam, which is approximately a ray coming in, it refracts a little bit into this piece of material, refracts back out at the same angle, and then also reflects off of each surface. In this case, it reflects off the back surface, refracts back out, and the two reflected or, in this case, refracted and then reflected rays come out parallel. So this is what it looks like in the lab. This is the foundation of what the program OpticStudio will be doing for us automatically through very complicated systems.