Start with the left-hand side (LHS):
\(\left( \frac{1}{\cos \theta} - \tan \theta \right)^2\)
Replace \(\tan \theta\) with \(\frac{\sin \theta}{\cos \theta}\):
\(\left( \frac{1}{\cos \theta} - \frac{\sin \theta}{\cos \theta} \right)^2 = \left( \frac{1 - \sin \theta}{\cos \theta} \right)^2\)
\(= \frac{(1 - \sin \theta)^2}{\cos^2 \theta}\)
Using the identity \(\cos^2 \theta = 1 - \sin^2 \theta\):
\(= \frac{(1 - \sin \theta)^2}{1 - \sin^2 \theta}\)
Factor the denominator:
\(= \frac{(1 - \sin \theta)^2}{(1 - \sin \theta)(1 + \sin \theta)}\)
Cancel \(1 - \sin \theta\) from numerator and denominator:
\(= \frac{1 - \sin \theta}{1 + \sin \theta}\)
This matches the right-hand side (RHS), proving the identity.