(i) Start with the left-hand side: \(\left( \frac{1}{\cos \theta} - \tan \theta \right)^2\).
Rewrite \(\tan \theta\) as \(\frac{\sin \theta}{\cos \theta}\), so the expression becomes \(\left( \frac{1 - \sin \theta}{\cos \theta} \right)^2\).
This simplifies to \(\frac{(1 - \sin \theta)^2}{\cos^2 \theta}\).
Using the identity \(\cos^2 \theta = 1 - \sin^2 \theta\), the expression becomes \(\frac{(1 - \sin \theta)^2}{1 - \sin^2 \theta}\).
Factor the denominator: \(1 - \sin^2 \theta = (1 - \sin \theta)(1 + \sin \theta)\).
Cancel \(1 - \sin \theta\) from the numerator and denominator to get \(\frac{1 - \sin \theta}{1 + \sin \theta}\), which matches the right-hand side.
(ii) From part (i), we have \(\left( \frac{1}{\cos \theta} - \tan \theta \right)^2 = \frac{1 - \sin \theta}{1 + \sin \theta}\).
Set \(\frac{1 - \sin \theta}{1 + \sin \theta} = \frac{1}{2}\).
Cross-multiply to get \(2(1 - \sin \theta) = 1 + \sin \theta\).
Simplify to \(2 - 2\sin \theta = 1 + \sin \theta\).
Rearrange to \(2 - 1 = 2\sin \theta + \sin \theta\).
Thus, \(1 = 3\sin \theta\) or \(\sin \theta = \frac{1}{3}\).
Find \(\theta\) using \(\sin^{-1} \left( \frac{1}{3} \right)\), which gives \(\theta = 19.5^\circ\) or \(\theta = 160.5^\circ\) within the range \(0^\circ \leq \theta \leq 360^\circ\).