the inverse of a polynomial is not necessarily a polynomial. so and might not even exist in your polynomial ring!
let d(x) be their GCD, then we have:
so where and are polynomials u(x),v(x)
the problem, as you posted, doesn't make any sense and you certainly won't get help if your problem has itself a problem!