Given: $\int f(x)\sin x \cos x dx = \log(f(x)){1\over 2( b^2 - a^2)}+C$, find $f(x)$. 
$$\int f(x)\sin x \cos x dx = \log(f(x)){1\over 2( b^2 - a^2)}+C$$


On differentiating, I get,
$$f(x)\sin x\cos x  = {f^\prime(x)\over f(x)}{1\over 2( b^2 - a^2)}$$  
$$\sin 2x (b^2 - a^2) = {f^\prime( x)\over (f(x))^2} $$
On integrating, 
$${-1\over f(x)} = {-(b^2 - a^2)\cos 2x\over 2} \implies f(x) = { 2\over(b^2 - a^2)\cos 2x}$$
The answer given is $\displaystyle f(x) = {1\over a^2 \sin^2 x + b^2 \cos^2 x}$.
I am unable to get the given result, the closest I got is, $$f(x) = {2\over b^2 \cos^2x -b^2\sin^2 x- a^2\cos^2x+ a^2\sin^2 x}$$.
How to simplify further to get the given answer ?
Related but not duplicate.

The solutions are OK (contrary to what I first wrote). After integrating, you can check that you have
$$
\frac{1}{f}=\frac{(b^2-a^2)\cos 2x}{2}
$$
and, according to the solution in the book,
$$
\frac{1}{f}=a^2\sin^2x+b^2\cos^2x.
$$
The difference should be a constant (the integrating constant). And indeed,
$$
\frac{(b^2-a^2)\cos 2x}{2}-\bigl(a^2\sin^2x+b^2\cos^2x\bigr)=-\frac{a^2+b^2}{2}.
$$
Thus, everything is in order.
