(N/A) As shown in the figure, consider an extremely narrow region of width $dx$, between the layers at distances $x$ and $x+dx$, inside the extremely high cylindrical column of liquid.
In the above region, point $B$ is on the level $\overline{PQ}$, at height $y$ from the horizontal reference level, where the refractive index is $\mu$ and the gradient of the refractive index is $\frac{d\mu}{dy}$. At this point, a light ray $\overrightarrow{AB}$ is incident at an angle $(180^{\circ}-\theta)$. (Since $\overrightarrow{AB}$ makes an angle $(180^{\circ}-\theta)$ with the normal $M_1N_1$ drawn on the horizontal surface $\overline{PQ}$, which becomes the angle of incidence).
If there were no gradient of refractive index, the ray $\overrightarrow{AB}$ would have crossed the width $dx$ without deviation and would have reached point $B'$. But here, the refractive index increases with a decrease in height, so at level $\overline{RS}$, the height is $(y-dy)$ and the refractive index is $(\mu+d\mu)$, which is greater than $\mu$. Hence, the ray $\overrightarrow{AB}$ bends towards the normal $M_1N_1$ and advances from $B$ to $C$. Thus, the ray $\overrightarrow{BC}$ becomes the refracted light ray which makes an angle ${180^{\circ}-(\theta+d\theta)}$ with the normal $M_1N_1$.
Applying Snell's law at point $B$, we get:
$\mu \sin(180^{\circ}-\theta) = (\mu+d\mu) \sin(180^{\circ}-(\theta+d\theta))$
$\therefore \mu \sin\theta = (\mu+d\mu) \sin(\theta+d\theta)$
Using the approximation $\sin(\theta+d\theta) \approx \sin\theta + \cos\theta d\theta$ and neglecting higher-order terms like $d\mu d\theta$:
$\mu \sin\theta = \mu \sin\theta + \mu \cos\theta d\theta + d\mu \sin\theta$
$0 = \mu \cos\theta d\theta + \sin\theta d\mu$
$d\theta = -\tan\theta \frac{d\mu}{\mu}$
Integrating this over the horizontal distance $d$, the total deviation $\delta$ is given by $\delta = \int d\theta = -\int_0^d \tan\theta \frac{d\mu}{dx} dx$.