<s>[INST] Find the value of the integral: $\int_{0}^{\frac{\pi}{4}} \frac{1}{3\cos^2\theta + \sin^2\theta}d\theta$ 
Using the substitution $t = \tan\theta$ , find the value of the integral:
  $$\int_{0}^{\pi/4} \cfrac{1}{3\cos^2\theta + \sin^2\theta}d\theta$$

I isolated $\theta$ in $t = \tan\theta$, and then substituted the expression into the integral. I then replaced $d\theta$ by $dt$, which resulted in a very ugly, large expression. 
The following is the answer given:

I do not understand how the first integral was obtained. 
 [/INST] You could also use that
$\displaystyle\int_{0}^{\pi/4} \cfrac{1}{3\cos^2\theta + \sin^2\theta}d\theta=\int_0^{\pi/4}\frac{\frac{1}{\cos^2\theta}}{\frac{3\cos^2\theta}{\cos^2\theta}+\frac{\sin^2\theta}{\cos^2\theta}}d\theta=\int_0^{\pi/4}\frac{\sec^2\theta}{3+\tan^2\theta} d\theta=\int_0^1\frac{1}{3+t^2}dt$
</s>