For the ray ST to be parallel to the incident ray PQ, the total change in the direction of the light must be zero after passing through all four media. The deviation of the ray at each interface is dependent on the refractive indices of the media. For the emergent ray to remain parallel to the incident ray, the refractive indices \(n_2\) and \(n_3\) must be equal.
Thus, \(n_2 = n_3\), ensuring no net deviation of the light as it passes through the different media.