<s>[INST] Find idempotent given generator poly and check poynomial by Bezout algorithm I have the cyclic code $C$ of length $8$ and dimension $4$ over $\mathbb{F}_3$ and with check polynomial $$g(x) = (x-\alpha)(x-\alpha^2)(x-\alpha^3)(x-\alpha^6) = x^4+x^3+x+2$$ where $\alpha \in \mathbb{F}_9$ is a primitive 8-th root of unit over $\mathbb{F}_3$
By polynomial division, I find $$h(x) = x^4+2x^3+x^2+x+1$$

Goal: find the generating idempotent $e(x)$

*

*I know that it's given by the Bezout identity $1 = a(x)g(x) + b(x)h(x)$, so I start dividing $h$ by $g$ (all the division are done in $\mathbb{F}_3$):

$$h =  g + (x^3 + x^2 + 2)$$

*

*So now I divide $g$ by the term in brackets:

$$g = x(x^3+x^2+2) + (2x+2)$$

*

*Now I divide $x^3 + x^2 + 2$ by $2x+2$ and I find:

$$x^3 + x^2 + 2 = 2x^2 (2x+2) + 2$$

Now I want to obtain the Bezoùt identity, so  I should start from the bottom by writing
$$2 = (x^3 + x^2 + 2) +x^2(2x+2) \quad \star$$
but from the second equation: $2x+2= g +2x(x^3+x^2+2)$
and now I substitute in $\star$:
$$2 = (x^3+x^2+2) + x^2 (g +2x(x^3+x^2+2) )$$
Now, from the first equation: $x^3+x^2+2 = h-g = h+2g$, therefore:
$$2 = h+2g+x^2(g+2x(h+2g))$$
which equals (multiply by 2 both sides):
$$1 = h(2+x^3) + g(1+2x^2+2x^3)$$

Therefore the idempotent $e(x)$ should be: $$e(x) =g(1+2x^2+2x^3)= 2x^7+x^6+2x^5+x^3+x^2+x+2$$ but if I square it I don't $e(x)$ again.
What is wrong?
 [/INST] The idempotent was calculated correctly. There was a mistake in the verification phase in that the wrong quotient ring was accidentally used.
</s>