Problem #6:
By definition
\begin{align*}
d = \min_{(x,y) \in C^2 , x \not= y} d (x,y)
\end{align*}
where ##d(x,y)## be the Hamming distance of ##x## and ##y##. A bound is proved by bounding the quantity
\begin{align*}
\sum_{(x,y) \in C^2 , x \not= y} d (x,y)
\end{align*}
in two different ways. On the one hand, there are ##\# C## choices for ##x## and for each such choice, there are ## \# C - 1## choices for ##y##. Since by definition ##d (x,y) \geq d## for all ##x## and ##y## (##x \not= y##), it follows that
\begin{align*}
\sum_{(x,y) \in C^2 , x \not= y} d (x,y) \geq \# C (\# C - 1) d .
\end{align*}
The other inequality is obtained by writing down all the ##\# C## codewords of ##C## into a ##\# C \times n##-matrix. Let ##n_{i , \alpha}## denote the number of times the element ##\alpha## of the alphabet (with ##q## elements) occurs in the ##i##th column. For each choice of ##\alpha## in the ##i##th column there are ##\# C - n_{i , \alpha}## elements not equal to ##\alpha## in the same column. Then
\begin{align*}
\sum_{(x,y) \in C^2 , x \not= y} d (x,y) & = \sum_{i = 1}^n \sum_{\alpha} n_{i , \alpha} (\# C - n_{i , \alpha})
\nonumber \\
& = \sum_{i = 1}^n \left( (\# C)^2 - \sum_\alpha n_{i , \alpha}^2 \right) \qquad ( \sum_{\alpha} n_{i , \alpha} = \# C)
\nonumber \\
& \leq \sum_{i = 1}^n \left( (\# C)^2 - \frac{(\# C)^2}{q} \right) \qquad ( (\# C)^2 = (\sum_{\alpha} n_{i , \alpha} \cdot 1)^2 \leq (\sum_{\alpha} n_{i , \alpha}^2) (\sum_{\alpha} 1^2) )
\nonumber \\
&= n \cdot (\# C)^2 \cdot \left( 1 - \frac{1}{q} \right) .
\end{align*}
Combining the two bounds gives
\begin{align*}
\# C (\# C - 1) d \leq (\# C)^2 \cdot n \cdot \left( \frac{q - 1}{q} \right)
\end{align*}
or
\begin{align*}
d (\# C - 1) \leq \# C \cdot n \cdot \left( \frac{q - 1}{q} \right) \qquad (*)
\end{align*}
If ##d < n \cdot \dfrac{q - 1}{q}## the bound ##(*)## can be rearranged as
\begin{align*}
\# C \leq \frac{d}{d - n \cdot \dfrac{q - 1}{q}} .
\end{align*}