3. (1990 Vietnam Olympiad) Let $a, b, c \in \mathbf{R}^{+}$, and $a b c + a + c = b$, determine the maximum value of $p = \frac{2}{a^{2}+1} - \frac{2}{b^{2}+1} + \frac{3}{c^{2}+1}$.
3. Solution Let $a=\tan \alpha, b=\tan \beta, c=\tan \gamma, \alpha, \beta, \gamma \in\left(0, \frac{\pi}{2}\right)$, then from $a b c+a+c=b$ we get $b=\frac{a+c}{1-a c}$, which means $\tan \beta=\tan (\alpha+\gamma)$, hence $\beta=\alpha+\gamma$.

Therefore,
$$
\begin{aligned}
p & =\frac{2}{a^{2}+1}-\frac{2}{b^{2}+1}+\frac{3}{c^{2}+1}=2 \cos ^{2} \alpha-2 \cos ^{2}(\alpha+\gamma)+3 \cos ^{2} \gamma \\
& =\cos 2 \alpha+1-\cos (2 \alpha+2 \gamma)-1+3 \cos ^{2} \gamma \\
& =2 \sin \gamma \sin (2 \alpha+\gamma)+3 \cos ^{2} \gamma \leqslant 2 \sin \gamma+3 \cos ^{2} \gamma \\
& =3-3 \sin ^{2} \gamma+2 \sin \gamma=-3\left(\sin \gamma-\frac{1}{3}\right)^{2}+\frac{10}{3} \leqslant \frac{10}{3}
\end{aligned}
$$

Thus, when $2 a+\gamma=\frac{\pi}{2}, \sin \gamma=\frac{1}{3}$, i.e., $a=\frac{\sqrt{2}}{2}, b=\sqrt{2}, c=\frac{\sqrt{2}}{4}$, $p$ attains its maximum value $\frac{10}{3}$.