I have this function ($x>0$) $$f (x)=\frac{\sqrt{g (x)}+4 x \left(x^2+1\right) \sin (\pi x) \cos ((3+\pi ) x)}{x^4+2 x^2+1+\left(4 x^2+\left(x^2-1\right)^2 \cos (2 \pi x)\right)}$$ where $g(x)=4 x^2+\left(x^2-1\right)^2 \cos (2 \pi x)-\left(x^2+1\right)^2 \cos (2 (3+\pi ) x)\;$. I want to show that the range of function $f(x)$ for those values of $x$ in which $g(x)=0\;$ is $[-1,1]$.
From $g(x)=0\;$ we have $\;4 x^2+\left(x^2-1\right)^2 \cos (2 \pi x)=\left(x^2+1\right)^2 \cos (2 (3+\pi ) x)\;$. The LHS is the same as one of the term in denominator of $f$. Then, is it sufficient to substitute this term in $f$ and then check the range? Does this give the range of the function for only those values of $x$ for which $g(x)=0$? If not, how can I prove that the range of function $f(x)$ for those values of $x$ in which $g(x)=0\;$ is $[-1,1]$?
P.S. I did this way, but I see that that the range of function for some $x_0$ is greater than one, but when I check $g(x_0)\;$, it is not zero!
Yes, you can substitute like you have done and the range so obtained will only consist values of $f(x)$ for which $g(x)=0$ is satisfied.
Though only substituting the value of $g(x)$ ,like you have done, does not lead to the complete solution...
Here is one way of doing this... For the eqaution $g(x)=0$, use the identity $\cos(2t)=1-2\sin^2t$ for both cosines and simplify to get
$$\left(\frac{x^2+1}{x^2-1}\right)^2=\left(\frac{\sin(\pi x)}{\sin((3+\pi)x)} \right)^2$$
Using this alongwith substituting the value as you have mentioned leads to
$$f(x)=\frac{2x\sin(\pi x)}{(x^2+1)\cos((3+\pi )x)}=\frac{2x \sin(\pi x)}{\sqrt{(x^2+1)^2-(\sin(\pi x)^2(x^2-1)^2}} $$
Now this indeed lies between $[-1,1]$.