<s>[INST] If $(a,b)=1$, how to find the suitable $u$ and $v$ such that $(a+b)u+(a^2-ab+b^2)v=3$? Suppose $(a,b)=1$. I want to prove that $(a+b,a^2-ab+b^2)=1$ or $3$.
Since $(a,b)=1$, so $(a^2,b^2)=1$ and therefore there are $x,y\in\mathbb Z$ such that $a^2x+b^2y=1$ or $3a^2x+3b^2y=3$ and by adding and subtracting $3abx+3aby+3a^2y+3b^2x$, we have
$$\begin{align*}3a^2x+3b^2y&+3abx+3aby+3a^2y+3b^2x\\
&-3abx-3aby-3a^2y-3b^2x\\
&=(a-b)(3bx-3ay)+(a^2-ab+b^2)(3x+3y)=3
\end{align*}$$
which implies that $(a-b,a^2-ab+b^2)|3$ and so $(a-b,a^2-ab+b^2)=1$ or $3$.
But all of my try to find the suitable combination for $a+b$ and $a^2-ab+b^2$ fail. Can anyone help me please?
 [/INST] \begin{align}a^{2} - a b + b^{2} &= (a + b)(a - 2 b) + 3 b^{2} \\&= (a + b) (b - 2 a) + 3 a^{2}.\end{align}
This you can see by first regarding $a^{2} - a b + b^{2}$ and $a + b$ as polynomials in $a$, and dividing $a^{2} - a b + b^{2}$ by $a + b$. And then doing the same regarding them as polynomials in $b$, or simply by symmetry.
So if $d \mid \gcd (a+b,a^2-ab+b^2)$, then $d \mid \gcd(3 a^{2}, 3 b^{2}) = 3 \gcd(a^{2}, b^{2})= 3$.
Clearly both cases occur, take first $a = b = 1$, and then $a = 1$, $b = -1$.

If $a^{2} x + b^{2} y = 1$, then
\begin{align}
3 
&= 3 a^{2} x + 3 b^{2} y 
\\&= ((\color{red}{a^{2} - a b + b^{2}}) - (\color{blue}{a + b}) (b - 2 a)) x + ((\color{red}{a^{2} - a b + b^{2}}) - (\color{blue}{a + b})(a - 2 b)) y 
\\&= (\color{red}{a^{2} - a b + b^{2}})(x + y) + (\color{blue}{a + b}) (-(b-2a)x -  (a - 2 b) y)
\end{align}
</s>