How to simplify $\log_2$ more easily? Need guidance

71 Views Asked by At

So I need to calculate the entropy for a code. We are not allowed to use a calculator and I wonder how I can make my life easier.

Given the following expression:

$$ -\frac{6}{24}\log_2\left(\frac{6}{24}\right) - \frac{4}{24}\log_2\left(\frac{4}{24}\right) -\frac{9}{24}\log_2\left(\frac{9}{24}\right) - \frac{1}{24}\log_2\left(\frac{1}{24}\right)-\frac{4}{24}\log_2\left(\frac{4}{24}\right)$$

how can i calculate that without a calculator properly? I tried this now several times but i end up with lots of fractions which seem to be very hard for me to calculate in time without a calculator.

Any tips on how you would calculate this properly?

2

There are 2 best solutions below

3
On BEST ANSWER

First, write $\log(a/24)=\log(a)-\log(24),$ so you get: $$\log_2 24-\frac{1}{24}\left(6\log_2 6 + 4\log_2 4 +9\log_2 9 +4\log_2 4\right)$$

Then use $$\begin{align}\log_2 24&=3+\log_2 3,\\\log_2 6&=1+\log_2 3,\\\log_2 4&=2,\\\log_2 9&=2\log_2 3.\end{align}$$

you get: $$3+\log_2 3-\frac{1}{24}\left(22+24\log_2 3\right)=\frac{25}{12}$$


In general, if $p_i=\frac{n_i}{N}$ for $i=1,\dots,k$ then the entropy will be:

$$\log_2 N -\frac{1}{N}\sum_{i=1}^{k} n_i\log_2 n_i$$

0
On

Since all the denominators inside the $\log$ is $24$ you can use

$$\log_2 \left(\frac{X}{24}\right)=\log_2 (X)-\log_2 (24)$$

to group all the $\log_2 (24)$ terms together and simplify them.

Next, for numerator $X$, you break them up to prime factors, for example:

$$\log_26=\log_22+\log_23=1+\log_23$$

$$\log_24=2\log_22=2$$

$$\log_29=2\log_23$$

Also note $24=2^3\cdot 3$, so finally your simplified result will be

$$c_1+c_2\cdot\log_23$$