\(2\log_3\frac{x+y}{x^2+y^2+xy+2}=x^2+y^2+xy-3\left(x+y\right)\)
\(\Leftrightarrow2\log_33\left(x+y\right)+3\left(x+y\right)=2\log_3\left(x^2+y^2+xy+2\right)+\left(x^2+y^2+xy+2\right)\)
Xét hàm \(f\left(t\right)=2log_3t+t\) với \(t>0\)
\(f'\left(t\right)=\frac{2}{t.ln3}+1>0\Rightarrow f\left(t\right)\) đồng biến
\(\Rightarrow3\left(x+y\right)=x^2+y^2+xy+2\)
\(\Rightarrow3\left(x+y\right)=\left(x+y\right)^2+2-xy\)
\(\Rightarrow-xy=3\left(x+y\right)-\left(x+y\right)^2-2\)
\(3x+2y+1=x\left(y+1\right)-xy+2\left(x+y\right)+1\)
\(\Rightarrow3x+2y+1\le\frac{1}{4}\left(x+y+1\right)^2-xy+2\left(x+y\right)+1\)
\(\Rightarrow3x+2y+1\le\frac{1}{4}\left(x+y+1\right)^2+5\left(x+y\right)-\left(x+y\right)^2-1\)
\(\Rightarrow3x+3y+1\le-\frac{3}{4}\left(x+y\right)^2+\frac{11}{2}\left(x+y\right)-\frac{3}{4}\)
Đặt \(x+y=t\Rightarrow P\le\frac{-3t^2+22t-3}{4\left(t+6\right)}\)
\(P\le\frac{-3t^2+22t-3}{4\left(t+6\right)}-1+1=\frac{-3\left(t-3\right)^2}{4\left(t+6\right)}+1\le1\)
\(P_{max}=1\) khi \(t=3\Leftrightarrow\left\{{}\begin{matrix}x=2\\y=1\end{matrix}\right.\)