求域上多项式的逆元

问题描述

设域F=Zp[x]f(x)\mathbb{F}=\mathbb{Z}_p[x]_{f(x)},其中f(x)f(x)Zp\mathbb{Z}_p上的不可约多项式,多项式g(x)Fg(x)\in\mathbb{F},求g(x)g(x)F\mathbb{F}上的逆元。

求逆过程

先做辗转相除法:令r0=f(x),r1=g(x)r_0=f(x),r_1=g(x)
r0=r1q1+r2 1r1=r2q2+r3 2rn2=rn1qn1+rn n1rn1=rnqn+rn+1 ,rn+1=0 n \begin{aligned} r_0&=r_1q_1+r_2\ \dots\dots1\\ r_1&=r_2q_2+r_3\ \dots\dots2\\ &\dots\\ r_{n-2}&=r_{n-1}q_{n-1}+r_n\ \dots\dots n-1\\ r_{n-1}&=r_nq_n+r_{n+1}\ ,其中r_{n+1}=0\ \dots\dots n \end{aligned}

方法1:

因为s(x)f(x)+t(x)g(x)=(f(x),g(x))s(x)f(x)+t(x)g(x)=(f(x), g(x)),当(f(x),g(x))=1(f(x),g(x))=1时有:
(t(x)g(x))f(x)=(1s(x)f(x))f(x)=1(t(x)g(x))_{f(x)}=(1-s(x)f(x))_{f(x)}=1所以t(x)t(x)即为g(x)g(x)在域F\mathbb{F}上的逆元。

求域上多项式的逆元

其中bi=bi2bi1qnib_i=b_{i-2}-b_{i-1}*q_{n-i}t(x)=bn1t(x)=b_{n-1}

方法2:

b1=qn1b_1=q_{n-1},计算:

求域上多项式的逆元

其中bi=bi2+bi1qnib_i=b_{i-2}+b_{i-1}*q_{n-i}
  当nn为奇数时,t(x)=bn1t(x)=b_{n-1}
  当nn为偶数时,t(x)=bn1t(x)=-b_{n-1}