I am doing ray tracing and I do the refraction of the ray using the following relation (I got it from PDF "Reflections and Refractions in Ray Tracing"):
$$\mathbf{t} = \frac{\eta_1}{\eta_2}\mathbf{i} + \left(\frac{\eta_1}{\eta_2}\cos{\theta_i} - \sqrt{1 - \sin^2{\theta_t}}\right)\mathbf{n} \tag{22}$$
$$\sin^2{\theta_t} = \left(\frac{\eta_1}{\eta_2}\right)^2\sin^2{\theta_i} = \left(\frac{\eta_1}{\eta_2}\right)^2 (1 - \cos^2{\theta_i}) \tag{23}$$
But I have seen it in another PDF as follows:
$$\vec{t} = \frac{\eta_1}{\eta_2}\vec{i} + \left(\frac{\eta_1}{\eta_2}\cos{\theta_i} - \sqrt{1 - \sin^2{\theta_t}}\right)\vec{n} \tag{28}$$
$$\sin^2{\theta_t} = \left(\frac{\eta_1}{\eta_2}\right)^2\sin^2{\theta_i} = \left(\frac{\eta_1}{\eta_2}\right)^2 (1 - \cos^2{\theta_i}) \tag{29}$$
Could you please explain for me why?
And how can I reassure that my refraction vector that I calculated is correct?