# 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 !!!

• It seems you did well. Commented May 17, 2021 at 15:03
• Okay thanks for your comment it helps me a lot Commented May 17, 2021 at 15:03
• You don't need Bezout, Euclid is enough.
– user65203
Commented May 17, 2021 at 15:17
• But @YvesDaoust bezout work ? Commented May 17, 2021 at 15:19
• $(n+2)(n^2+n-2) -(n^3+3n^2-5)=1$ is what the extended Euclidean algorithm gives in $\mathbb Q[n]$ as a polynomial ring: WA
– lhf
Commented May 17, 2021 at 20:18

$$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$$

• Thank you for your explanations this helped me a lot despite having taken time to understand. Commented May 18, 2021 at 14:43