Find the maximum value of $P= \frac2{1+a^2}-\frac2{b^2+1}+\frac3{c^2+1}$ The problem is, given that $a,b,c>0$ and $abc+a+c=b$, then find the maximum value of
\begin{align}
P= \frac2{1+a^2}-\frac2{b^2+1}+\frac3{c^2+1}
\end{align}
One thing I know for sure is that $a,c$ are symmetric, or so I thought.
In the condition, clearly $a,c$ are symmetric, and thus I guessed that if (a,b,c) satisfies P is maximum then (c,b,a) should also be one. But unfortunately, in $P$, the role of $a$ and $c$ are irreversible.
So how should I approach this problem?
Any help is appreciated!
 A: Following a tip by a previous answer, we set $a=\tan \theta~,~ c=\tan\phi$ and we find by solving the constraint that, surprisingly:
$$b=\tan(\theta+\phi)$$
which allows us to write
$$P=\frac{3}{2}+\cos 2\theta -\cos (2\theta+2\phi)+\frac{3}{2}\cos2\phi$$
where $\theta,\phi,\theta+\phi \in (0,\pi/2)$. Taking derivatives and solving the simple trigonometric equations yields a maximum in the interior of the $(\theta,\phi)$ region at
$$\cos 2\theta_0=\frac{1}{3}~~,~~ \cos 2\phi_0=\frac{7}{9}$$
and after comparing with the various boundary values of the function we finally conclude that
$$P\leq P(\theta_0, \phi_0)=\frac{10}{3}$$
A: You have two ways to solve the problem without changing variables.
First way
From the constraint, we have, for example, $b=-\frac{a+c}{a c-1}$. Replacing in $P$ and simplifying
$$P=\frac{a^2 \left(3-2 c^2\right)+4 a c+2 c^2+3}{\left(a^2+1\right)
   \left(c^2+1\right)}$$ Computing the partial derivatives
$$\frac{\partial P}{\partial a}=-\frac{4 c \left(a^2+2 a c-1\right)}{\left(a^2+1\right)^2 \left(c^2+1\right)}=0\tag 1$$
$$\frac{\partial P}{\partial c}=-\frac{2 \left(a \left(5 a c+2 c^2-2\right)+c\right)}{\left(a^2+1\right)   \left(c^2+1\right)^2}=0\tag 2$$
From $(1)$, $c=\frac{1-a^2}{2 a}$. Plug in the numerator of $(2)$ to obtain
$$-4 a^3-2 a+\frac{2}{a}=0 \implies -\frac{2 \left(a^2+1\right) \left(2 a^2-1\right)}{a}=0\tag 3$$ So, taking into account the conditions
$$a=\frac{1}{\sqrt{2}} \implies c=\frac{1}{2 \sqrt{2}} \implies b=\sqrt{2}\implies
P=\frac{10}{3}$$
Second way
Using Lagrange multipliers, consider
$$F=P+\lambda(abc+a+c-b)$$
$$\frac{\partial F}{\partial a}=\lambda  (b c+1)-\frac{4 a}{\left(a^2+1\right)^2}=0\tag 4$$
$$\frac{\partial F}{\partial b}=\lambda  (a c-1)+\frac{4 b}{\left(b^2+1\right)^2}=0\tag 5$$
$$\frac{\partial F}{\partial c}=\lambda  (a b+1)-\frac{6 c}{\left(c^2+1\right)^2}=0\tag 6$$
$$\frac{\partial F}{\partial \lambda}=abc+a+c-b=0\tag 7$$
But, for this case, it is quite tedious to solve equations $(4,5,6,7)$ but it leads to the same results with $\lambda=\frac{16 \sqrt{2}}{27}$.
