Total Pageviews

Thursday, September 10, 2026

๐Ÿ“ก Entropy of an Information Source

๐Ÿ“ก Entropy of an Information Source

Information Theory • Mathematical Explanation • Numerical Examples

๐Ÿ“– 1. What is Entropy?

In Information Theory, entropy measures the average amount of uncertainty or information produced by an information source.

If the outcome of a source is highly uncertain, its entropy is high. If the outcome is almost certain, its entropy is low.

Simple idea:

๐ŸŽฒ More uncertainty → More information → Higher entropy

๐ŸŽฏ Less uncertainty → Less information → Lower entropy

๐Ÿ“ 2. Information Content of an Event

Suppose an event x occurs with probability P(x). The information contained in that event is:

I(x) = −log₂ P(x)

The unit is called a bit when the logarithm is base 2.

Example

Suppose an event has probability:

P(x) = 1/2

Then:

I(x) = −log₂(1/2)
= −(−1)
= 1 bit

Therefore, an event having probability 1/2 carries 1 bit of information.

๐Ÿงฎ 3. Mathematical Formula of Entropy

Suppose an information source can produce n different symbols:

X = {x₁, x₂, x₃, ..., xโ‚™}

with probabilities:

P = {p₁, p₂, p₃, ..., pโ‚™}

where:

p₁ + p₂ + ... + pโ‚™ = 1

The entropy of the source is:

H(X) = − ฮฃ pแตข log₂(pแตข)

or explicitly:

H(X) = −[p₁log₂p₁ + p₂log₂p₂ + ... + pโ‚™log₂pโ‚™]

๐Ÿ“Š 4. Why Do We Take an Average?

The information associated with an individual symbol is:

I(xแตข) = −log₂(pแตข)

The average information is obtained by multiplying each information value by its probability:

H(X) = ฮฃ pแตข I(xแตข)

Substituting:

H(X) = ฮฃ pแตข[−log₂(pแตข)]

Therefore:

H(X) = −ฮฃ pแตขlog₂(pแตข)

๐ŸŽฏ Example 1 — Fair Coin

Consider a fair coin with two possible outcomes:

Symbol Probability
Head (H) 0.5
Tail (T) 0.5

Using:

H(X) = −ฮฃpแตขlog₂(pแตข)

Therefore:

H(X) = −[0.5log₂(0.5) + 0.5log₂(0.5)]

Since:

log₂(0.5) = −1

Therefore:

H(X) = −[0.5(−1) + 0.5(−1)]
= −[−0.5 − 0.5]
= 1 bit
Answer: Entropy of a fair coin = 1 bit.

๐ŸŽฒ Example 2 — Biased Coin

Suppose:

Outcome Probability
Head 0.8
Tail 0.2

Entropy:

H(X) = −[0.8log₂(0.8) + 0.2log₂(0.2)]

Using approximate values:

log₂(0.8) ≈ −0.3219
log₂(0.2) ≈ −2.3219

Therefore:

H(X) = −[0.8(−0.3219) + 0.2(−2.3219)]

≈ 0.722 bits
Answer: Entropy ≈ 0.722 bits.

Notice that this is less than 1 bit because the coin is biased, so there is less uncertainty.

๐Ÿ“ฆ Example 3 — Three Symbol Source

Consider a source:

X = {A, B, C}

with probabilities:

Symbol Probability
A 0.5
B 0.3
C 0.2

Check:

0.5 + 0.3 + 0.2 = 1

Entropy:

H(X) = −[0.5log₂0.5 + 0.3log₂0.3 + 0.2log₂0.2]

Using approximate logarithms:

H(X) ≈ 1.485 bits

๐Ÿ† 5. Maximum Entropy

For a source having n equally probable symbols:

p₁ = p₂ = ... = pโ‚™ = 1/n

The entropy becomes:

H(X) = −n(1/n)log₂(1/n)

Therefore:

Hmax = log₂(n)

Example

For 4 equally probable symbols:

Hmax = log₂(4) = 2 bits

For 8 equally probable symbols:

Hmax = log₂(8) = 3 bits

⬇️ 6. Minimum Entropy

If one symbol has probability 1 and all other symbols have probability 0:

P(X) = {1,0,0,...,0}

Then:

H(X) = 0 bits

There is no uncertainty because the outcome is completely predictable.

⭐ 7. Important Properties of Entropy

1️⃣ Non-Negative

H(X) ≥ 0

Entropy cannot be negative.

2️⃣ Certain Event

P(X)=1 ⇒ H(X)=0

A completely predictable source has zero entropy.

3️⃣ Maximum

Hmax=log₂n

Maximum entropy occurs when all symbols are equally probable.

4️⃣ Unit

When log₂ is used, entropy is measured in bits/symbol.

๐ŸŽฌ Animated Entropy Calculation

The following animation demonstrates how the entropy of a source is calculated from probability → information → weighted information → total entropy.

๐Ÿ“ก Probability → Information → Entropy

P(x) Probability
I(x) Information
pI(x) Weighted
H(X) Entropy
Press ▶ Start Animation
H(X)

๐Ÿงฎ General Numerical Example

Suppose an information source produces four symbols:

Symbol Probability Information
A 0.4 −log₂(0.4)
B 0.3 −log₂(0.3)
C 0.2 −log₂(0.2)
D 0.1 −log₂(0.1)

Therefore:

H(X) = −[0.4log₂(0.4) +0.3log₂(0.3) +0.2log₂(0.2) +0.1log₂(0.1)]

Approximate calculation gives:

H(X) ≈ 1.846 bits/symbol

๐ŸŒ 8. Real-Life Applications

๐Ÿ“ก Communication

Entropy helps measure the information generated by a communication source.

๐Ÿ—œ️ Data Compression

Entropy provides a theoretical limit for lossless data compression.

๐Ÿ’ป Computer Networks

It can be used to analyze information transmitted through communication channels.

๐Ÿค– Machine Learning

Entropy is used in decision trees to measure impurity and choose useful splits.

๐Ÿ“Œ Important Formulas for Examination

Information:
I(x) = −log₂P(x)
Entropy:
H(X) = −ฮฃpแตขlog₂pแตข
Maximum Entropy:
Hmax = log₂n
Minimum Entropy:
Hmin = 0

๐ŸŽฏ Quick Revision

  • ๐Ÿ“ก Entropy measures the average uncertainty of an information source.
  • ๐Ÿงฎ Information of an event = −log₂P(x).
  • ๐Ÿ“Š Entropy = −ฮฃpแตขlog₂pแตข.
  • ๐ŸŽฒ A fair binary source has entropy 1 bit.
  • ๐Ÿ“‰ A biased source has lower entropy than an equally probable source with the same number of symbols.
  • ๐Ÿ† Maximum entropy for n symbols is log₂n.
  • ⬇️ Minimum entropy is 0.
  • ๐Ÿ’พ Entropy is fundamental in information theory and data compression.

No comments:

Post a Comment