Step 1: Fix the idea of the limiting ray.
As the incidence angle \(\alpha\) on AB is increased, the internal ray bends more and strikes the neighbouring side face more steeply (closer to grazing). Refraction out of that side face stops the instant the internal angle of incidence there reaches the critical angle \(\theta_c\). The value of \(\alpha\) at that instant is \(\alpha_{max}\).
Step 2: Relate the two internal angles by geometry.
Inside a rectangular slab the normal to AB and the normal to the adjoining side face are at \(90^\circ\). If the refraction angle at AB is \(r\), then the angle of incidence at the side face is its complement, \(\big(90^\circ - r\big)\).
Step 3: Impose TIR at the side face.
Total internal reflection just sets in when this equals the critical angle:
\[ 90^\circ - r = \theta_c,\qquad \sin\theta_c = \frac{n_2}{n_1}. \]
Taking sine of both sides gives \(\cos r = \dfrac{n_2}{n_1}\), hence
\[ \tan\theta_c = \frac{\sin\theta_c}{\cos\theta_c} \ \ \text{is not needed; instead use } \sin r = \sqrt{1-\frac{n_2^{2}}{n_1^{2}}} = \frac{\sqrt{n_1^{2}-n_2^{2}}}{n_1}. \]
Step 4: Refract back out through AB using Snell's law.
At AB, light passes from liquid to glass, so \(n_2\sin\alpha_{max} = n_1\sin r\). Substituting \(\sin r\):
\[ n_2\sin\alpha_{max} = n_1\cdot\frac{\sqrt{n_1^{2}-n_2^{2}}}{n_1} = \sqrt{n_1^{2}-n_2^{2}}. \]
Step 5: Solve for the maximum incidence angle.
\[ \sin\alpha_{max} = \frac{\sqrt{n_1^{2}-n_2^{2}}}{n_2} \]
\[ \alpha_{max} = \sin^{-1}\!\left(\frac{\sqrt{n_1^{2}-n_2^{2}}}{n_2}\right). \]
(If \(n_1 \ge \sqrt{2}\,n_2\) this fraction reaches 1, meaning every incidence angle up to grazing works.)
\[\boxed{\ \alpha_{max} = \sin^{-1}\!\left(\dfrac{\sqrt{n_1^{2}-n_2^{2}}}{n_2}\right)\ }\]