Let x, y, z are real numbers such that $$xyz + x + z = y $$and $ xz \neq 1$. If the greatest value of the expression $$\frac{2}{x^2+1}-\frac{2}{y^2-1}+\frac{3}{1+z^2}$$ is $\frac{p}{q}$ where $p$ and $q$ are relatively prime then $p-q$ is equal to ______
I have tried tried putting value of y from 1st equation to 2nd one that made denominator somehow good
$\displaystyle\frac{-2(1-xz)^2}{(1+x^2)(1+z^2)} +\frac{2}{1+x^2}+\frac{3}{1+z^2}$
And final expression $\displaystyle\frac{3x^2+2z^2-2x^2z^2+4xz+3}{(1+x^2)(1+z^2)}$
The denominator gets good even if you put value of $z$ or $x$ and the answer given is $7$ ( value of $p-q$) but from here I can't think what to do please help and correct me if I'm wrong
From your attempts we can understand that we need to find $$\max_{xz\neq1,xyz+x+z=y}\left(\frac{2}{1+x^2}-\frac{2}{1+y^2}+\frac{3}{1+z^2}\right).$$ Now, by your work we obtain: $$\frac{2}{1+x^2}-\frac{2}{1+y^2}+\frac{3}{1+z^2}=\frac{3x^2+2z^2-2x^2z^2+4xz+3}{(1+x^2)(1+z^2)}=$$ $$=\frac{10}{3}-\frac{16x^2z^2+x^2+4z^2-12xz+1}{3(1+x^2)(1+z^2)}=\frac{10}{3}-\frac{(4xz-1)^2+(x-2z)^2}{3(1+x^2)(1+z^2)}\leq\frac{10}{3}.$$ The equality occurs for $xz=\frac{1}{4}$, $x=2z$ and $xyz+x+z=y$, which gives $$(x,y,z)=\left(\frac{1}{\sqrt2},\sqrt2,\frac{1}{2\sqrt2}\right),$$ which says that we got a maximal value.