GCD of polynomials in Zn[x]

May 2010
Hi guys, need a little help.

I have been using euclidean algorithm and anything in Q[x] and R[x] is fine. However, whenever i attempt to divide in say Z5[x] I hit problems.

1. Should i evaluate each term in Z5[x] as I go along? Or should i find the quotient, then convert it into Z5[x].

2. Sometimes i get non-integer coefficients when operating in Z[5], this has got to be a problem.

Would anyone be able to provide working to the following example?

Eg: Find the GCD of p(x)= x^3 + 2x + 2 and g(x)= X^4 + 3x^3 + 4x + 2 in Z5[x].

ps. i saw the math input option but i wasnt sure on how to use it, better to be safe then sorry