Excuse me for the confusing title. I was asked to find $gcd(x^2+3x+2,x^2+x)$
What i did is i factorized both polynomials $x^2+x=(x+1)x$
$x^2+3x+2=(x+1)(x+2)$
So i expected the gcd to be $x+1$
But using the euclidean algorithm i found out the gcd to be $2x+2$. Why is factorizing wrong? Is it because $K[X]$ is not factorial ? Would the euclidean algorithm also work if the polynomials are in $\Bbb Z[X]$ ???
There is no unique gcd of two polynomials $f,g\in \Bbb{Q}[X]$. It is only unique up to a unit in $\Bbb{Q}$. So any of the polynomials $c(X+1)$ with $c\neq 0$ is a gcd of $X^2+3X+2$ and $X^2+X$.
References: Uniqueness of greatest common divisor
gcd(a,b) is unique up to units in a unique factorization domain
Greatest common divisor of two polynomials in $\Bbb Q[X]$