<s>[INST] solve gcd $n^3+3n^2-5$ and $n+2$ with bezout Hello I have to solve  $\gcd (n^3+3n^2-5 , n+2)$ with bezout
Here’s how I did it:
bezout says $a$ and $b$ are co prime if and only if $au+bv = 1$.
Then I did :
$(n+2)(n^2+n-2) -(n^3+3n^2-5)$
I found one so their $\gcd$ is equal to $1$.
Did I get the right method ?
Sorry for my bad english !!!
 [/INST] $$A(n^3+3n^2-5) + B(n+2) = 1$$
This isn't a blueprint for a general method of finding a solution. I am going to take advantage of the fact that the second polynomial is $n+2$, a first degree polynomial.
Let $m = n+2$. Then
$$n^3+3n^2-5 = (m-2)^3+3(m-2)^2-5 = m^3 - 3m^2 -1$$
So we need to solve
$$A(m^3 - 3m^2 -1) + B(m) = 1$$
If we let $A=-1$, we get
\begin{align}
   A(m^3 - 3m^2 -1) + B(m) &= 1 \\
   -1(m^3 - 3m^2 -1) + B(m) &= 1 \\
   Bm &= m^3 -3m^2 \\
   B &= m^2 - 3m \\
   B &= (n+2)^2-3(n+2) \\
   B &= n^2 + n - 2
\end{align}
It is easy to check that
$$A(n^2 + n - 2) + B(n+2) = (-1)(n^3+3n^2-5) + (n^2 + n - 2)(n+2) = 1 $$
</s>