Refractive Index formula for denser to rarer medium

I learnt that the formula for refractive index when light travels from rarer to denser medium is

$$\frac{\sin i }{ \sin r}$$ where $i =$ angle of incidence, $r =$ angle of refraction.

Is the same formula used for calculating refractive index when light travels from denser to rarer medium? Or is it $$\frac{\sin r }{ \sin i}$$ in this case?

• It's the same equation, but note that the equation is $sin(i)/sin(r) = n_r/n_i$ where $n_i$ is the refractive index on the side the light is coming from and $n_r$ is the refractive index on the side the light is going to (the far side). For light going from denser to rarer $n_i > n_r$. Mar 12 '14 at 7:03
• @JohnRennie Note that denser doesn't always imply higher refractive index. See my answer here:physics.stackexchange.com/a/68341/21817 . Mar 12 '14 at 19:34

It is important to note that the equation you mention gives the index of refraction of one medium with respect to another. If light travels from one medium with refractive index $n_i$ and incident angle $i$, to another medium with refractive index $n_r$ and refraction angle $r$, then the relationship is described by Snell's Law as such: $$n_isin(i)=n_rsin(r)$$ which can be rewritten like this: $${sin(i) \over sin(r)} = {n_r \over n_i}$$ If we say that $n_i < n_r$ meaning the light propagates from a rarer to a denser medium, then the above equation gives the index of refraction of the denser medium in relation to the index of refraction of the rarer medium.
If instead we wanted to consider the case where light travels from a denser to rarer medium, then the only change would be that now $n_i > n_r$ in which case the above equation would yield the index of refraction of the rarer medium in relation to the denser medium. Notice that in this second case if we still desire the index of the denser medium with respect to the index of the rarer medium we must rearrange the equation like this: $${sin(r) \over sin(i)} = {n_i \over n_r}$$ But this is simply a consequence of which ratio we are looking for. For example, say we consider the propagation of light from air to some unknown denser material. In this case, $n_i \approx 1$, the index of refraction of air, and $n_r = n_x$ the index of refraction of the unknown material. We would then say that from the first relationship defined the index of refraction of the unknown material is: $$n_x = {sin(i) \over sin(r)}$$ If instead we said this light traveled from the denser unknown medium to the air, then $n_i= n_x$ and $n_r \approx 1$. In which case we would find the index of the unknown material by using the second relationship: $$n_x = {sin(r) \over sin(i)}$$
The more conventional formula for calculating the refractive index is: $n_{21}=\frac {\sin x_1}{\sin x_2}$ so basically the refractive index of $n_2$ with respect to $n_1$ equals $\frac{\sin x_1}{\sin x_2}$. It works for rays originating from both rarer and denser mediums.