# Entropy: understanding the equation

The equation for entropy is very often presented in textbooks without much explanation, other than to say it has the desired properties. Here, I attempt an informal derivation of the equation starting from uniform probability distributions.

A good way to think about information is in terms of sending messages. In the video, we send messages about the colour of items drawn from various probability distributions. Each message is coded as a binary number.

The amount of information in a probability distribution is the average number of bits (1s and 0s) needed to send messages about values drawn from this distribution, using the most efficient code possible.

We’ll see that the log term in the entropy equation is related to the number of bits needed to send a message – that is, the message length. The total entropy is just a weighted sum  of message lengths: it’s the average message length.

$$\Sigma$$ just means “sum”

$$-log(p_i)$$ is the number of bits needed to encode value $$i$$ – the interpretation of this is that more frequent values (larger $$p_i$$) should be sent using shorter messages

$$p_i$$ is the weight – we are averaging across all message lengths, weighted by how often that particular message is sent

### Related forum topics

To discuss this post, start by searching the forums for “Entropy: understanding the equation”.
{"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": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8468903303146362, "perplexity": 484.6980594787954}, "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": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-43/segments/1508187827662.87/warc/CC-MAIN-20171023235958-20171024015958-00207.warc.gz"}