Solution:
Key idea: When a function is defined by different formulas on different parts of the interval, we split the definite integral at the joining point: ∫abf(x)dx=∫acf(x)dx+∫cbf(x)dx.
Step 1 — Split the integral at x = π/2.
The formula for f changes at x=2π (about 1.57, which lies between 0 and 3), so we split there.
∫03f(x)dx=∫0π/2cos2xdx+∫π/233dx
Step 2 — Evaluate the first part.
An antiderivative of cos2x is 2sin2x.
∫0π/2cos2xdx=[2sin2x]0π/2
∫0π/2cos2xdx=2sinπ−sin0
∫0π/2cos2xdx=0
Step 3 — Evaluate the second part.
The integral of the constant 3 is 3x.
∫π/233dx=[3x]π/23
∫π/233dx=9−23π
Step 4 — Add the two parts.
We add the results of Steps 2 and 3.
∫03f(x)dx=0+9−23π
Note: Both formulas include the point x=2π (they give −1 and 3 there). The value of a function at a single point does not change a definite integral, so this does not affect the answer.
Therefore, ∫03f(x)dx=9−23π.