math/algebraic-coding-theory-notes.tex
algebraic-coding-theory-notes.texRaw
1\documentclass{article}
2\usepackage[utf8]{inputenc}
3\usepackage{amsfonts}
4% \usepackage{yfonts} % WIP
5\usepackage{amsthm}
6\usepackage{amsmath}
7\usepackage{mathrsfs}
8\usepackage{enumerate}
9\usepackage{hyperref}
10\usepackage{amssymb}
11\usepackage{tikz} % diagram
12
13\begin{filecontents}[overwrite]{algebraic-coding-theory-notes.bib}
14@misc{hill,
15 author = {Raymond Hill},
16 title = {{A First Course in Coding Theory}},
17 year = {1986}
18}
19@misc{lint,
20 author = {J.H. van Lint},
21 title = {{Introduction to Coding Theory}},
22 year = {1981}
23}
24\end{filecontents}
25\nocite{*}
26
27
28\theoremstyle{definition}
29
30\newtheorem{innerdefn}{Definition}
31\newenvironment{defn}[1]
32{\renewcommand\theinnerdefn{#1}\innerdefn}
33{\endinnerdefn}
34
35\newtheorem{innerthm}{Theorem}
36\newenvironment{thm}[1]
37{\renewcommand\theinnerthm{#1}\innerthm}
38{\endinnerthm}
39
40\newtheorem{innerlemma}{Lemma}
41\newenvironment{lemma}[1]
42{\renewcommand\theinnerlemma{#1}\innerlemma}
43{\endinnerlemma}
44
45\newtheorem{innerprop}{Proposition}
46\newenvironment{prop}[1]
47{\renewcommand\theinnerprop{#1}\innerprop}
48{\endinnerprop}
49
50\newtheorem{innercor}{Corollary}
51\newenvironment{cor}[1]
52{\renewcommand\theinnercor{#1}\innercor}
53{\endinnercor}
54
55\newtheorem{innereg}{Example}
56\newenvironment{eg}[1]
57{\renewcommand\theinnereg{#1}\innereg}
58{\endinnereg}
59
60\newtheorem{innerex}{Exercise}
61\newenvironment{ex}[1]
62{\renewcommand\theinnerex{#1}\innerex}
63{\endinnerex}
64
65% custom shortcuts
66\newcommand{\Vnq}{V(n, q)}
67
68\title{Algebraic Coding Theory}
69\author{arnaucube}
70\date{2026}
71
72\begin{document}
73
74\maketitle
75
76\begin{abstract}
77 Notes taken while studying Algebraic Coding Theory, mostly from Hill book \cite{hill} and Lint book \cite{lint}.
78
79 Usually while reading books and papers I take handwritten notes in a notebook, this document contains some of them re-written to $LaTeX$.
80
81 The proofs may slightly differ from the ones from the books, since I try to extend them for a deeper understanding.
82\end{abstract}
83
84\tableofcontents
85
86
87\section{Vector spaces over finite fields, quick recap}
88Let $q$ be a prime power.
89
90$\Vnq$: set $GF(q)^n$ of all ordered $n$-tuples over $GF(q)$. $\Vnq$ is a
91vector space.
92
93A set of vectors $\{v_1, v_2, \ldots, v_r \}$ is said to be \emph{linear dependent} if $\exists$ scalars $a_1, \ldots, a_r$, not all zero, such that
94$$a_1 v_1 + a_2 v_2 + \ldots + a_r v_r = 0$$
95
96They are \emph{linear independent} if
97$$a_1 v_1 + a_2 v_2 + \ldots + a_r v_r = 0 ~\stackrel{implies}{\Longrightarrow}~ a_1=a_2=\ldots=a_r=0$$
98
99Let $C$ a subspace of $\Vnq$. Then a subset $\{v_1, v_2, \ldots, v_r \} \subseteq C$ is called a \emph{generating set} (or \emph{spanning set}) of $C$ if every vector in $C$ can be expressed as a linear combination of $v_1, \ldots, v_r$.
100
101A generating set of $C$ which is also linearly independent is called a \emph{basis} of $C$.
102
103\begin{thm}{4.3}
104 Suppose $\{v_1, v_2, \ldots, v_k\}$ is a basis of a subspace $C$ of $\Vnq$. Then
105 \begin{enumerate}[i.]
106 \item every vector of $C$ can be expressed uniquely as a linear combination of the basis vectors.
107 \item $C$ contains exactly $q^k$ vectors.
108 \end{enumerate}
109\end{thm}
110\begin{proof}
111 \begin{enumerate}[i.]
112\item suppose vector $x \in C$ such that
113$$x = a_1 v_1 + a_2 v_2 + \cdots + a_k v_k$$
114$$x = b_1 v_1 + b_2 v_2 + \cdots + b_k v_k .$$
115
116then
117$$(a_1-b_1)v_1 + (a_2-b_2)v_2 + \cdots + (a_k-b_k)v_k = 0 .$$
118
119But the set $\{v_1, v_2, \ldots, v_k\}$ is linearly independent, and so
120$$a_i - b_i = 0 \quad \text{for } i = 1,2,\ldots,k,$$
121i.e.,
122$$a_i = b_i \quad \text{for } i = 1,2,\ldots,k.$$
123
124\item By (i), the $q^k$ vectors
125$$\sum_{i=1}^{k} a_i v_i \qquad (a_i \in \mathrm{GF}(q))$$
126are precisely the distinct vectors of $C$.
127\end{enumerate}
128\end{proof}
129
130
131\section{Linear codes}
132The theorems of this section are from \cite{hill} and follow the original enumeration of the book.
133
134Note about notation:\\
135A $q$-ary linear code $[n, k, d]$-code is also a $q$-ary $(n, q^k, d)$-code, but the opposite is not always true.
136
137\subsection{Some definitions}
138Let $q$ be a prime power. View $(F_q)^n$ as the vector space $\Vnq$.
139
140\begin{defn}{}[Linear code over GF(q)]
141 A \emph{linear code over $GF(q)$} is a subspace of $\Vnq$, with $n \geq 0$.
142\end{defn}
143
144Thus $C \subseteq \Vnq$ is a linear code iff
145\begin{enumerate}[i.]
146 \item $u+v \in C ~~ \forall u,v \in C$
147 \item $au \in C ~~ \forall u \in C,~ a \in GF(q)$
148\end{enumerate}
149
150If $C$ is a $k$-dimensional subspace of $\Vnq$, then the linear code $C$ is called an $[n, k]$-code. (sometimes with minimum distance $d$: $[n, k, d]$-code).
151
152\begin{defn}{}[Weight]
153 Weight, $w(x)$, of a vector $x \in \Vnq$ is the number of non-zero entries of $x$.
154\end{defn}
155
156\begin{lemma}{5.1}\label {h.5.1}
157 if $x,y \in \Vnq$, then $d(x,y)=w(x-y)$.
158\end{lemma}
159\begin{proof}
160 the vector $x-y$ has non-zero entries in preceisely those places where $x$ and $y$ differ.
161\end{proof}
162
163\begin{thm}{5.2}
164 let $C$ a linear code, let $w(C)$ be the smallest of weights of the non-zero codewords of $C$. Then $d(C)=w(C)$.
165\end{thm}
166\begin{proof}
167 $\exists~ x,y \in C$ s.th. $d(C)=d(x,y)$.
168
169 By Lemma \ref{h.5.1}, $d(C)=w(x-y) \geq w(C)$, since $x-y$ is a codeword of the linear code $C$ (ie. $x-y \in C$).
170
171 On the other hand, for $x \in C$,\\
172 $w(C)=w(x)=d(x,0) \geq d(C)$, since $0 \in C$.
173
174 Hence, $d(C) \geq w(C)$ and $w(C) \geq d(C) ~~\Longrightarrow~ d(C)=w(C)$.
175\end{proof}
176
177
178\begin{defn}{}[Generator matrix (GM)]
179 a $k \times n$ matrix whose rows form a basis of a linear $[n,k]$-code is called a \emph{generator matrix} (GM) of the code.
180\end{defn}
181
182\subsection{Equivalence}
183
184\begin{thm}{5.4}
185 two known $k \times n$ matrices generate equivalent linear $[n,k]$-codes over $GF(q)$ if one matrix can be obtained from the other by a sequence of operations of the following types:
186 \begin{enumerate}
187 \item[R1.] permutation of the rows
188 \item[R2.] multiplication of a row by a non-zero scalar
189 \item[R3.] addition of a scalar multiple of one row to another
190 \item[C1.] permutation of the columns
191 \item[C2.] multiplication of any column by a non-zero scalar
192 \end{enumerate}
193\end{thm}
194
195\begin{thm}{5.5} \label{h.5.5}
196 let $G$ a GM of an $[n, k]$-code. Then by performing the previous operations, $G$ can be transformed to the standard form $[ I_k | A ]$
197 where $I_k$ is the $k \times k$ identity matrix, and $A$ is a $k \times (n-k)$ matrix.
198\end{thm}
199
200\subsection{Encoding with a linear code}
201Let $C$ a $[n,k]$-code over $GF(q)$ with GM $G$. $C$ contains $q^k$ codewords $\Longrightarrow$ can be used to communicate any one of $q^k$ distinct messages.
202
203Iddentify these messages with the $q^k$ tuples of $V(k,q)$.
204
205Encoding:\\
206msg vector: $u=u_1 u_2 \ldots u_k$; rows of $G$: $r_1 r_2 \ldots r_k$. Encode
207$$uG = \sum^k_{i=1} u_i r_i \in C$$
208ie. $uG$ is a codeword of $C$; a linear combination of the rows of the GM.
209
210Encoding function:
211\begin{align*}
212 V(k,q) &\longrightarrow C \subseteq \Vnq\\
213 u &\longmapsto uG
214\end{align*}
215
216If $G$ is in standard form (\ref{h.5.5}), $G= [I_k | A]$ with $A=[a_{ij}]$, then encoding $u$ is:
217$$x=uG = x_1x_2 \ldots x_k x_{k+1} \ldots x_n$$
218where
219\begin{align*}
220 &x_i=u_i ~~\text{for}~ 1 \leq i \leq k, ~\text{message digits}\\
221 &x_{k+i}=\sum^k_{j=1}~ a_ji u_j ~~\text{for}~ 1 \leq i \leq n-k, ~\text{check digits}\\
222\end{align*}
223
224the check digits add redundancy to gie protection against noise.
225
226\subsection{Decoding with a linear code}
227Codeword $x=x_1 x_2 \ldots x_n$, received vector $y=y_1 y_2 \ldots y_n$, error vector $e = y-x=e_1 e_1 \ldots e_n$.
228
229\subsubsection{Cosets}
230Cosets here are similar to the ones from typical group theory, just from another perspective.
231
232\begin{defn}{}[Coset]
233 Let $C$ a $[n,k]$-code over $GF(q)$ and $a \in \Vnq$.
234 Then the set $a + C = \{a+x | x\in C\}$ is called a \emph{coset} of $C$.
235\end{defn}
236
237\begin{defn}{}[Coset leader]
238 the vector having minimum weight in a coset is called the \emph{coset leader}.
239\end{defn}
240
241\begin{lemma}{6.3} \label{h.6.3}
242 Let $a+C$ a coset of $C$ and $b \in a+C$. Then $b+C=a+C$.
243\end{lemma}
244\begin{proof}
245 since $b \in a+C ~~\Longrightarrow~~ b=a+x$ for some $x \in C$.
246 If $b+y \in b+C$ then
247 $$b+y=(a+x)+y = a+(x+y) \in a+C$$
248
249 For the other direction, if $a+x \in a+C$ then
250 $$a+x=(b-x)+z = b+(z-x) \in b+C$$
251 hence $a+C \subseteq b+C$.
252
253 Therefore $b+C = a+C$.
254\end{proof}
255
256\begin{thm}{6.4}[Lagrange] \label{h.6.4}
257 suppose $C \subseteq \Vnq$ is a $[n,k]$-code over $GF(q)$. Then
258 \begin{enumerate}[i.]
259 \item evvery vector of $\Vnq$ is in some coset of $C$
260 \item every coset contains exactly $q^k$ vectors
261 \item two cosets either are disjoint or coincide (partial overlap is impossible)
262 \end{enumerate}
263\end{thm}
264\begin{proof}
265 \begin{enumerate}[i.]
266 \item if $a\in \Vnq$ then $a=a+0 \in a+C$
267 \item the map
268 \begin{align*}
269 C &\longrightarrow a+C ~\forall~ x \in C\\
270 x &\longmapsto a+x
271 \end{align*}
272 is a one-to-one map, hence $|a+C| = |C| = q^k$.
273 \item by contradiction, suppose cosets $a+C,~ b+C$ overlap. Then for some vector $v$,
274 $$v \in (a+C) \cap (b+C)$$
275 thus for some $x,y \in C$, $v=a+x=b+y$.
276
277 Hence $b=a+(x-y) \in a+C$, thus by Lemma \ref{h.6.3} we have $b+C=a+C$.
278 \end{enumerate}
279\end{proof}
280
281\begin{cor}{}
282 \ref{h.6.4} shows that $\Vnq$ is partitioned into disjoint cosets of $C$:
283 $$\Vnq = (0+C) \cup (a_1+C) \cup \ldots \cup (a_s +C)$$
284 where $s=q^{n-k} -1$, and by Lemma \ref{h.6.3} we may take $0, a_1, \ldots, a_s$ to be coset leaders.
285\end{cor}
286
287\begin{eg}{6.5} \label{h.6.5}
288 Let $C$ be the binary $[4,2]$-code with generator matrix
289$$
290G = \begin{pmatrix}
2911 & 0 & 1 & 1 \\
2920 & 1 & 0 & 1
293\end{pmatrix}
294$$
295
296ie.
297$C = \{0000,\, 1011,\, 0101,\, 1110\}$.
298
299Then the cosets of $C$ are
300\begin{align*}
301 0000 + C &= C \text{ itself}\\
302 1000 + C &= \{1000,\, 0011,\, 1101,\, 0110\}\\
303 0100 + C &= \{0100,\, 1111,\, 0001,\, 1010\} = 0001+C\\
304 0010 + C &= \{0010,\, 1001,\, 0111,\, 1100\}
305\end{align*}
306
307by Lemma \ref{h.6.3}: $0001 \in 0100 + C$, thus $0001+C=0100+C$.
308\end{eg}
309
310\subsection{Probability of error correction (in binary linear codes)}
311To evaluate how good a code is, must calculate the \emph{probability} that a received vector will be decoded as the codeword which was sent.
312
313Let $p$ be the symbol error probability.
314
315Probability that the error vector is agiven vector of weight $i$ is $p^i (1-p){n-i}$.
316
317\begin{thm}{6.7}
318 Let $C$ a binary $[n,k]$-code, and for $i=0,1,\ldots,n$ let $\alpha_i$ denote the number of coset leaders of weight $i$.
319
320 Then the probability $P_{corr}(C)$ that a received vector decoded by means of a standard array is the codeword which was sent is
321 $$P_{corr}(C) = \sum_{i=0}^n \alpha_i \cdot p^i(1-p)^{n-i}$$
322\end{thm}
323
324\begin{eg}{6.8}
325 $[n,k]$-code from \ref{h.6.5}, coset leaders are $0000, 1000, 0100, 0010$. Hence $\alpha_0=1,~ \alpha_1=3,~ \alpha_2=\alpha_3=\alpha_4=0$, so
326 $$P_{corr}(C) = (1-p)^4 + 3 p(1-p)^3 = (1-p)^3 (1+2p)$$
327\end{eg}
328
329\begin{lemma}{6.9}[Remark 6.9]
330 if $d(C)=2t+1$ or $d(C)=2t+2$, then $C$ can correct any $t$ errors.
331
332 Hence every vector of weight $\leq t$ is a coset leader and so $\alpha_i=\left( \stackrel{n}{i} \right)$ for $0 \leq i \leq t$.
333\end{lemma}
334
335\begin{defn}{}[Rate]
336 $[n, k]$-code $C$ uses $n$ symbols to send $k$ message symbols; it has \emph{rate} $R(C)=k/n$.
337
338 A good code will have a high rate.
339\end{defn}
340
341\begin{defn}{}[Capacity]
342 the \emph{capacity} $\mathscr{C}(p)$ of a binary symmetric channel with symbol error probability $p$ is
343 $$\mathscr{C}(p) = 1+ p \cdot \log_2{(p)} + (1-p) \cdot \log_2{(1-p)}$$
344\end{defn}
345
346
347\begin{thm}{6.12}[Shanon's theorem]
348 channel binary symmetric with symbol error probability $p$.
349
350 Let $R < \mathscr{C}(p)$.
351
352 Then for any $\epsilon >0$, $\exists$ for sufficient large $n$, an $[n,k]$-code $C$ of rate $k/n \geq R$ such that $P_{err}(C) < \epsilon$.
353\end{thm}
354
355\begin{defn}{}[$P_{symb}$]
356 $P_{symb}$ denotes the average probability that a message symbol is in error after decoding.
357\end{defn}
358
359\begin{thm}{6.14}
360 let $C$ a binary [n,k]-code and let $A_i$ denote the number of codewords of $C$ of weight $i$.
361
362 Then, if $C$ is used for error detection, the probability of an incorrect message being undetected is
363 $$P_{undetec}(C) = \sum_{i=1}^n A_i \cdot p^i (1-p)^{n-i}$$
364\end{thm}
365
366\begin{eg}{6.15}
367 for the code of \ref{h.6.5},
368 $$P_{undetec}(C) = \underbrace{1 \cdot p^2 (1-p)^2}_{0101} + \underbrace{2 \cdot p^3(1-p)^{4-3=1} }_{1011,~1110}= p^2 -p^4$$
369\end{eg}
370
371\bibliographystyle{unsrt}
372\bibliography{algebraic-coding-theory-notes.bib}
373
374\end{document}