# Typical set

In information theory, the typical set is a set of sequences whose probability is close to two raised to the negative power of the entropy of their source distribution. That this set has total probability close to one is a consequence of the asymptotic equipartition property (AEP) which is a kind of law of large numbers.

This has great use in compression theory as it provides a theoretical means for compressing data, allowing us to represent any sequence ${\displaystyle X^{n}}$ using ${\displaystyle nH(X)}$ bits on average, and, hence, justifying the use of entropy as a measure of information from a source.

The AEP can also be proven for a large class of stationary ergodic processes, allowing typical set to be defined in more general cases.

## (Weakly) typical sequences

If a sequence x1, ..., xn is drawn from an i.i.d. distribution ${\displaystyle X}$ defined over a finite alphabet ${\displaystyle {\mathcal {X}}}$, then the typical set, ${\displaystyle {A_{\epsilon }}^{(n)}}$ is defined as those sequences which satisfy:

${\displaystyle 2^{-n(H(X)+\epsilon )}\leq p(x_{1},x_{2},...,x_{n})\leq 2^{-n(H(X)-\epsilon )}}$

The probability above need only be within a factor of ${\displaystyle 2^{n\epsilon }}$.

It has the following properties if n is sufficiently large, ε can be chosen arbitrarily small so that:

1. The probability of a sequence from ${\displaystyle X}$ being drawn from ${\displaystyle {A_{\epsilon }}^{(n)}}$ is greater than ${\displaystyle 1-\epsilon }$
2. ${\displaystyle \left|{A_{\epsilon }}^{(n)}\right|\leq 2^{n(H(X)+\epsilon )}}$
3. ${\displaystyle \left|{A_{\epsilon }}^{(n)}\right|\geq (1-\epsilon )2^{n(H(X)-\epsilon )}}$

For a general stochastic process ${\displaystyle \{X(t)\}}$ with AEP, the (weakly) typical set can be defined similarly with ${\displaystyle p(x_{1},x_{2},...,x_{n})}$ replaced by ${\displaystyle p(x_{0}^{\tau })}$ (i.e. the probability of the sample limited to the time interval ${\displaystyle [0,\tau ]}$), ${\displaystyle n}$ being the degree of freedom of the process in the time interval and ${\displaystyle H(X)}$ being the entropy rate. If the process is continuous-valued, differential entropy is used instead.

## Strongly typical sequences (strong typicality)

If a sequence x1, ..., xn is drawn from some specified joint distribution, then the strongly typical set, Aε,strong(n) is defined as the set of sequences which satisfy

${\displaystyle \left|{\frac {N(x^{n})}{n}}-p(x^{n})\right|<{\frac {\varepsilon }{\|{\mathcal {X}}\|}}.}$

It can be shown that strongly typical sequences are also weakly typical (with a different constant ε, and hence the name. The two forms, however, are not equivalent. Strong typicality is often easier to work with in proving theorems for memoryless channels. However, as is apparent from the definition, this form of typicality is only defined for random variables having finite support.

## Jointly typical sequences

Two sequences ${\displaystyle x_{1}^{n}}$ and ${\displaystyle y_{1}^{n}}$ are jointly ε-typical if the pair ${\displaystyle (x_{1}^{n},y_{1}^{n})}$ is ε-typical with respect to the joint distribution ${\displaystyle p(x_{1}^{n},y_{1}^{n})}$ and both ${\displaystyle x_{1}^{n}}$ and ${\displaystyle y_{1}^{n}}$ are ε-typical with respect to their marginal distributions ${\displaystyle p(x_{1}^{n})}$ and ${\displaystyle p(y_{1}^{n})}$. The set of all such pairs of sequences ${\displaystyle (x_{1}^{n},y_{1}^{n})}$ is denoted by ${\displaystyle A_{\epsilon }^{n}(X,Y)}$. Jointly ε-typical n-tuple sequences are defined similarly.

## Applications of typicality

### Typical set encoding

In communication, typical set encoding encodes only the typical set of a stochastic source with fixed length block codes. Asymptotically, it is, by the AEP, lossless and achieves the minimum rate equal to the entropy rate of the source.

### Typical set decoding

In communication, typical set decoding is used in conjunction with random coding to estimate the transmitted message as the one with a codeword that is jointly ε-typical with the observation. i.e.

${\displaystyle {\hat {w}}=w\iff (\exists !w)((x_{1}^{n}(w),y_{1}^{n})\in A_{\epsilon }^{n}(X,Y))}$

where ${\displaystyle {\hat {w}},x_{1}^{n}(w),y_{1}^{n}}$ are the message estimate, codeword of message ${\displaystyle w}$ and the observation respectively. ${\displaystyle A_{\epsilon }^{n}(X,Y)}$ is defined with respect to the joint distribution ${\displaystyle p(x_{1}^{n})p(y_{1}^{n}|x_{1}^{n})}$ where ${\displaystyle p(y_{1}^{n}|x_{1}^{n})}$ is the transition probability that characterizes the channel statistics, and ${\displaystyle p(x_{1}^{n})}$ is some input distribution used to generate the codewords in the random codebook.