We are given the integral \( \int_0^{\frac{\pi}{4}} \frac{\cos^2 x}{\cos^2 x + 4 \sin^2 x} \, dx \).
Step 1: Rewrite the integral using trigonometric identities. The denominator can be rewritten as a sum involving the tangent function.
Step 2: Apply substitution to simplify the expression and evaluate the integral.
After solving, the result is:
\[
-\frac{\pi}{12} + \frac{2}{3} \tan^{-1} 2
\]
% Final Answer
The value of the integral is \( -\frac{\pi}{12} + \frac{2}{3} \tan^{-1} 2 \).