# 65.138 ReciprocalPolynomial

`ReciprocalPolynomial( P )`

`ReciprocalPolynomial` returns the reciprocal of polynomial P. This is a polynomial with coefficients of P in the reverse order. So if <P>=a_0 + a_1 X + ... + a_{<n>} X^{<n>}, the reciprocal polynomial is <P>'=a_{<n>} + a_{<n>-1} X + ... + a_0 X^{<n>}.

```    gap> P := Polynomial( GF(3), Z(3)^0 * [1,0,1,2] );
Z(3)^0*(2*X(GF(3))^3 + X(GF(3))^2 + 1)
gap> RecP := ReciprocalPolynomial( P );
Z(3)^0*(X(GF(3))^3 + X(GF(3)) + 2)
gap> ReciprocalPolynomial( RecP ) = P;
true ```

`ReciprocalPolynomial( P , n )`

In this form, the number of coefficients of P is considered to be at least n (possibly with zero coefficients at the highest degrees). Therefore, the reciprocal polynomial <P>' also has degree at least n.

```    gap> P := Polynomial( GF(3), Z(3)^0 * [1,0,1,2] );
Z(3)^0*(2*X(GF(3))^3 + X(GF(3))^2 + 1)
gap> ReciprocalPolynomial( P, 6 );
Z(3)^0*(X(GF(3))^6 + X(GF(3))^4 + 2*X(GF(3))^3) ```

In this form, the degree of P is considered to be at least n (if not, zero coefficients are added). Therefore, the reciprocal polynomial <P>' also has degree at least n.

GAP 3.4.4
April 1997