\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsfonts} % \usepackage{yfonts} % WIP \usepackage{amsthm} \usepackage{amsmath} \usepackage{mathrsfs} \usepackage{enumerate} \usepackage{hyperref} \usepackage{amssymb} \usepackage{tikz} % diagram \begin{filecontents}[overwrite]{algebraic-coding-theory-notes.bib} @misc{hill, author = {Raymond Hill}, title = {{A First Course in Coding Theory}}, year = {1986} } @misc{lint, author = {J.H. van Lint}, title = {{Introduction to Coding Theory}}, year = {1981} } \end{filecontents} \nocite{*} \theoremstyle{definition} \newtheorem{innerdefn}{Definition} \newenvironment{defn}[1] {\renewcommand\theinnerdefn{#1}\innerdefn} {\endinnerdefn} \newtheorem{innerthm}{Theorem} \newenvironment{thm}[1] {\renewcommand\theinnerthm{#1}\innerthm} {\endinnerthm} \newtheorem{innerlemma}{Lemma} \newenvironment{lemma}[1] {\renewcommand\theinnerlemma{#1}\innerlemma} {\endinnerlemma} \newtheorem{innerprop}{Proposition} \newenvironment{prop}[1] {\renewcommand\theinnerprop{#1}\innerprop} {\endinnerprop} \newtheorem{innercor}{Corollary} \newenvironment{cor}[1] {\renewcommand\theinnercor{#1}\innercor} {\endinnercor} \newtheorem{innereg}{Example} \newenvironment{eg}[1] {\renewcommand\theinnereg{#1}\innereg} {\endinnereg} \newtheorem{innerex}{Exercise} \newenvironment{ex}[1] {\renewcommand\theinnerex{#1}\innerex} {\endinnerex} % custom shortcuts \newcommand{\Vnq}{V(n, q)} \title{Algebraic Coding Theory} \author{arnaucube} \date{2026} \begin{document} \maketitle \begin{abstract} Notes taken while studying Algebraic Coding Theory, mostly from Hill book \cite{hill} and Lint book \cite{lint}. Usually while reading books and papers I take handwritten notes in a notebook, this document contains some of them re-written to $LaTeX$. The proofs may slightly differ from the ones from the books, since I try to extend them for a deeper understanding. \end{abstract} \tableofcontents \section{Vector spaces over finite fields, quick recap} Let $q$ be a prime power. $\Vnq$: set $GF(q)^n$ of all ordered $n$-tuples over $GF(q)$. $\Vnq$ is a vector space. A 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 $$a_1 v_1 + a_2 v_2 + \ldots + a_r v_r = 0$$ They are \emph{linear independent} if $$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$$ Let $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$. A generating set of $C$ which is also linearly independent is called a \emph{basis} of $C$. \begin{thm}{4.3} Suppose $\{v_1, v_2, \ldots, v_k\}$ is a basis of a subspace $C$ of $\Vnq$. Then \begin{enumerate}[i.] \item every vector of $C$ can be expressed uniquely as a linear combination of the basis vectors. \item $C$ contains exactly $q^k$ vectors. \end{enumerate} \end{thm} \begin{proof} \begin{enumerate}[i.] \item suppose vector $x \in C$ such that $$x = a_1 v_1 + a_2 v_2 + \cdots + a_k v_k$$ $$x = b_1 v_1 + b_2 v_2 + \cdots + b_k v_k .$$ then $$(a_1-b_1)v_1 + (a_2-b_2)v_2 + \cdots + (a_k-b_k)v_k = 0 .$$ But the set $\{v_1, v_2, \ldots, v_k\}$ is linearly independent, and so $$a_i - b_i = 0 \quad \text{for } i = 1,2,\ldots,k,$$ i.e., $$a_i = b_i \quad \text{for } i = 1,2,\ldots,k.$$ \item By (i), the $q^k$ vectors $$\sum_{i=1}^{k} a_i v_i \qquad (a_i \in \mathrm{GF}(q))$$ are precisely the distinct vectors of $C$. \end{enumerate} \end{proof} \section{Linear codes} The theorems of this section are from \cite{hill} and follow the original enumeration of the book. Note about notation:\\ A $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. \subsection{Some definitions} Let $q$ be a prime power. View $(F_q)^n$ as the vector space $\Vnq$. \begin{defn}{}[Linear code over GF(q)] A \emph{linear code over $GF(q)$} is a subspace of $\Vnq$, with $n \geq 0$. \end{defn} Thus $C \subseteq \Vnq$ is a linear code iff \begin{enumerate}[i.] \item $u+v \in C ~~ \forall u,v \in C$ \item $au \in C ~~ \forall u \in C,~ a \in GF(q)$ \end{enumerate} If $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). \begin{defn}{}[Weight] Weight, $w(x)$, of a vector $x \in \Vnq$ is the number of non-zero entries of $x$. \end{defn} \begin{lemma}{5.1}\label {h.5.1} if $x,y \in \Vnq$, then $d(x,y)=w(x-y)$. \end{lemma} \begin{proof} the vector $x-y$ has non-zero entries in preceisely those places where $x$ and $y$ differ. \end{proof} \begin{thm}{5.2} 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)$. \end{thm} \begin{proof} $\exists~ x,y \in C$ s.th. $d(C)=d(x,y)$. 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$). On the other hand, for $x \in C$,\\ $w(C)=w(x)=d(x,0) \geq d(C)$, since $0 \in C$. Hence, $d(C) \geq w(C)$ and $w(C) \geq d(C) ~~\Longrightarrow~ d(C)=w(C)$. \end{proof} \begin{defn}{}[Generator matrix (GM)] 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. \end{defn} \subsection{Equivalence} \begin{thm}{5.4} 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: \begin{enumerate} \item[R1.] permutation of the rows \item[R2.] multiplication of a row by a non-zero scalar \item[R3.] addition of a scalar multiple of one row to another \item[C1.] permutation of the columns \item[C2.] multiplication of any column by a non-zero scalar \end{enumerate} \end{thm} \begin{thm}{5.5} \label{h.5.5} 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 ]$ where $I_k$ is the $k \times k$ identity matrix, and $A$ is a $k \times (n-k)$ matrix. \end{thm} \subsection{Encoding with a linear code} Let $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. Iddentify these messages with the $q^k$ tuples of $V(k,q)$. Encoding:\\ msg vector: $u=u_1 u_2 \ldots u_k$; rows of $G$: $r_1 r_2 \ldots r_k$. Encode $$uG = \sum^k_{i=1} u_i r_i \in C$$ ie. $uG$ is a codeword of $C$; a linear combination of the rows of the GM. Encoding function: \begin{align*} V(k,q) &\longrightarrow C \subseteq \Vnq\\ u &\longmapsto uG \end{align*} If $G$ is in standard form (\ref{h.5.5}), $G= [I_k | A]$ with $A=[a_{ij}]$, then encoding $u$ is: $$x=uG = x_1x_2 \ldots x_k x_{k+1} \ldots x_n$$ where \begin{align*} &x_i=u_i ~~\text{for}~ 1 \leq i \leq k, ~\text{message digits}\\ &x_{k+i}=\sum^k_{j=1}~ a_ji u_j ~~\text{for}~ 1 \leq i \leq n-k, ~\text{check digits}\\ \end{align*} the check digits add redundancy to gie protection against noise. \subsection{Decoding with a linear code} Codeword $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$. \subsubsection{Cosets} Cosets here are similar to the ones from typical group theory, just from another perspective. \begin{defn}{}[Coset] Let $C$ a $[n,k]$-code over $GF(q)$ and $a \in \Vnq$. Then the set $a + C = \{a+x | x\in C\}$ is called a \emph{coset} of $C$. \end{defn} \begin{defn}{}[Coset leader] the vector having minimum weight in a coset is called the \emph{coset leader}. \end{defn} \begin{lemma}{6.3} \label{h.6.3} Let $a+C$ a coset of $C$ and $b \in a+C$. Then $b+C=a+C$. \end{lemma} \begin{proof} since $b \in a+C ~~\Longrightarrow~~ b=a+x$ for some $x \in C$. If $b+y \in b+C$ then $$b+y=(a+x)+y = a+(x+y) \in a+C$$ For the other direction, if $a+x \in a+C$ then $$a+x=(b-x)+z = b+(z-x) \in b+C$$ hence $a+C \subseteq b+C$. Therefore $b+C = a+C$. \end{proof} \begin{thm}{6.4}[Lagrange] \label{h.6.4} suppose $C \subseteq \Vnq$ is a $[n,k]$-code over $GF(q)$. Then \begin{enumerate}[i.] \item evvery vector of $\Vnq$ is in some coset of $C$ \item every coset contains exactly $q^k$ vectors \item two cosets either are disjoint or coincide (partial overlap is impossible) \end{enumerate} \end{thm} \begin{proof} \begin{enumerate}[i.] \item if $a\in \Vnq$ then $a=a+0 \in a+C$ \item the map \begin{align*} C &\longrightarrow a+C ~\forall~ x \in C\\ x &\longmapsto a+x \end{align*} is a one-to-one map, hence $|a+C| = |C| = q^k$. \item by contradiction, suppose cosets $a+C,~ b+C$ overlap. Then for some vector $v$, $$v \in (a+C) \cap (b+C)$$ thus for some $x,y \in C$, $v=a+x=b+y$. Hence $b=a+(x-y) \in a+C$, thus by Lemma \ref{h.6.3} we have $b+C=a+C$. \end{enumerate} \end{proof} \begin{cor}{} \ref{h.6.4} shows that $\Vnq$ is partitioned into disjoint cosets of $C$: $$\Vnq = (0+C) \cup (a_1+C) \cup \ldots \cup (a_s +C)$$ 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. \end{cor} \begin{eg}{6.5} \label{h.6.5} Let $C$ be the binary $[4,2]$-code with generator matrix $$ G = \begin{pmatrix} 1 & 0 & 1 & 1 \\ 0 & 1 & 0 & 1 \end{pmatrix} $$ ie. $C = \{0000,\, 1011,\, 0101,\, 1110\}$. Then the cosets of $C$ are \begin{align*} 0000 + C &= C \text{ itself}\\ 1000 + C &= \{1000,\, 0011,\, 1101,\, 0110\}\\ 0100 + C &= \{0100,\, 1111,\, 0001,\, 1010\} = 0001+C\\ 0010 + C &= \{0010,\, 1001,\, 0111,\, 1100\} \end{align*} by Lemma \ref{h.6.3}: $0001 \in 0100 + C$, thus $0001+C=0100+C$. \end{eg} \subsection{Probability of error correction (in binary linear codes)} To evaluate how good a code is, must calculate the \emph{probability} that a received vector will be decoded as the codeword which was sent. Let $p$ be the symbol error probability. Probability that the error vector is agiven vector of weight $i$ is $p^i (1-p){n-i}$. \begin{thm}{6.7} 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$. Then the probability $P_{corr}(C)$ that a received vector decoded by means of a standard array is the codeword which was sent is $$P_{corr}(C) = \sum_{i=0}^n \alpha_i \cdot p^i(1-p)^{n-i}$$ \end{thm} \begin{eg}{6.8} $[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 $$P_{corr}(C) = (1-p)^4 + 3 p(1-p)^3 = (1-p)^3 (1+2p)$$ \end{eg} \begin{lemma}{6.9}[Remark 6.9]\label{remark.6.9} if $d(C)=2t+1$ or $d(C)=2t+2$, then $C$ can correct any $t$ errors. 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$. \end{lemma} \begin{defn}{}[Rate] $[n, k]$-code $C$ uses $n$ symbols to send $k$ message symbols; it has \emph{rate} $R(C)=k/n$. A good code will have a high rate. \end{defn} \begin{defn}{}[Capacity] the \emph{capacity} $\mathscr{C}(p)$ of a binary symmetric channel with symbol error probability $p$ is $$\mathscr{C}(p) = 1+ p \cdot \log_2{(p)} + (1-p) \cdot \log_2{(1-p)}$$ \end{defn} \begin{thm}{6.12}[Shanon's theorem] channel binary symmetric with symbol error probability $p$. Let $R < \mathscr{C}(p)$. 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$. \end{thm} \begin{defn}{}[$P_{symb}$] $P_{symb}$ denotes the average probability that a message symbol is in error after decoding. \end{defn} \begin{thm}{6.14} let $C$ a binary [n,k]-code and let $A_i$ denote the number of codewords of $C$ of weight $i$. Then, if $C$ is used for error detection, the probability of an incorrect message being undetected is $$P_{undetec}(C) = \sum_{i=1}^n A_i \cdot p^i (1-p)^{n-i}$$ \end{thm} \begin{eg}{6.15} for the code of \ref{h.6.5}, $$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$$ \end{eg} \vspace{0.5cm} \subsection{Exercises} \begin{ex}{5.1} is the binary (11, 24, 5)-code linear? \end{ex} \begin{proof} recall: a q-ary linear $[n,k,d]$-code is also a q-ary $(n, q^k, d)$-code, but the opposite is not always true. $\Longrightarrow~ (11, 24, 5)$-code to be linear it would mean that $24=q^k$. Since it is binary, $q=2$. But $24 \neq 2^k$, so it can not be linear. \end{proof} \begin{ex}{5.2} $E_n$ is the code of all even-weight vectors of $V(n,2)$, which is linear. What are the parameters $[n, k, d]$ of $E_n$? Write a GM for $E_n$ in standard form. \end{ex} \begin{proof} $$E_n = \{ x \in V(n, 2) | w(x) ~\text{is even} \}$$ $\longrightarrow$ is the binary even-weight ode (the single parity-check code);\\ it's linear since \begin{itemize} \item the zero vector has even weight \item over $GF(2)$, the sum of two even-weight vectors has even weight \end{itemize} Recall: $F_q^n \Longleftrightarrow \Vnq$, so $V(n, 2) \cong F_2^n$ $$\Longrightarrow~ E_n = \{ (x_1, \ldots, x_n) \in F_2^n | x_1 + \ldots + x_n = 0 \}$$ minimum distance is $2$, since \begin{itemize} \item no word of weight 1 is in $E_n$ \item words of weight 2 are in $E_n$ \end{itemize} Therefore, parameters are $[n, n-1, 2]$ GM: $$G=\left[ I_{n-1} | 1 \right]$$ which generates vectors of the form $$(a_1, \ldots, a_{n-1}, a_1+\ldots+a_{n-1})$$ \end{proof} \begin{ex}{5.5} Prove that in a \emph{binary linear code}, either all the codewords have even weight or exactly half have even weight and half odd weight. \end{ex} \begin{proof} let $C_e,~ C_o$ be subsets of $C$ with even and odd weights respectively. So that $C = C_e \cup C_o$ (disjoint union). For binary vectors $x,y$: $$w(x+y) = w(x) + w(y) \pmod 2$$ ie. over $F_2$, the parity of the weight is additive: \begin{align*} even + even &= even\\ even + odd &= odd\\ odd + odd &= even \end{align*} Now we have two possible cases: \begin{itemize} \item $C$ has no odd weighted codewords:\\ $C_0 = \emptyset,~ \forall x \in C$ $x$ is even weighted \item $C$ has at least one odd-weighted codeword:\\ let $u \in C_o$, consider the map \begin{align*} \phi: C_e &\longrightarrow C_o\\ c &\longmapsto c+u \end{align*} with $c \in C_e,~ u \in C_o,~ \phi(c) \in C_o$. $\phi$ is bijective, since $\phi(\phi(c))=(c+u)+u=c$, so $\phi$ is it's own inverse; hence $|C_e| = |C_o|$. Since $C=C_e \cup C_e$, half codewords are even weighted and half odd. \end{itemize} \end{proof} \begin{ex}{6.1} construct standard arrays for codes having each of the GMs: $$G_1 = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} ~~~ G_2 = \begin{pmatrix} 1 & 0 & 1\\ 0 & 1 & 1 \end{pmatrix} $$ \end{ex} \begin{proof} recall: for a binary code with GM $G$, the code $C$ consists of all binary linear combinations of the rows of $G$. For $G_1$:\\ rows: $r_1=(1,0),~r_2=(0,1))$. A codeword is any linear combination: $$u G_1= a \cdot r_1 + b \cdot r_2,~~ \text{with}~ a,b \in \{0,1\}$$ 4 combinations:\\ \begin{align*} 0 \cdot r_1 + 0 \cdot r_2 &= (0,0)\\ 1 \cdot r_1 + 0 \cdot r_2 &= (1,0)\\ 0 \cdot r_1 + 1 \cdot r_2 &= (0,1)\\ 1 \cdot r_1 + 1 \cdot r_2 &= (1,0)+(0,1) = (1,1) \end{align*} $$\Longrightarrow~ C_1 = \{00, 10, 01, 11\}$$ $$\text{standard array:}~ 00~01~10~11$$ \vspace{0.5cm} For $G_2$:\\ rows: $r_1=(1, 0, 1),~ r_2=(0, 1, 1)$. Codeword: $a \cdot r_1 + b \cdot r_2$ with $a, b \in \{0,1\}$. 4 combinations:\\ \begin{align*} 0 \cdot r_1 + 0 \cdot r_2 &= (0,0,0)\\ 1 \cdot r_1 + 0 \cdot r_2 &= (1,0,1)\\ 0 \cdot r_1 + 1 \cdot r_2 &= (0,1,1)\\ 1 \cdot r_1 + 1 \cdot r_2 &= (1,0,1)+(0,1,1) = (1,1,0) \end{align*} $$\Longrightarrow~ C_2 = \{000, 101, 011, 110\}$$ $\Longrightarrow~$ so the 1st row of the standard array is: $000~101~011~110$. Now, pick a non used vector: $001$, add it to the code $C_2$: \begin{align*} 001 + C_2_i&\\ 001 + 000 &= 001\\ 001 + 101 &= 100\\ 001 + 011 &= 010\\ 001 + 110 &= 111 \end{align*} $\Longrightarrow$ 2nd row of the standard array: $001~100~010~111$ Thus the standard array is \begin{align*} 000~101~011~110\\ 001~100~010~111 \end{align*} ie. $2^3=8$ vectors, a $V(3,2)$ vector space. \end{proof} \begin{ex}{6.4} $C$ a binary $[n,k]$-code with minimum distance $2t+1$ (or $2t+2$). Given that $p$ is very small, show that an approximate value of $P_{err}(C)$ is $\left( \binom{n}{t+1} - \alpha_{t+1} \right) p^{t+1}$, where $\alpha_{t+1}$ is the number of coset leaders of $C$ of weight $t+1$. \end{ex} \begin{proof} From \ref{remark.6.9}, if $d(C)=2t+1$ (or $2t+2$) $Longrightarrow~ C$ can correct any $t$ errors. Hence every vector of weight $\leq t$ is a coset leader and so $\alpha_i = \binom{n}{i}$ for $0 \leq i \leq t$. \begin{equation} P_{corr}(C) = \sum_{i=0}^n \alpha_i \cdot p^i(1-p)^{n-i} \label{6.4.eq.1} \end{equation} where $\alpha_i$ is the number of coset leaders of weight $i$ From the $\binom{n}{i}$ vectors of weight $i$, exactly $\alpha_i$ are coset leaders, so the non coset leaders are $\binom{n}{i} - \alpha_i$. This is when a decoding error happens. $$\Longrightarrow~ P_{err}(C) = \sum_{i=0}^n \left( \binom{n}{i} - \alpha_i \right) p^i (1-p)^{n-i}$$ \vspace{0.5cm} Alternatively from \ref{6.4.eq.1}:\\ $$P_{err}(C) = 1 - P_{corr}(C) = 1 - \sum_{i=0}^n \alpha_i \cdot p^i(1-p)^{n-i}$$ Notice that $$\sum_{i=0}^n \binom{n}{i} p^i (1-p)^{n-i} = (p + (1-p))^n = 1^n = 1$$ thus \begin{align*} P_{err}(C) &= \sum_{i=0}^n \binom{n}{i} p^i (1-p)^{n-i} - \sum_{i=0}^n \alpha_i \cdot p^i(1-p)^{n-i}\\ &= \sum_{i=0}^n \left( \binom{n}{i} - \alpha_i \right) p^i (1-p)^{n-i} \end{align*} Now, from \ref{remark.6.9}, $\forall i \leq t,~ \alpha_i = \binom{n}{i}$, thus $\binom{n}{i} - \alpha_i = 0$ for the first $t$ terms in the sum. Thus \begin{align*} P_{err}(C) &= \sum_{i=0}^n \left( \binom{n}{i} - \alpha_i \right) p^i (1-p)^{n-i}\\ &= \left( \binom{n}{t+1} - \alpha_{t+1} \right) p^{t+1} (1-p)^{n-t+1} + \ldots \end{align*} where the $\ldots$ represent the terms with $p^{t+2}$ and higher. Then, since $p$ is very small (by the exercise definition), $(1-p)^{n-t+1} \equiv 1$, and the other higher powers of $p$ are negligible. Hence, $$P_{err}(C) = \left( \binom{n}{t+1} - \alpha_{t+1} \right) \cdot p^{t+1}$$ \end{proof} \bibliographystyle{unsrt} \bibliography{algebraic-coding-theory-notes.bib} \end{document}