# Bezout Coefficient for polynomials in sage?

I want to find the bezout coefficient for those 2 polynomials :

$f = 1+x-x^2-x^4+x^5$ and $g = -1+x^2+x^3-x^6$ when I use the gcd function in sage the output is :

sage: gcd(f,g)
sage: 1


but when I use xgcd(f,g) it gives me the following :

($-27$, $9*x^5 - 18*x^2 - 9*x - 9$, $9*x^4 - 9*x^3 - 18*x + 18$)

I want xgcd to give me 1 instead of -27 so the polynomials will be the bezout coefficients

P.S: I can't divide the polynomials by -27 because i'm working in ZZ

• I suppose the gcd is computed over the rationals. – 111 May 27 '15 at 19:50
• I suspect that you will find groups.google.com/forum/#!topic/sage-devel/JV8fCPUqTzo/overview quite relevant here. – kcrisman May 27 '15 at 21:08
• – kcrisman May 27 '15 at 21:10
• Thank you so much, 111 you were right I should work with rational polynomials – Hashirama May 27 '15 at 23:32