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\newtheorem{innerrem}{Remark}
66\newenvironment{remark}[1]
67{\renewcommand\theinnerrem{#1}\innerrem}
68{\endinnerrem}
69
70\newtheorem{innerintu}{Intuition}
71\newenvironment{intuition}[1]
72{\renewcommand\theinnerintu{#1}\innerintu}
73{\endinnerintu}
74
75% custom shortcuts
76\newcommand{\Vnq}{V(n, q)}
77
78\title{Algebraic Coding Theory}
79\author{arnaucube}
80\date{2026}
81
82\begin{document}
83
84\maketitle
85
86\begin{abstract}
87 Notes taken while studying Algebraic Coding Theory, mostly from Hill book \cite{hill} and Lint book \cite{lint}.
88
89 Usually while reading books and papers I take handwritten notes in a notebook, this document contains some of them re-written to $LaTeX$.
90
91 The proofs may slightly differ from the ones from the books, since I try to extend them for a deeper understanding.
92\end{abstract}
93
94\tableofcontents
95
96
97\section{Vector spaces over finite fields, quick recap}
98Let $q$ be a prime power.
99
100$\Vnq$: set $GF(q)^n$ of all ordered $n$-tuples over $GF(q)$. $\Vnq$ is a
101vector space.
102
103A 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
104$$a_1 v_1 + a_2 v_2 + \ldots + a_r v_r = 0$$
105
106They are \emph{linear independent} if
107$$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$$
108
109Let $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$.
110
111A generating set of $C$ which is also linearly independent is called a \emph{basis} of $C$.
112
113\begin{thm}{4.3}
114 Suppose $\{v_1, v_2, \ldots, v_k\}$ is a basis of a subspace $C$ of $\Vnq$. Then
115 \begin{enumerate}[i.]
116 \item every vector of $C$ can be expressed uniquely as a linear combination of the basis vectors.
117 \item $C$ contains exactly $q^k$ vectors.
118 \end{enumerate}
119\end{thm}
120\begin{proof}
121 \begin{enumerate}[i.]
122\item suppose vector $x \in C$ such that
123$$x = a_1 v_1 + a_2 v_2 + \cdots + a_k v_k$$
124$$x = b_1 v_1 + b_2 v_2 + \cdots + b_k v_k .$$
125
126then
127$$(a_1-b_1)v_1 + (a_2-b_2)v_2 + \cdots + (a_k-b_k)v_k = 0 .$$
128
129But the set $\{v_1, v_2, \ldots, v_k\}$ is linearly independent, and so
130$$a_i - b_i = 0 \quad \text{for } i = 1,2,\ldots,k,$$
131i.e.,
132$$a_i = b_i \quad \text{for } i = 1,2,\ldots,k.$$
133
134\item By (i), the $q^k$ vectors
135$$\sum_{i=1}^{k} a_i v_i \qquad (a_i \in \mathrm{GF}(q))$$
136are precisely the distinct vectors of $C$.
137\end{enumerate}
138\end{proof}
139
140
141\section{Linear codes}
142The theorems of this section are from \cite{hill} and follow the original enumeration of the book.
143
144Note about notation:\\
145A $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.
146
147\subsection{Some definitions}
148Let $q$ be a prime power. View $(F_q)^n$ as the vector space $\Vnq$.
149
150\begin{defn}{}[Linear code over GF(q)]
151 A \emph{linear code over $GF(q)$} is a subspace of $\Vnq$, with $n \geq 0$.
152\end{defn}
153
154Thus $C \subseteq \Vnq$ is a linear code iff
155\begin{enumerate}[i.]
156 \item $u+v \in C ~~ \forall u,v \in C$
157 \item $au \in C ~~ \forall u \in C,~ a \in GF(q)$
158\end{enumerate}
159
160If $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).
161
162\begin{defn}{}[Weight]
163 Weight, $w(x)$, of a vector $x \in \Vnq$ is the number of non-zero entries of $x$.
164\end{defn}
165
166\begin{lemma}{5.1}\label {h.5.1}
167 if $x,y \in \Vnq$, then $d(x,y)=w(x-y)$.
168\end{lemma}
169\begin{proof}
170 the vector $x-y$ has non-zero entries in preceisely those places where $x$ and $y$ differ.
171\end{proof}
172
173\begin{thm}{5.2}
174 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)$.
175\end{thm}
176\begin{proof}
177 $\exists~ x,y \in C$ s.th. $d(C)=d(x,y)$.
178
179 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$).
180
181 On the other hand, for $x \in C$,\\
182 $w(C)=w(x)=d(x,0) \geq d(C)$, since $0 \in C$.
183
184 Hence, $d(C) \geq w(C)$ and $w(C) \geq d(C) ~~\Longrightarrow~ d(C)=w(C)$.
185\end{proof}
186
187
188\begin{defn}{}[Generator matrix (GM)]
189 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.
190\end{defn}
191
192\subsection{Equivalence}
193
194\begin{thm}{5.4}
195 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:
196 \begin{enumerate}
197 \item[R1.] permutation of the rows
198 \item[R2.] multiplication of a row by a non-zero scalar
199 \item[R3.] addition of a scalar multiple of one row to another
200 \item[C1.] permutation of the columns
201 \item[C2.] multiplication of any column by a non-zero scalar
202 \end{enumerate}
203\end{thm}
204
205\begin{thm}{5.5} \label{h.5.5}
206 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 ]$
207 where $I_k$ is the $k \times k$ identity matrix, and $A$ is a $k \times (n-k)$ matrix.
208\end{thm}
209
210\subsection{Encoding with a linear code}
211Let $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.
212
213Iddentify these messages with the $q^k$ tuples of $V(k,q)$.
214
215Encoding:\\
216msg vector: $u=u_1 u_2 \ldots u_k$; rows of $G$: $r_1 r_2 \ldots r_k$. Encode
217$$uG = \sum^k_{i=1} u_i r_i \in C$$
218ie. $uG$ is a codeword of $C$; a linear combination of the rows of the GM.
219
220Encoding function:
221\begin{align*}
222 V(k,q) &\longrightarrow C \subseteq \Vnq\\
223 u &\longmapsto uG
224\end{align*}
225
226If $G$ is in standard form (\ref{h.5.5}), $G= [I_k | A]$ with $A=[a_{ij}]$, then encoding $u$ is:
227$$x=uG = x_1x_2 \ldots x_k x_{k+1} \ldots x_n$$
228where
229\begin{align*}
230 &x_i=u_i ~~\text{for}~ 1 \leq i \leq k, ~\text{message digits}\\
231 &x_{k+i}=\sum^k_{j=1}~ a_ji u_j ~~\text{for}~ 1 \leq i \leq n-k, ~\text{check digits}\\
232\end{align*}
233
234the check digits add redundancy to gie protection against noise.
235
236\subsection{Decoding with a linear code}
237Codeword $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$.
238
239\subsubsection{Cosets}
240Cosets here are similar to the ones from typical group theory, just from another perspective.
241
242\begin{defn}{}[Coset]
243 Let $C$ a $[n,k]$-code over $GF(q)$ and $a \in \Vnq$.
244 Then the set $a + C = \{a+x | x\in C\}$ is called a \emph{coset} of $C$.
245\end{defn}
246
247\begin{defn}{}[Coset leader]
248 the vector having minimum weight in a coset is called the \emph{coset leader}.
249\end{defn}
250
251\begin{lemma}{6.3} \label{h.6.3}
252 Let $a+C$ a coset of $C$ and $b \in a+C$. Then $b+C=a+C$.
253\end{lemma}
254\begin{proof}
255 since $b \in a+C ~~\Longrightarrow~~ b=a+x$ for some $x \in C$.
256 If $b+y \in b+C$ then
257 $$b+y=(a+x)+y = a+(x+y) \in a+C$$
258
259 For the other direction, if $a+x \in a+C$ then
260 $$a+x=(b-x)+z = b+(z-x) \in b+C$$
261 hence $a+C \subseteq b+C$.
262
263 Therefore $b+C = a+C$.
264\end{proof}
265
266\begin{thm}{6.4}[Lagrange] \label{h.6.4}
267 suppose $C \subseteq \Vnq$ is a $[n,k]$-code over $GF(q)$. Then
268 \begin{enumerate}[i.]
269 \item evvery vector of $\Vnq$ is in some coset of $C$
270 \item every coset contains exactly $q^k$ vectors
271 \item two cosets either are disjoint or coincide (partial overlap is impossible)
272 \end{enumerate}
273\end{thm}
274\begin{proof}
275 \begin{enumerate}[i.]
276 \item if $a\in \Vnq$ then $a=a+0 \in a+C$
277 \item the map
278 \begin{align*}
279 C &\longrightarrow a+C ~\forall~ x \in C\\
280 x &\longmapsto a+x
281 \end{align*}
282 is a one-to-one map, hence $|a+C| = |C| = q^k$.
283 \item by contradiction, suppose cosets $a+C,~ b+C$ overlap. Then for some vector $v$,
284 $$v \in (a+C) \cap (b+C)$$
285 thus for some $x,y \in C$, $v=a+x=b+y$.
286
287 Hence $b=a+(x-y) \in a+C$, thus by Lemma \ref{h.6.3} we have $b+C=a+C$.
288 \end{enumerate}
289\end{proof}
290
291\begin{cor}{}
292 \ref{h.6.4} shows that $\Vnq$ is partitioned into disjoint cosets of $C$:
293 $$\Vnq = (0+C) \cup (a_1+C) \cup \ldots \cup (a_s +C)$$
294 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.
295\end{cor}
296
297\begin{eg}{6.5} \label{h.6.5}
298 Let $C$ be the binary $[4,2]$-code with generator matrix
299$$
300G = \begin{pmatrix}
3011 & 0 & 1 & 1 \\
3020 & 1 & 0 & 1
303\end{pmatrix}
304$$
305
306ie.
307$C = \{0000,\, 1011,\, 0101,\, 1110\}$.
308
309Then the cosets of $C$ are
310\begin{align*}
311 0000 + C &= C \text{ itself}\\
312 1000 + C &= \{1000,\, 0011,\, 1101,\, 0110\}\\
313 0100 + C &= \{0100,\, 1111,\, 0001,\, 1010\} = 0001+C\\
314 0010 + C &= \{0010,\, 1001,\, 0111,\, 1100\}
315\end{align*}
316
317by Lemma \ref{h.6.3}: $0001 \in 0100 + C$, thus $0001+C=0100+C$.
318\end{eg}
319
320\subsection{Probability of error correction (in binary linear codes)}
321To evaluate how good a code is, must calculate the \emph{probability} that a received vector will be decoded as the codeword which was sent.
322
323Let $p$ be the symbol error probability.
324
325Probability that the error vector is agiven vector of weight $i$ is $p^i (1-p){n-i}$.
326
327\begin{thm}{6.7}
328 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$.
329
330 Then the probability $P_{corr}(C)$ that a received vector decoded by means of a standard array is the codeword which was sent is
331 $$P_{corr}(C) = \sum_{i=0}^n \alpha_i \cdot p^i(1-p)^{n-i}$$
332\end{thm}
333
334\begin{eg}{6.8}
335 $[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
336 $$P_{corr}(C) = (1-p)^4 + 3 p(1-p)^3 = (1-p)^3 (1+2p)$$
337\end{eg}
338
339\begin{remark}{6.9}\label{remark.6.9}
340 if $d(C)=2t+1$ or $d(C)=2t+2$, then $C$ can correct any $t$ errors.
341
342 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$.
343\end{remark}
344
345\begin{defn}{}[Rate]
346 $[n, k]$-code $C$ uses $n$ symbols to send $k$ message symbols; it has \emph{rate} $R(C)=k/n$.
347
348 A good code will have a high rate.
349\end{defn}
350
351\begin{defn}{}[Capacity]
352 the \emph{capacity} $\mathscr{C}(p)$ of a binary symmetric channel with symbol error probability $p$ is
353 $$\mathscr{C}(p) = 1+ p \cdot \log_2{(p)} + (1-p) \cdot \log_2{(1-p)}$$
354\end{defn}
355
356
357\begin{thm}{6.12}[Shanon's theorem]
358 channel binary symmetric with symbol error probability $p$.
359
360 Let $R < \mathscr{C}(p)$.
361
362 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$.
363\end{thm}
364
365\begin{defn}{}[$P_{symb}$]
366 $P_{symb}$ denotes the average probability that a message symbol is in error after decoding.
367\end{defn}
368
369\begin{thm}{6.14}
370 let $C$ a binary [n,k]-code and let $A_i$ denote the number of codewords of $C$ of weight $i$.
371
372 Then, if $C$ is used for error detection, the probability of an incorrect message being undetected is
373 $$P_{undetec}(C) = \sum_{i=1}^n A_i \cdot p^i (1-p)^{n-i}$$
374\end{thm}
375
376\begin{eg}{6.15}
377 for the code of \ref{h.6.5},
378 $$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$$
379\end{eg}
380
381
382
383\vspace{0.5cm}
384
385\subsection{Exercises}
386\begin{ex}{5.1}
387 is the binary (11, 24, 5)-code linear?
388\end{ex}
389\begin{proof}
390 recall: a q-ary linear $[n,k,d]$-code is also a q-ary $(n, q^k, d)$-code, but
391 the opposite is not always true.
392
393 $\Longrightarrow~ (11, 24, 5)$-code to be linear it would mean that $24=q^k$.
394
395 Since it is binary, $q=2$. But $24 \neq 2^k$, so it can not be linear.
396\end{proof}
397
398\begin{ex}{5.2}
399 $E_n$ is the code of all even-weight vectors of $V(n,2)$, which is linear.
400 What are the parameters $[n, k, d]$ of $E_n$? Write a GM for $E_n$ in standard
401 form.
402\end{ex}
403\begin{proof}
404 $$E_n = \{ x \in V(n, 2) | w(x) ~\text{is even} \}$$
405
406 $\longrightarrow$ is the binary even-weight ode (the single parity-check code);\\
407 it's linear since
408 \begin{itemize}
409 \item the zero vector has even weight
410 \item over $GF(2)$, the sum of two even-weight vectors has even weight
411 \end{itemize}
412
413 Recall: $F_q^n \Longleftrightarrow \Vnq$, so $V(n, 2) \cong F_2^n$
414
415 $$\Longrightarrow~ E_n = \{ (x_1, \ldots, x_n) \in F_2^n | x_1 + \ldots + x_n = 0 \}$$
416
417 minimum distance is $2$, since
418 \begin{itemize}
419 \item no word of weight 1 is in $E_n$
420 \item words of weight 2 are in $E_n$
421 \end{itemize}
422
423 Therefore, parameters are $[n, n-1, 2]$
424
425 GM:
426 $$G=\left[ I_{n-1} | 1 \right]$$
427
428 which generates vectors of the form
429 $$(a_1, \ldots, a_{n-1}, a_1+\ldots+a_{n-1})$$
430\end{proof}
431
432\begin{ex}{5.5}
433 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.
434\end{ex}
435\begin{proof}
436 let $C_e,~ C_o$ be subsets of $C$ with even and odd weights respectively.
437
438 So that $C = C_e \cup C_o$ (disjoint union).
439
440 For binary vectors $x,y$:
441 $$w(x+y) = w(x) + w(y) \pmod 2$$
442
443 ie. over $F_2$, the parity of the weight is additive:
444 \begin{align*}
445 even + even &= even\\
446 even + odd &= odd\\
447 odd + odd &= even
448 \end{align*}
449
450 Now we have two possible cases:
451 \begin{itemize}
452 \item $C$ has no odd weighted codewords:\\
453 $C_0 = \emptyset,~ \forall x \in C$ $x$ is even weighted
454 \item $C$ has at least one odd-weighted codeword:\\
455 let $u \in C_o$, consider the map
456 \begin{align*}
457 \phi: C_e &\longrightarrow C_o\\
458 c &\longmapsto c+u
459 \end{align*}
460 with $c \in C_e,~ u \in C_o,~ \phi(c) \in C_o$.
461
462 $\phi$ is bijective, since $\phi(\phi(c))=(c+u)+u=c$,
463
464 so $\phi$ is it's own inverse; hence $|C_e| = |C_o|$.
465
466 Since $C=C_e \cup C_e$, half codewords are even weighted and half odd.
467 \end{itemize}
468\end{proof}
469
470\begin{ex}{6.1}
471 construct standard arrays for codes having each of the GMs:
472
473 $$G_1 = \begin{pmatrix}
474 1 & 0 \\
475 0 & 1
476 \end{pmatrix} ~~~
477 G_2 = \begin{pmatrix}
478 1 & 0 & 1\\
479 0 & 1 & 1
480 \end{pmatrix}
481 $$
482\end{ex}
483\begin{proof}
484 recall: for a binary code with GM $G$, the code $C$ consists of all binary linear combinations of the rows of $G$.
485
486 For $G_1$:\\
487 rows: $r_1=(1,0),~r_2=(0,1))$. A codeword is any linear combination:
488 $$u G_1= a \cdot r_1 + b \cdot r_2,~~ \text{with}~ a,b \in \{0,1\}$$
489
490 4 combinations:\\
491 \begin{align*}
492 0 \cdot r_1 + 0 \cdot r_2 &= (0,0)\\
493 1 \cdot r_1 + 0 \cdot r_2 &= (1,0)\\
494 0 \cdot r_1 + 1 \cdot r_2 &= (0,1)\\
495 1 \cdot r_1 + 1 \cdot r_2 &= (1,0)+(0,1) = (1,1)
496 \end{align*}
497 $$\Longrightarrow~ C_1 = \{00, 10, 01, 11\}$$
498 $$\text{standard array:}~ 00~01~10~11$$
499
500
501 \vspace{0.5cm}
502 For $G_2$:\\
503 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\}$.
504
505 4 combinations:\\
506 \begin{align*}
507 0 \cdot r_1 + 0 \cdot r_2 &= (0,0,0)\\
508 1 \cdot r_1 + 0 \cdot r_2 &= (1,0,1)\\
509 0 \cdot r_1 + 1 \cdot r_2 &= (0,1,1)\\
510 1 \cdot r_1 + 1 \cdot r_2 &= (1,0,1)+(0,1,1) = (1,1,0)
511 \end{align*}
512
513 $$\Longrightarrow~ C_2 = \{000, 101, 011, 110\}$$
514 $\Longrightarrow~$ so the 1st row of the standard array is: $000~101~011~110$.
515
516 Now, pick a non used vector: $001$, add it to the code $C_2$:
517 \begin{align*}
518 001 + C_2_i&\\
519 001 + 000 &= 001\\
520 001 + 101 &= 100\\
521 001 + 011 &= 010\\
522 001 + 110 &= 111
523 \end{align*}
524 $\Longrightarrow$ 2nd row of the standard array: $001~100~010~111$
525
526 Thus the standard array is
527 \begin{align*}
528 000~101~011~110\\
529 001~100~010~111
530 \end{align*}
531 ie. $2^3=8$ vectors, a $V(3,2)$ vector space.
532\end{proof}
533
534\begin{ex}{6.4}
535 $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$.
536\end{ex}
537\begin{proof}
538 From \ref{remark.6.9}, if $d(C)=2t+1$ (or $2t+2$) $Longrightarrow~ C$ can correct any $t$ errors.
539
540 Hence every vector of weight $\leq t$ is a coset leader and so $\alpha_i = \binom{n}{i}$ for $0 \leq i \leq t$.
541
542 \begin{equation}
543 P_{corr}(C) = \sum_{i=0}^n \alpha_i \cdot p^i(1-p)^{n-i}
544 \label{6.4.eq.1}
545 \end{equation}
546
547 where $\alpha_i$ is the number of coset leaders of weight $i$
548
549 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.
550
551 $$\Longrightarrow~ P_{err}(C) = \sum_{i=0}^n \left( \binom{n}{i} - \alpha_i \right) p^i (1-p)^{n-i}$$
552
553
554 \vspace{0.5cm}
555 Alternatively from \ref{6.4.eq.1}:\\
556 $$P_{err}(C) = 1 - P_{corr}(C) = 1 - \sum_{i=0}^n \alpha_i \cdot p^i(1-p)^{n-i}$$
557
558 Notice that
559 $$\sum_{i=0}^n \binom{n}{i} p^i (1-p)^{n-i} = (p + (1-p))^n = 1^n = 1$$
560
561 thus
562 \begin{align*}
563 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}\\
564 &= \sum_{i=0}^n \left( \binom{n}{i} - \alpha_i \right) p^i (1-p)^{n-i}
565 \end{align*}
566
567 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.
568
569 Thus
570 \begin{align*}
571 P_{err}(C) &= \sum_{i=0}^n \left( \binom{n}{i} - \alpha_i \right) p^i (1-p)^{n-i}\\
572 &= \left( \binom{n}{t+1} - \alpha_{t+1} \right) p^{t+1} (1-p)^{n-t+1} + \ldots
573 \end{align*}
574 where the $\ldots$ represent the terms with $p^{t+2}$ and higher.
575
576 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.
577
578 Hence,
579 $$P_{err}(C) = \left( \binom{n}{t+1} - \alpha_{t+1} \right) \cdot p^{t+1}$$
580\end{proof}
581
582
583\vspace{1.0cm}
584
585\section{Dual code, PCM and Syndrome}
586
587\subsection{Dual code}
588
589\begin{defn}{}[Orthogonal]
590 Inner product:
591 $$u \cdot v = u_1 v_1 + \ldots + u_n \cdot v_n = \sum_{i=1}^n u_i v_i$$
592 If $u \cdot v = 0$, then $u$ and $v$ are called \emph{orthogonal}.
593\end{defn}
594
595\begin{lemma}{7.1} \label{7.1}
596 for any $u,v,w \in \Vnq$ and $\lambda, \mu \in GF(q)$,
597 \begin{enumerate}[i.]
598 \item $u \cdot v = v \cdot u$
599 \item $(\lambda u + \mu v) \cdot w = \lambda(u \cdot w) + \mu (v \cdot w)$
600 \end{enumerate}
601\end{lemma}
602\begin{proof}
603 (at exercise \ref{ex.7.1}).
604\end{proof}
605
606\begin{defn}{}[Dual code]
607 given a linear $[n, k]$-code $C$, the \emph{dual code} of $C$, denoted $C^{\perp}$, is defined to be the set of those vectors of $\Vnq$ which are orthogonal to every codeword of $C$. ie.
608 $$C^{\perp} = \{ v \in \Vnq ~|~ v \cdot u = 0 ~\forall~ u \in C \}$$
609\end{defn}
610
611\begin{lemma}{7.2} \label{7.2}
612 $C$ a $[n,k]$-code with GM $G$. Then $v \in \Vnq$ belongs to $C^\perp$ iff $v$ is orthogonal to every row of $G$, ie.
613 $$v \in C^\perp \Longleftrightarrow v \cdot G^T = 0$$
614\end{lemma}
615\begin{proof}
616 let rows of $G$ be $r_1, \ldots, r_k$, suppose $v \cdot r_i = 0 ~\forall i$ (ie. $v$ orthogonal to every row of $G$).
617
618 If $u \in C$ (ie. a codeword of $C$), then $u = \sum_{i=1}^k \lambdda_i r_i$ for some scalars $\lambda_i$, so that
619 $$v \cdot u = v \cdot \sum_{i=1}^k \lambda_i r_i = \sum_{i=1}^k \lambda_i \cdot \underbrace{(v \cdot r_i)}_{0} = \sum \lambda_i \cdot 0 = 0$$
620
621 $\Longrightarrow~$ hence $v$ is orthogonal to every codeword of $C$, and so is in $C^\perp$.
622\end{proof}
623
624
625\begin{thm}{7.3}
626 $C$ a $[n,k]$-code over $GF(q)$. Then the dual code $C^\perp$ of $C$ is a linear $[n, n-k]$-code.
627\end{thm}
628\begin{proof}
629 \begin{enumerate}[i.]
630 \item first show that $C^\perp$ is a linear code:\\
631
632 let $v_1,v_2 \in C^\perp$ and $\lambda, \mu \in GF(q)$. Then $\forall u \in C$,
633 \begin{align*}
634 (\lambda v_1 + \mu v_2) \cdot u &= \lambda (v_1 \cdot u) + \mu (v_2 \cdot u)\\
635 &\text{notice that $v_1,v_2 \in C^\perp$, so}\\
636 &\text{that $v_1,v_2$ are orthogonal with $u$}\\
637 &\text{hence $(v_1 \cdot u)$ and $(v_2 \cdot u)$ are $0$}\\
638 &= \lambda \cdot 0 + \mu \cdot 0 = 0
639 \end{align*}
640
641 Hence $\lambda \cdot v_1 + \mu \cdot v_2 \in C^\perp$, and so $C^\perp$ is linear, since it is closed under linear combinations.
642
643 \item Next, show that $C^\perp$ has dimension $n-k$:\\
644
645 Let $G=[g_{ij}]$ be a GM of $C$.
646
647 Then by Lemma 7.2, the elements of $C^\perp$ are the vectors $v = (v_1, v_2, \dots, v_n)$, since $v \in C^\perp \Longleftrightarrow v \cdot G^T=0$, satisfying
648 $$\sum_{j=1}^{m} g_{ij} v_j = 0, ~\forall~ i = [k]$$
649
650 $\longrightarrow$ this is a system of $k$ independent homogeneous equations in $n$ unknowns, with solution space $C^\perp$. From linear algebra we know that it has dimension $n-k$. To see it:
651
652 if codes $C_1$ and $C_2$ are equivalent, then $C_1^\perp,~ C_2^\perp$ are also equivalent. Hence is enough to show that $\dim(C^\perp) = n-k$, where $C$ is a standard form GM:
653
654$$C = \begin{pmatrix}
655 1 & \ldots & 0 & a_{1,1} & \ldots & a_{1, n-k} \\
656 \vdots & & \vdots & \vdots & & \vdots \\
657 0 & \ldots & 1 & a_{k,1} & \ldots & a_{k, n-k} \\
658\end{pmatrix}$$
659
660Then
661$$C^\perp = \{ (v_1, \ldots, v_n) \in \Vnq ~\big|~ v_i + \sum_{j=1}^{n-k} a_{i,j} v_{k+j} = 0,~ i=1,2,\ldots,k \}$$
662
663For each of the $q^{n-k}$ choices of $(v_{k+1}, \ldots, v_n),~~ \exists!~ (v_1, v_2, \ldots, v_n) \in C^\perp$.
664
665Hence $|C^\perp| = q^{n-k}$, therefore $dim(C^\perp) = n-k$.
666 \end{enumerate}
667\end{proof}
668
669\begin{thm}{7.5} \label{7.5}
670 for any $[n,k]$-code $C$, $(C^\perp)^\perp = C$.
671\end{thm}
672\begin{proof}
673 clearly $C \subseteq (C^\perp)^\perp$, since every vector in $C$ is orthogonal to every vector in $C^\perp$.
674
675 But $dim((C^\perp)^\perp) = n - (n - k ) = k = dim(C)$, therefore $C=(C^\perp)^\perp$.
676\end{proof}
677
678
679\subsection{PCM (parity-check matrix)}
680
681\begin{defn}{}[PCM]
682 A \emph{parity-check matrix} (PCM) $H$ for a $[n,k]$-code $C$ is a generator matrix of $C^\perp$.
683
684 $\Longrightarrow~H$ is a $(n-k) \times n$ matrix satisfying $GH^T=0$.
685\end{defn}
686
687From \ref{7.2} and \ref{7.5},\\
688if $H$ a PCM of $C$, then
689$$C = \{ x \in \Vnq ~|~ xH^T=0 \}$$
690
691$\Longrightarrow$ Any linear code is completely specified by a PCM.
692
693\vspace{0.5cm}
694
695\begin{intuition}{}
696 \begin{enumerate}[i.]
697 \item{PCM:} $G$ specifies how to build a codeword, the PCM $H$ specifies the rules a vector must follow to be considered a valid codeword.
698 \item{dual-code:} orthogonal "shadow", see $C$ as a plane through 3D origin; $C^\perp$ is the (normal vector) line emerging from the plane.
699
700 Rows of the PCM are the basis for the dual-code $C^\perp$ $\Longrightarrow$ ie. the rules that define $C$ are themselves a code.
701 \end{enumerate}
702\end{intuition}
703
704\vspace{0.5cm}
705\begin{thm}{7.6} \label{7.6}
706 if $G= [I_k | A]$ is the standard form generator matrix of an $[n,k]$-code $C$, then a PCM for $C$ is $H=[-A^T ~|~ I_{n-k}]$.
707
708 eg.
709$$G = \begin{bmatrix}
710 1 & \ldots & 0 & a_{1,1} & \ldots & a_{1, n-k} \\
711 \vdots & & \vdots & \vdots & & \vdots \\
712 0 & \ldots & 1 & a_{k,1} & \ldots & a_{k, n-k} \\
713\end{bmatrix}$$
714
715$$H = \begin{bmatrix}
716 -a_{1,1} & \ldots & -a_{1, n-k} & 1 & \ldots & 0 \\
717 \vdots & & \vdots & \vdots & & \vdots \\
718 -a_{k,1} & \ldots & -a_{k, n-k} & 0 & \ldots & 1 \\
719\end{bmatrix}$$
720which, in binary, the minus signs are unnecessary.
721\end{thm}
722
723\begin{defn}{}[Standard form]
724 a PCM that is $H = [B ~|~ I_{n-k}]$
725\end{defn}
726
727\subsection{Syndrome}
728\begin{defn}{}[Syndrome]
729 let $H$ a PCM of a $[n,k]$-code $C$.
730
731 Then $\forall~ y \in \Vnq$, the $1 \times (n-k)$ row vector
732 $$S(y) = y H^T$$
733 is called the \emph{syndrome} of $y$.
734\end{defn}
735
736\begin{remark}{}
737 \begin{enumerate}[i.]
738 \item for $h_1, h_2, \ldots, h_{n-k}$ being rows of $H$, then
739 $$S(y) = (y \cdot h_1, y \cdot h_2, \ldots, y \cdot h_{n-k})$$
740 \item $S(y)=0 \Longleftrightarrow y \in C$
741 \end{enumerate}
742\end{remark}
743
744\begin{intuition}{}
745 Syndrome is the "sympthom" of the error. It ignores the valid part of the message and isolates the noise.
746
747 $$S(y) = y H^T = (c+e)H^T = \underbrace{cH^T}_{0} + eH^T = 0+eH^T = e H^T$$
748
749 Syndrome allows the receiver to identify what went wrong without knowing what was originally sent.
750\end{intuition}
751
752\begin{lemma}{7.8}
753 two vectors $u,v$ are the same ocset of $C$ iff they have the same syndrome.
754\end{lemma}
755\begin{proof}
756 if $u,v$ in the same coset of $C$
757 \begin{align*}
758 &\Longrightarrow u+C = v+C\\
759 &\Longrightarrow u-v \in C\\
760 &\Longrightarrow (u-v)H^T =0\\
761 &\Longrightarrow uH^T =v H^T\\
762 &\Longrightarrow S(u) = S(v)
763 \end{align*}
764\end{proof}
765
766\begin{cor}{7.9}
767 There is a one-to-one ccorrespondence between cosets and syndromes.
768
769 $\longrightarrow$ for small $n$, it's fast to locate the received vector $y$ in the array, but for large $n$: use syndrome to find which coset (ie. which row of the array) contains $y$.
770\end{cor}
771
772\begin{eg}{7.9}
773 (from example \ref{h.6.5})
774 $$G= \begin{bmatrix}
775 1 & 0 & 1 & 1\\
776 0 & 1 & 0 & 1
777 \end{bmatrix}$$
778 by \ref{7.6},
779 $$H= \begin{bmatrix}
780 1 & 0 & 1 & 0\\
781 1 & 1 & 0 & 1
782 \end{bmatrix}$$
783
784 Hence the syndromes of the coset leaders are
785 \begin{align*}
786 S(0000) &= 00\\
787 S(1000) &= 11\\
788 S(0100) &= 01\\
789 S(0010) &= 10\\
790 \end{align*}
791
792 The standard array becomes:
793
794 \begin{matrix}
795 coset leaders & & & & syndromes\\
796 0000 & 1011 & 0101 & 1110 & 00\\
797 1000 & 0011 & 1101 & 0110 & 11\\
798 0100 & 1111 & 0001 & 1010 & 01\\
799 0010 & 1001 & 0111 & 1100 & 10
800 \end{matrix}
801
802 so, decoding algorithm: when a vector $y$ is received, calculate $S(y)=yH^T$, locate $S(y)$ in the \emph{syndromes} column of the array.
803
804 Locate $y$ in the corresponding row and decode as the codeword at the top of the column containing $y$.
805
806
807 $\longrightarrow$ in practice: \emph{syndrome lookup table}:
808 \begin{matrix}
809 \text{syndrome}~ z & \text{coset leader}~ f(z)\\
810 00 & 0000\\
811 11 & 1000\\
812 01 & 0100\\
813 10 & 0010
814 \end{matrix}
815
816 decoding procedure:
817 \begin{enumerate}
818 \item receive $y$, calculate $S(y)=y H^T$
819 \item let $z=S(y)$, locate $z$ in the first column of the looku table
820 \item decode $y$ as $y-f(z)$
821 \end{enumerate}
822\end{eg}
823
824\subsection{Incomplete decoding}
825For $d(C)= 2t +1$ (or $2t+2$), guarantee the correction of $\leq t$ errors in any codewordd and also detect some cases of more than $t$ errors.
826
827$\longrightarrow$ Arrange the cosets in order of increasing weight of the coset leaders.
828
829Divide the array into a top part and a bottom part; top: cosets whose leaders have weights $\leq t$.
830
831\begin{itemize}
832 \item[-] If $y$ in top part: decode as usual (assuming $\leq t$ errors).
833 \item[-] If $y$ in bottom part: conclude that $>t$ errors have occurred, ask for retransmission.
834\end{itemize}
835
836\subsection{Exercises}
837\begin{ex}{7.1} \label{ex.7.1}
838 prove Lemma \ref{7.1}
839\end{ex}
840\begin{proof}
841 For any $u,v,w \in \Vnq$ and $\lambda, \mu \in GF(q)$,
842 \begin{enumerate}[i.]
843 \item $u \cdot v = v \cdot u$\\
844 $$u \cdot v = \sum_{i=1}^n u_i \cdot v_i = \sum_{i=1}^n v_i \cdot u_i = v \cdot u$$
845 \item $(\lambda u + \mu v) \cdot w = \lambda(u \cdot w) + \mu (v \cdot w)$\\
846 \begin{align*}
847 (\lambda u + \mu v) w &= \sum(\lambda u_i + \mu v_i) w_i\\
848 &= \sum (\lambda u_i w_i + \mu v_i w_i)\\
849 &= \sum (\lambda u_i w_i) + \sum (\mu v_i w_i)\\
850 &= \lambda \sum(u_i w_i) + \mu \sum (v_i w_i)\\
851 &= \lambda \cdot (u \cdot w) + \mu \cdot (v \cdot w)
852 \end{align*}
853 \end{enumerate}
854\end{proof}
855
856\bibliographystyle{unsrt}
857\bibliography{algebraic-coding-theory-notes.bib}
858
859\end{document}