# Generator polynomial of the sum of cyclic codes

Given two cyclic codes $C_1$ and $C_2$ of length $n$ with generator polynomials $g_1(X)$ and $g_2(X)$ respectively, I have to find the generator polynomial of $C_1+C_2$, which I already know that is a cyclic code.

I've thought of $g(X)=\gcd(g_1(X),g_2(X))$ as an answer due to the fact that $C_i\subset C_1+C_2$, and therefore the answer should generate both codes. It's obvious that any element of $C_1+C_2$ is spanned by linear combinations of $X^ig(X)$, but I need to show that this does not generate anything else.

My idea is to build the basis $\{g(X), Xg(X),\dots, X^{n-r-1}g(X)\}$ where $r=\deg(g(X))$ and show that it is indeed a basis. Would it be the right way?

Every codeword in $C_1+C_2$ can be expressed as $a_1(x)g_1(x) + a_2(x)g_2(x)$. Now think of Bezout's theorem. What is the polynomial of least degree that can be expressed in this form?
Since enough time has passed since the original posting of this question that this response doesn't spoil the learning process for anyone, I will add the following result for anyone who stumbles across this looking for more information about $$C_1 + C_2$$. (Unfortunately, I don't have enough reputation points to add this as a comment.)
Let consider a let $$n$$ be a positive integer and $$p$$ a prime (WLOG) and assume $$gcd(p, n) = 1$$. The generator matrix of a cyclic code is a factor $$x^n - 1 = g(x) h(x)$$ over the splitting field $$GF(p^m)$$ where $$m = ord_n(q)$$. Let $$\alpha$$ be a primitive $$n$$-th root of this field such that the roots of $$g(x)$$ are $${\alpha^{t_1}, ..., \alpha^{t_r}}$$. The defining set of the code is the set $$T = {t_1, \dots, t_r}$$. In addition to $$g(x)$$, the code may also be generated by a polynomial $$e(x)$$ called the generator idempotent. This is determined by using the extended Euclidean algorithm to find $$a(x)$$ and $$b(x)$$ such that $$1 = a(x) g(x) + b(x) h(x)$$; then $$e(x) = a(x) g(x)$$.
Extending the posted question, given two cyclic codes $$C_1$$ and $$C_2$$, $$C_1 + C_2$$ has generator polynomial $$\gcd(g_1(x), g_2(x))$$, generator idempotent $$e_1(x) + e_2(x) - e_1(x) e_2(x)$$, and defining set $$T_1 \cap T_2$$. More information may be found in standard texts covering cyclic codes (e.g. Huffman and Pless is an understandable one with modern mathematical notation).