<s>[INST] Find the Bezout coefficients Find the Bezout coefficients for $a(x)$ and $b(x)$:
$a(x)=3x^4-4x^3-11x^2+4x+9, b(x)=3x^3+5x^2+x-1$
I find the greatest common divisor:
1) $\frac{(3x^4-4x^3-11x^2+4x+9)}{(3x^3+5x^2+x-1)} = x-3$. Remainder of the division: 3x^2+8x+6
2) $\frac{(3x^3+5x^2+x-1)}{(3x^2+8x+6)} = x-1$. Remainder of the division: 3x+5
3) $\frac{(x^2+8x+6)}{(3x+5)} = x+1$. Remainder of the division: $1$
The greatest common divisor: $1$
I find the Bezout coefficients with the help of the extended Euclidean algorithm:
$1\mid 0$
$0\mid 1$
$1\mid -x+3$
$-x+1\mid -x^2+4x-2$
$x^2\mid x^3-4x^2+2x$
I'm doing a check. It should work like this: $(x^2)*a(x) + (x^3-4x^2+2x)*b(x) = 1$
But here an error, the last line $(x^2\mid x^3-4x^2+2x)$ was not calculated correctly. Help me please.
 [/INST] I got
$$  \left(  3 x^{4}  - 4 x^{3}  - 11 x^{2}  + 4 x  + 9 \right)  $$ 
$$  \left(  3 x^{3}  + 5 x^{2}  +  x  - 1 \right)  $$ 
$$  \left(  3 x^{4}  - 4 x^{3}  - 11 x^{2}  + 4 x  + 9 \right)  =  \left(  3 x^{3}  + 5 x^{2}  +  x  - 1 \right)  \cdot \color{magenta}{  \left(   x  - 3 \right) } +  \left(  3 x^{2}  + 8 x  + 6 \right)  $$ 
 $$  \left(  3 x^{3}  + 5 x^{2}  +  x  - 1 \right)  =  \left(  3 x^{2}  + 8 x  + 6 \right)  \cdot \color{magenta}{  \left(   x  - 1 \right) } +  \left(  3 x  + 5 \right)  $$ 
 $$  \left(  3 x^{2}  + 8 x  + 6 \right)  =  \left(  3 x  + 5 \right)  \cdot \color{magenta}{  \left(   x  + 1 \right) } +  \left( 1  \right)  $$ 
 $$  \left(  3 x  + 5 \right)  =  \left( 1  \right)  \cdot \color{magenta}{  \left(  3 x  + 5 \right) } +  \left( 0 \right)  $$ 
 $$ \frac{ 0}{1} $$ 
 $$ \frac{ 1}{0} $$ 
 $$ \color{magenta}{  \left(   x  - 3 \right) }  \Longrightarrow  \Longrightarrow  \frac{  \left(   x  - 3 \right) }{ \left( 1  \right) } $$ 
 $$ \color{magenta}{  \left(   x  - 1 \right) }  \Longrightarrow  \Longrightarrow  \frac{  \left(   x^{2}  - 4 x  + 4 \right) }{ \left(   x  - 1 \right) } $$ 
 $$ \color{magenta}{  \left(   x  + 1 \right) }  \Longrightarrow  \Longrightarrow  \frac{  \left(   x^{3}  - 3 x^{2}  +  x  + 1 \right) }{ \left(   x^{2}  \right) } $$ 
 $$ \color{magenta}{  \left(  3 x  + 5 \right) }  \Longrightarrow  \Longrightarrow  \frac{  \left(  3 x^{4}  - 4 x^{3}  - 11 x^{2}  + 4 x  + 9 \right) }{ \left(  3 x^{3}  + 5 x^{2}  +  x  - 1 \right) } $$ 
 $$  \left(  3 x^{4}  - 4 x^{3}  - 11 x^{2}  + 4 x  + 9 \right)  \left(   x^{2}  \right)  -  \left(  3 x^{3}  + 5 x^{2}  +  x  - 1 \right)  \left(   x^{3}  - 3 x^{2}  +  x  + 1 \right)  =  \left( 1  \right)  $$
</s>