(i) To express \(\cos \theta + (\sqrt{3}) \sin \theta\) in the form \(R \cos(\theta - \alpha)\), we use the identity:
\(R \cos(\theta - \alpha) = R(\cos \theta \cos \alpha + \sin \theta \sin \alpha)\).
Comparing coefficients, we have:
\(R \cos \alpha = 1\) and \(R \sin \alpha = \sqrt{3}\).
Squaring and adding these equations gives:
\(R^2 \cos^2 \alpha + R^2 \sin^2 \alpha = 1^2 + (\sqrt{3})^2\).
\(R^2 = 1 + 3 = 4\).
\(R = 2\).
Now, \(\tan \alpha = \frac{\sqrt{3}}{1} = \sqrt{3}\), so \(\alpha = \frac{\pi}{3}\).
(ii) The integrand is of the form \(a \sec^2(\theta - \alpha)\) with \(a = \frac{1}{4}\).
The indefinite integral is:
\(\int \sec^2(\theta - \alpha) \, d\theta = \frac{1}{4} \tan(\theta - \frac{\pi}{3})\).
Using limits from 0 to \(\frac{1}{2}\pi\):
\(\left[ \frac{1}{4} \tan(\theta - \frac{\pi}{3}) \right]_{0}^{\frac{1}{2}\pi} = \frac{1}{4} \left( \tan(\frac{1}{2}\pi - \frac{\pi}{3}) - \tan(-\frac{\pi}{3}) \right)\).
\(= \frac{1}{4} \left( \sqrt{3} - (-\sqrt{3}) \right) = \frac{1}{4} (2\sqrt{3}) = \frac{1}{2\sqrt{3}}\).
Thus, \(\int_{0}^{\frac{1}{2}\pi} \frac{1}{(\cos \theta + (\sqrt{3}) \sin \theta)^2} \, d\theta = \frac{1}{\sqrt{3}}\).