First, separate the variables:
\(2 \cos^2 \theta \frac{dx}{d\theta} = \sqrt{2x + 1}\)
\(\Rightarrow \frac{dx}{\sqrt{2x + 1}} = \frac{1}{2 \cos^2 \theta} d\theta\)
Express \(\frac{1}{\cos^2 \theta}\) as \(\sec^2 \theta\):
\(\Rightarrow \frac{dx}{\sqrt{2x + 1}} = \frac{1}{2} \sec^2 \theta d\theta\)
Integrate both sides:
\(\int \frac{dx}{\sqrt{2x + 1}} = \frac{1}{2} \int \sec^2 \theta d\theta\)
The left side integrates to \(\sqrt{2x + 1}\), and the right side integrates to \(\frac{1}{2} \tan \theta + C\):
\(\sqrt{2x + 1} = \frac{1}{2} \tan \theta + C\)
Use the initial condition \(x = 0\) when \(\theta = \frac{1}{4}\pi\):
\(\sqrt{2(0) + 1} = \frac{1}{2} \tan \left(\frac{1}{4}\pi\right) + C\)
\(1 = \frac{1}{2} \cdot 1 + C\)
\(C = \frac{1}{2}\)
Substitute \(C\) back into the equation:
\(\sqrt{2x + 1} = \frac{1}{2} \tan \theta + \frac{1}{2}\)
Square both sides:
\(2x + 1 = \left(\frac{1}{2} \tan \theta + \frac{1}{2}\right)^2\)
\(2x + 1 = \frac{1}{4}(\tan \theta + 1)^2\)
\(2x = \frac{1}{4}(\tan \theta + 1)^2 - 1\)
\(x = \frac{1}{8}(\tan \theta + 1)^2 - \frac{1}{2}\)