I am working through a pure maths text book out of interest. I have finished the chapter on integration and differentiation of trigonometric functions and am doing the end of chapter questions. This is causing me a problem:

Given that $p$ and $q$ are solutions of the equation $x \tan x = 1$,

Find an expression for $\int^1\_0 \cos^2 px \ dx$ entirely in terms of $p$, not involving any trigonometric functions.

This is my working so far:

if $p$ and $q$ are solutions of $x \tan x = 1$,

$$p\frac{\sin p}{\cos p} = 1$$

$$\cos^2px = \frac{1 + \cos 2px}{2}$$

$$\int \cos^2px ~dx = \frac{1}{2}(x + \frac{\sin 2px}{2p})$$

$$= \frac{1}{2}(\frac{2px + \sin 2px}{2p})$$

I need to find

$$\left[ 
 \frac{1}{2}((\frac{2px + \sin 2px}{2p})
 \right]\_{0}^1$$

But I cannot arrive at the answer in the book which is:

$$\frac{2 + p^2}{2(1 + p^2)}$$