Prove inequality $\tan \left( \frac\pi2 \frac{(1+x)^2}{3+x^2}\right) \tan \left( \frac\pi2 \frac{(1-x)^2}{3+x^2}\right)\le\frac13 $ How to determine the range of the function
$$f(x)=\tan \left( \frac\pi2 \frac{(1+x)^2}{3+x^2}\right)
\tan \left( \frac\pi2 \frac{(1-x)^2}{3+x^2}\right)
$$
It it is straightforward to verify that $f(x)$ is even and
$$f(0)= \frac13, \>\>\>\>\> \lim_{x\to\pm \infty} f(x) \to -\infty$$
which implies $f(x) \in (-\infty,\frac13]$, i.e.
$$\tan \left( \frac\pi2 \frac{(1+x)^2}{3+x^2}\right)
\tan \left( \frac\pi2 \frac{(1-x)^2}{3+x^2}\right)\le \frac13
$$
and is visually confirmed below

However, it is not obvious algebraically that $f(x)$ monotonically decreases away from $x=0$. The standard derivative tests are not viable due to their rather complicated functional forms.
So, the question is how to prove the inequality  $f(x) \le \frac13$ with rigor.
Note that it is equivalent to proving
$$\cot \left(\frac{\pi(1+x)}{3+x^2}\right)
\cot \left(\frac{\pi(1-x)}{3+x^2}\right)\le \frac13
$$

Note that
$$f(x)=\tan\left(\frac{\pi}{2}\frac{(1+x)^2}{3+x^2}\right)\tan\left(\frac{\pi}{2}\frac{(1-x)^2}{3+x^2}\right)=\frac{2\cos(2\pi/(3+x^2))}{\cos(2\pi x/(3+x^2))-\cos(2\pi/(3+x^2)} +1,$$
which is slightly easier to take the derivative:
$$f'(x)=\frac{8 \pi x \cos(\frac{2 \pi x}{3 + x^2}) \sin(\frac{2 \pi}{3 + x^2}) - 4 \pi (x^2-3) \cos(\frac{2 \pi}{3 + x^2}) \sin(\frac{2 \pi x}{3 + x^2})}{(3 + x^2)^2 \left(\cos(\frac{2 \pi}{3 + x^2}) - \cos(\frac{2 \pi x}{3 + x^2})\right)^2}$$
Obviously the denominator is positive, so we need to show that for $x \geq  0$:
$$8 \pi x \cos\left(\frac{2 \pi x}{3 + x^2}\right) \sin\left(\frac{2 \pi}{3 + x^2}\right) - 4 \pi (x^2-3) \cos\left(\frac{2 \pi}{3 + x^2}\right) \sin\left(\frac{2 \pi x}{3 + x^2}\right) \leq 0.$$
This can be further simplified to
$$-2 \pi \left((x-1)(x+3) \sin\left(\frac{2 \pi(x-1)}{3 + x^2}\right) + (x+1)(x-3) \sin\left(\frac{2 \pi(x+1)}{3 + x^2}\right)\right)\leq 0\tag{1}$$
ant thus we need to show that for $x\geq 0$
$$(x-1)(x+3) \sin\left(\frac{2 \pi(x-1)}{3 + x^2}\right) \geq -(x+1)(x-3) \sin\left(\frac{2 \pi(x+1)}{3 + x^2}\right)$$
It seems we have to split it into intervals (probably two $x\in(0,1)$ and $x\in(1,\infty)$), and investigate the inequalities on the intervals, but I am stuck here at the moment.
UPDATE:
We see that (1) is an odd function, so it sufficient to investigate only one part, e.g. we need to show that for $x\geq 0$,
$$g(x)=(x-1)(x+3)\sin\left(\frac{2\pi(x-1)}{3+x^2}\right)\geq 0$$
We see that for $x\geq 0$, the equation has exacly 2 roots, $x=0$ and $x=1$ and therefore we can look at the sign in the subintervals. For example,plugging $x=0.5$, $g(0.5)=1.44022$ and $g(2)=3.909$. Thus the function $g(x)\geq 0$, and therefore $f(x)$ is non-increasing for $x\geq0$ (and by the oddness of (1), non-decreasing for $x\leq 0$).
If we look at the extrema $x=0$, and $x=1$, we see that $f(0)=\frac{1}{3}$ and $\lim_{x\to 1}f(x)=0$, therefore $f(0)=\frac{1}{3}$ is global maximum.
