<s>[INST] If $a$ and $b$ are integers such that $9$ divides $a^2 + ab + b^2$ then $3$ divides both $a$ and $b$. If $a$ and $b$ are integers such that $9$ divides $a^2 + ab + b^2$ then show that $3$
divides both $a$ and $b$.

can anyone tell me please how to solve these types of problem oe which formula is required
 [/INST] Whenever you have an "$x$ divides $y$" problem, start by stating it in modular form.
$$
a^2+ab+b^2 \equiv 0 \mod 9
$$
Now, we can also write this as
$$
a^2-2ab+b^2 \equiv -3ab \mod 9
$$
Therefore, we must have that $(a-b)^2\equiv 0 \pmod3$, and this can only be satisfied if $a\equiv b\pmod 3$.
So let $b=a+3k$ and substitute back into the original equation:
$$
a^2+a^2+3ak+a^2+6ak+9k^2\equiv 0 \mod 9
$$
Which can be simplified to
$$
3a^2 + 9ak + 9k^2 \equiv 0 \mod 9\\
3a^2 \equiv 0 \mod 9\\
a^2 \equiv 0 \mod 3
$$
And this is only satisfied if $a\equiv 0\pmod3$. And because $a\equiv b\pmod3$, we also have that $b\equiv 0\pmod3$. So 3 divides $a$ and 3 divides $b$.
</s>