# How much data is needed to describe a message?

Posted on December 12, 2011 by

An old joke tells of a man sending a telegram to his brother inviting him to his son’s wedding. Initially he writes this message:

Dear brother,
You are invited to my son’s wedding, two weeks from now.
Looking forward to meeting you.

After learning the price of each word he reasons that Dear brother is redundant since his brother is going to be getting the message by hand, and he already knows how much he loves him. The words you are invited are also redundant, since it is obvious that once there is a wedding his brother is invited, similarly Looking forward to meeting you can be deleted. The words my son’s are also redundant because it wouldn’t make sense to report another man’s wedding, and so the man ended up with the shorter telegram:

wedding in two weeks
which exactly captures the information he wanted to transfer to his brother.

Given a message, in information theory we try to assess how many bits are needed to encode this message, or in other words given an encoded message how many bits are redundant and can be deleted. To do that we first need to quantify the amount of data encoded in a message of $n$ bits. In information theory this is referred to as entropy. The higher the entropy the more data is encapsulated in those bits (therefore fewer bits are redundant). Given a message $M = (m_1, m_2, ..., m_n)$ of $n$ symbols over an alphabet $\sigma = {\sigma_1, \sigma_2, ..., \sigma_s}$, of $s$ letters the entropy is given by this formula:

$Entropy(M) = - \sum_{i=1}^s Pr(\sigma_i)\log Pr(\sigma_i)$,

where $Pr(\sigma_i)$is the probability of an arbitrary letter in $M$ to be $\sigma_i$. In the simple case, $Pr(\sigma_i)=\frac{number\;of\;times\;\sigma_i\;appears\;in\;M}{n}$.

As can be easily seen the higher the entropy is the more random the message seems (i.e. There are less patterns in it), on the other hand, the message aaaaaaaaaa….aa has entropy 0 (remember that $\lim_{x \rightarrow 0} x\log x = 0$. For compression, we want to re-encode a message (with fewer bits) such that its entropy increases. In encryption (the other end of the spectrum), on the other hand, we want to re-encode a message (with the same number of bits) such that its entropy increases.

The joke we opened with goes on, as the man decides to delete the word wedding (because what other reason is there to be sending a telegram in the first place), and the words in two weeks (which is the appropriate time prior a wedding to be sending invitations), and so he returns home without sending any telegram at all.

### Like this:

Posted in Technology | |

### Follow Blog via Email

Join 26 other followers

### Follow Blog via Email

Join 26 other followers

Cancel
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 11, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9537090063095093, "perplexity_flag": "middle"}