Subjects calculus

Integral Tan Square

Step-by-step solutions with LaTeX - clean, fast, and student-friendly.

Use the AI math solver

1. The problem is to evaluate the definite integral $$\int_{0}^{\frac{\pi}{4}} (2 - \tan x)^2 \, dx.$$\n\n2. We start by expanding the integrand using the formula $$(a - b)^2 = a^2 - 2ab + b^2.$$\n\n3. Expanding, we get $$(2 - \tan x)^2 = 4 - 4 \tan x + \tan^2 x.$$\n\n4. So the integral becomes $$\int_0^{\frac{\pi}{4}} (4 - 4 \tan x + \tan^2 x) \, dx = \int_0^{\frac{\pi}{4}} 4 \, dx - 4 \int_0^{\frac{\pi}{4}} \tan x \, dx + \int_0^{\frac{\pi}{4}} \tan^2 x \, dx.$$\n\n5. Evaluate each integral separately:\n- $$\int_0^{\frac{\pi}{4}} 4 \, dx = 4x \Big|_0^{\frac{\pi}{4}} = 4 \cdot \frac{\pi}{4} = \pi.$$\n- $$\int_0^{\frac{\pi}{4}} \tan x \, dx = -\ln|\cos x| \Big|_0^{\frac{\pi}{4}} = -\ln\left(\frac{\sqrt{2}}{2}\right) + \ln(1) = -\ln\left(\frac{\sqrt{2}}{2}\right) = \frac{1}{2} \ln 2.$$\n- For $$\int_0^{\frac{\pi}{4}} \tan^2 x \, dx,$$ use the identity $$\tan^2 x = \sec^2 x - 1.$$\nThus, $$\int_0^{\frac{\pi}{4}} \tan^2 x \, dx = \int_0^{\frac{\pi}{4}} (\sec^2 x - 1) \, dx = \int_0^{\frac{\pi}{4}} \sec^2 x \, dx - \int_0^{\frac{\pi}{4}} 1 \, dx.$$\n\n6. Evaluate these integrals:\n- $$\int_0^{\frac{\pi}{4}} \sec^2 x \, dx = \tan x \Big|_0^{\frac{\pi}{4}} = 1 - 0 = 1.$$\n- $$\int_0^{\frac{\pi}{4}} 1 \, dx = x \Big|_0^{\frac{\pi}{4}} = \frac{\pi}{4}.$$\n\n7. Therefore, $$\int_0^{\frac{\pi}{4}} \tan^2 x \, dx = 1 - \frac{\pi}{4}.$$\n\n8. Substitute all results back into the original integral:\n$$\pi - 4 \cdot \frac{1}{2} \ln 2 + 1 - \frac{\pi}{4} = \pi - 2 \ln 2 + 1 - \frac{\pi}{4} = \frac{3\pi}{4} + 1 - 2 \ln 2.$$\n\n9. Final answer: $$\boxed{\frac{3\pi}{4} + 1 - 2 \ln 2}.$$