2. Let $x, y, z$ be positive real numbers, and $x y z + x + z = y$, find the maximum value of $P = \frac{2}{x^{2}+1} - \frac{2}{y^{2}+1} + \frac{3}{z^{2}+1}$. (1999 Vietnam Mathematical Olympiad)
2. It is easy to prove that $a c \neq 1$. From $x y z + x + z = y$, we can deduce that $b = \frac{a + c}{1 - a c}$. Let $a = \tan \alpha, b = \tan \beta, c = \tan \gamma, \alpha, \beta, \gamma \in \left(0, \frac{\pi}{2}\right)$, then $\tan \beta = \frac{\tan \alpha + \tan \gamma}{1 - \tan \alpha \tan \gamma} = \tan (\alpha + \gamma)$. Hence, $\beta = \alpha + \gamma$.

Thus,
$$\begin{aligned}
P = & \frac{2}{x^{2} + 1} - \frac{2}{y^{2} + 1} + \frac{3}{z^{2} + 1} = \frac{2}{\tan^{2} \alpha + 1} - \frac{2}{\tan^{2} \beta + 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 = \\
& 2 \sin \gamma \sin (2 \alpha + \gamma) + 3 \cos^{2} \gamma \leq \\
& 2 \sin \gamma + 3 \cos^{2} \gamma = 2 \sin \gamma + 3 (1 - \sin^{2} \gamma) = \\
- & -3 (\sin \gamma - \frac{1}{3})^{2} + \frac{10}{3} \leq \frac{10}{3}
\end{aligned}$$

The equality holds if and only if $2 \alpha + \gamma = \frac{\pi}{2}$ and $\sin \gamma = \frac{1}{3}$. That is, when $a = \frac{\sqrt{2}}{2}, b = \sqrt{2}, c = \frac{\sqrt{2}}{4}$, $P$ reaches its maximum value $\frac{10}{3}$.