Problem - 3886
Let $x$, $y$, $z$ be three positive real numbers satisfying $xyz+x+z=y$. Find the maximum value of $$P=\frac{2}{x^2 + 1}-\frac{2}{y^2+1}+\frac{3}{z^2+1}$$
First, we claim $xz\ne 1$. This is because if $xz=1$, then we will have $x+y=0$ which contradicts the condition that $x$ and $z$ are both positive. Hence, we can conclude
$$xyz+x+z=y\Leftrightarrow y=\frac{x+z}{1-xz}$$
Let $x=\tan \alpha$, $y=\tan\beta$ and $z=\tan\gamma$ where $\alpha, \beta, \gamma\in (0, 90^\circ)$.
$$\tan\beta = \frac{\tan\alpha + \tan\gamma}{1-\tan\alpha\tan\gamma}=\tan(\alpha+\gamma)\implies \beta = \alpha+\gamma$$
Then, we have
\begin{align*}
P&= \frac{2}{\tan^2\alpha + 1}-\frac{2}{\tan^2(\alpha + \gamma)+1} + \frac{3}{\tan^2\gamma + 1}\\
&= 2\cos^2\alpha -2\cos^2(\alpha + \gamma) + 3\cos^2\gamma\\
&= (1+\cos 2\alpha) - (1+\cos 2(\alpha+\gamma)) + 3\cos^2\gamma\\
&= (\cos 2\alpha - \cos 2(\alpha+\gamma)) + 3\cos^2\gamma \\
&= 2\sin\alpha\sin(2\alpha + \gamma) +3(1-\sin^2\gamma)\\
&\le 2\sin\gamma + 3 - 3\sin^2\gamma\\
&= -3\Big(\sin\gamma -\frac{1}{3}\Big)^2 +\frac{10}{3}\\
&\le\boxed{\frac{10}{3}}
\end{align*}
Equality holds if and only if
$$
\left\{
\begin{array}{rl}
\sin(2\alpha+\gamma) &= 1\\
\sin\gamma &=\frac{1}{3}
\end{array}
\right.
\implies
\left\{
\begin{array}{rl}
\sin\gamma &=\frac{1}{3}\\
2\alpha +\gamma&=\frac{\pi}{2}
\end{array}
\right.
\implies
\left\{
\begin{array}{rl}
x &=\frac{\sqrt{2}}{2}\\
y &=\sqrt{2}\\
z &=\frac{\sqrt{2}}{4}
\end{array}
\right.
$$