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.

$f(x) = {2\over b^2 \cos^2x -b^2\sin^2 x- a^2\cos^2x+ a^2\sin^2 x}$
$= {2\over b^2 \cos^2x -b^2(1-\cos^2 x)- a^2(1-\sin^2x)+ a^2\sin^2 x}$
$= {2\over b^2 \cos^2x -b^2 + b^2\cos^2 x- a^2 +a^2\sin^2x+ a^2\sin^2 x}$
$= {2\over -(a^2 + b^2 ) + 2b^2\cos^2x +2a^2\sin^2x}$
As you can see one extra term $-(a^2+b^2)$ in denominator and its not possible to eliminate it. 
Edit -
From @mickep comment as you have constant term after integration. If we consider $= {2\over -(a^2 + b^2 )}$ as constant term which is possible we get expected result.
