\(\dfrac{M}{3}=\dfrac{x^2+y^2-xy}{x^2+y^2+xy}=\dfrac{3\left(x^2+y^2+xy\right)-2\left(x^2+y^2+2xy\right)}{x^2+y^2+xy}=3-\dfrac{2\left(x+y\right)^2}{x^2+y^2+xy}\le3\)
\(\Rightarrow M\le9\)
\(M_{max}=9\) khi \(\left\{{}\begin{matrix}x+y=0\\x^2+y^2+xy=3\end{matrix}\right.\) \(\Rightarrow\left(x;y\right)=\left(-\sqrt{3};\sqrt{3}\right);\left(\sqrt{3};-\sqrt{3}\right)\)
\(\dfrac{M}{3}=\dfrac{x^2+y^2-xy}{x^2+y^2+xy}=\dfrac{\dfrac{1}{3}\left(x^2+y^2+xy\right)+\dfrac{2}{3}\left(x^2+y^2-2xy\right)}{x^2+y^2+xy}=\dfrac{1}{3}+\dfrac{2\left(x-y\right)^2}{3\left(x^2+y^2+xy\right)}\ge\dfrac{1}{3}\)
\(\Rightarrow M\ge1\)
\(M_{min}=1\) khi \(\left\{{}\begin{matrix}x-y=0\\x^2+y^2+xy=3\end{matrix}\right.\) \(\Rightarrow x=y=\pm1\)