non linear codes hello everybody im taking a course in nonlinear codes next semester and in order to be prepared as best as i can im trying to solve an home exercise given to us to be done by the semesters opening. Im writing here the questions i didn't succeed, these exercises are about constant weight codes, linear cyclic codes and a bit of combinatorics
1.Let $\Phi={(C_1,C_2,...)}$ be a set of linear codes over a finite field  $F_q$, all of length $n$ and dimension $k$. assume every non zero vector $v \in F_q^n $ is contained in the same number of codes from $\Phi$. Prove that if $$\sum_{i=1}^{d-1} {{n \choose i}(q-1)^i} < \frac{q^n-1}{q^k-1}$$
then $\Phi$ contains a code with minimum distance at least $d$.


*$n$ and $q$ are positive integers such that $\gcd(n,q)=1 $. Fix a polonymial $g(x)$, wich we shall use as a generator polynomial to constuct a cyclic code over $F_q$ of length $n$. Prove that we can pick $n$ such that the resulting cyclic code has a minimum distance at most 2, regardless of the choice of $g(x)$.

for the second question i tried to use the fact that $g(x)$ have only simple roots in their splitting field but im not sure how to connect it to a upper bound for the code
ill appreciate any help, clues or guidance
thanks
 A: Writing up a slightly more complete (but still not complete) sketch of an answer I mentioned in the comments.
A key question you should ask yourself (and a hint towards this kind of solution) is

Why am I given a collection $\Phi = (C_1,\dots, C_\ell)$ of codes, rather than a single one?

Generally, this is because you are expected to use some "probabilistic argument", meaning prove some statement of the form
$$\Pr_{C_i \gets \Phi}[C_i\text{ has minimum distance }\geq d] > 0$$
If the probability is strictly positive, at least one $C_i$ must have the property, even if you don't know which.
It's also worth mentioning the precise distribution on $\Phi$ you choose doesn't matter provided you can get the above argument to work, but when $\Phi$ is finite the uniform distribution is of course the "most obvious" choice.
Now, a key perspective in (a similar argument to this in the world of Euclidean lattices) is noticing that

A code $C_i$ has minimum distance $\geq d$ iff $\forall v\in B_0(d-1)\setminus\{0\}$, $v\not\in C_i$.

Returning to the probability we want to lower-bound, we have that
\begin{align*}
\Pr_{C_i \gets \Phi}[C_i\text{ has minimum distance }\geq d] &= \Pr_{C_i \gets \Phi}[\forall v\in B_0(d-1)\setminus\{0\}, v\not\in C_i]\\
&= 1 - \Pr_{C_i \gets \Phi}[\exists v\in B_0(d-1)\setminus\{0\}, v\in C_i]\\
&\geq 1 - \mathsf{vol}(B_0(d-1)\setminus\{0\})\max_{v\in B_0(d-1)\setminus\{0\}}\Pr_{C_i \gets \Phi}[ v\in C_i].
\end{align*}
Here, in the first equality, we simply apply the above characterization of minimum distance.
In the second inequality, we take complements, and in the third inequality, we apply the "union bound"
$$\Pr[\exists x\in A : T(x)] \leq \sum_{x\in A}\Pr[T(x)] \leq |A|\max_{x\in A}\Pr[T(x)]$$
where $T(x)$ is an arbitrary predicate.
Technically the first inequality is the union bound, but I use the second as well so I describe it anyway.
Anyway, we are trying to lower bound our probability by $>0$ strictly.
It therefore suffices to show that
$$\frac{1}{\mathsf{vol}(B_0(d-1)\setminus\{0\})} > \max_{v\in B_0(d-1)\setminus\{0\}}\Pr_{C_i \gets \Phi}[ v\in C_i].$$
Establishing this bound on $\Pr_{C_i \gets \Phi}[ v\in C_i]$ is what I meant by bounding the probability that $v\in C_i$.
From the inequality you are given, it suffices to show that
$$\max_{v\in B_0(d-1)\setminus\{0\}}\Pr_{C_i \gets \Phi}[ v\in C_i] \leq \frac{q^k-1}{q^n-1} = \frac{|\mathbb{F}_q^k\setminus\{0\}|}{|\mathbb{F}_q^n\setminus\{0\}|}.$$
In particular, you have to show that the codes you have are "uniformly random" in a certain sense --- the probability they contain any non-zero point is precisely the cardinality of their non-zero points (as they are rank $k$), divided by the total number of $n$-dimensional non-zero points.
It would be quite easy to give you a collection of codes $\Phi$ for which this is false for.
Therefore, you need to show that the condition

assume every non zero vector $v\in\mathbb{F}_q^n$ is contained in the same number of codes from $\Phi$.

implies the above "uniformly random" bound on the probability $\Pr_{C_i}[v\in C_i]$.
I haven't thought about doing this, but hopefully this gives you a foothold for the problem (as well as exposes you to the above "standard" argument to show that a code/lattice of a certain minimum distance exists).
