<s>[INST] Show that $\int_0^{\pi/3} \frac{1}{(\cos\theta + \sqrt{3}\sin\theta)^2}\,d\theta = \frac{\sqrt3}{4}$ 
Show that $$\int_0^{\pi/3} \frac{1}{(\cos\theta + \sqrt{3}\sin\theta)^2}\,d\theta = \frac{\sqrt3}{4}$$

So I have attempted this, but have got a different answer so I have obviously done something wrong but i can't spot it. My workings are as shown. Any help will be great.
I started by writing $\cos\theta + \sqrt{3}\sin\theta$ as $2\cos(\theta - \frac \pi 3)$. This means that integral becoems,
$$\int_0^{\pi/3} \frac{1}{2\cos^2(\theta - \frac\pi3)}d\theta = \int_0^{\pi/3} \frac12\sec^2(\theta - \frac\pi3)d\theta = \left[\frac12 \tan(\theta-\frac\pi3)\right]_0^{\pi/3} $$
$$ = \frac12\tan(0) - \frac12\tan(-\frac\pi3) = 0 - \frac12\sqrt3$$
So I get a final answer of $-\sqrt3/2$ any help will be great.
 [/INST] You just missed a factor of two in the beginning and have a sign error in the last step.
\begin{align*}
\int_0^{\pi/3}\frac{1}{(\cos t +\sqrt{3}\sin t)^2} dt=&\frac 14 \int_0^{\pi/3} \frac{1}{\left(\frac 12 \cos t + \frac{\sqrt{3}}{2} \sin t\right)^2} dt = \frac 14 \int_0^{\pi/3}\frac{1}{\cos^2(t -\frac{\pi}{3})}dt\\
=& 
\frac 14 \left[\tan(t-\frac{\pi}{3})\right]_0^{\pi/3} =\frac{1}{4}(0-(-\sqrt{3})) = \frac{\sqrt{3}}{4}
\end{align*}
</s>