Given:

$\displaystyle \int_0^x \frac{ t^2 - 4 }{ 1+\cos^2(t)} dt$

at what value of x does the local maximum of f(x) occur?

I tried this, but it isn't correct.

(x^2-4)/(1+cos^2(x))

Do I not just plug in the variable at the top for t and subtract the same function replacing t with 0? What am I missing?