The light source can either be the red dot in medium 1, or the purple dot in medium 2. In either case, the light is incident on the interface between the two media at the position of the green dot, which is fixed. Most of the time, some of the light reflects back into the medium it started in, and some refracts into the other medium. In some cases, however, none of the light enters the second medium - this is true when the angle of incidence exceeds the critical angle. (The critical angle is marked by the angled black lines in one of the media.) In that case, all the light reflects back into the medium it started in - we say that the light experiences total internal reflection.
Explore the simulation, adjusting the index of refraction of each medium, moving the light source around, and having the light come from the other medium, to find some general properties of refraction and of total internal reflection. In addition, when the light does refract from medium 1 into medium 2, use the purple dot to mark a point on the beam of light in medium 2. Then, switch the light source to medium 2 - what do you notice about the light that refracts into medium 1?
Simulation first posted on 2-22-2017. Written by Andrew Duffy