resulting refractive index of multiple layers with different indexes I am wondering whether my chain of thought is right because this seems very counterintuitive to me. 
But I calculated that if I have multiple layers with different refractive indexes stacked onto each other, the only indexes that matter are the one of the layer where the beams are emerging from and the one where the beam is finally immersing into. 
E.g. if my layers are: 
Light source -> Epoxy -> Silicone -> Water
the resulting relation is 
sin(a_water) = (n_epoxy / n_water) sin(a_epoxy)
Does it really not matter what material is in between? I searched the internet but I could not find an answer. As many times as I calculate this, the refractive index of the silicone layer cancel out.
Thank you very much.
 A: Your thinking is correct.
Snell's Law $$n_1\sin\theta_1=n_2\sin\theta_2=n_3\sin\theta_3=...$$ applies continuously as the ray crosses multiple layers of refractive material, provided that the refractive index varies in only one direction, and that the angles of incidence $\theta_1,\theta_2$ etc are measured relative to that direction. The variation can be smooth and continuous, it need not be abrupt changes between distinct layers. It does not need to vary monotonically (constant increase or decrease), it can vary anyhow.
To find the angle at which the ray emerges you only need to consider the 2 mediums in which the ray enters and emerges. It does not matter what layers it has passed through in between. If these 2 mediums are the same (eg air) then the beam emerges parallel to the direction from which it entered.
However, this theorem will not tell you how much the ray has deviated from its initial line of travel. Neither will it tell you how much the ray has been attenuated due to absorption in each layer or reflections at the interfaces between layers.
Neither can the theorem tell you whether the ray undergoes total internal reflection at one of the interfaces between layers of material. In that case the ray will emerge from the face which it entered, or a side face if the slab of multi-layer material is not wide enough. To find out if this happens you need to trace the ray through the layers, checking what happens at each boundary. 
