Consider a discrete random variable $x$. The amount of information can be viewed as the 'degree of surprise' on learning the value of $x$. If we are told that a highly improbable event has just occurred, we will have received more information if we were told that some very likely event has just occurred. Our measure of information content will depend on the probability distribution $p(x)$, and we look for a quantity $h(x)$ that is a monotonic function of the probability $p(x)$ and that expresses the information content.
Note that if we have two events $x$ and $y$ that are unrelated, then the information gain from observing both of them should be the sum of the information gained from each of them separately, so that $h(x,y)=h(x)+h(y)$. Two unrelated events will be statistically independent and so $p(x,y)=p(x)p(y)$. These give
$$ h(x)=-\log p(x) $$
The average amount of information that they transmit in the process is given by
$$ \text H[x]=-\sum_x p(x)\log p(x) $$
This quantity is called the entropy of the random variable $x$.
Distribution $p(x_i)$ that are sharply peaked around a few values will have a relatively low entropy, whereas those that are spread more evenly across many values will have higher entropy. Because $0\leqslant p_i\leqslant 1$, the entropy is nonnegative. The maximum entropy configuration can be found by maximizing $\text H$ using a Lagrange multiplier to enforce the normalization constraint on the probabilities. Thus we maximize
$$ \tilde\text H=-\sum_ip(x_i)\log p(x_i)+\lambda\left (\sum_ip(x_i)-1\right) $$
from which we find that all of the $p(x_i)$ are equal and are given by $p(x_i)=1/M$ where $M$ is the total umber of states $x_i$. The corresponding value of the entropy is then $\text H=\log M$.
We can extend the definition of entropy to include distributions $p(x)$ over continuous variables $x$ by $\text H[x]=-\int p(x)\log p(x) \ \text dx$ which is called the differential entropy. For a density defined over multiple continuous variables, denoted collectively by the vector $\bold x$, the differential entropy is given by
$$ \text H[x]=-\int p(\bold x)\log p(\bold x)\ \text d\bold x $$
The distribution that maximizes the differential entropy is the Gaussian $\mathcal N(x|\mu,\sigma^2)$. If we evaluate the differential entropy of the Gaussian, we obtain
$$ \text H[x]=\frac{1}{2}\{1+\log(2\pi \sigma^2)\} $$
Thus we see again that the entropy increases as the distribution becomes broader. This result also show that the differential entropy, unlike the discrete entropy, can be negative, because $\text H[x]<0$ for $\sigma^2<1/(2\pi e)$.
Suppose we have a joint distribution $p(\bold x,\bold y)$ from which we draw pairs of values of $\bold x$ and $\bold y$. If a value $\bold x$ is already known, then the additional information needed to specify the corresponding value of $\bold y$ is given by $-\log p(\bold y|\bold x)$. Thus the average additional information needed to specify $\bold y$ can be written as
$$ \text H[\bold y|\bold x]=-\iint p(\bold y,\bold x)\log p(\bold y|\bold x)\ \text d\bold y\text d\bold x $$
which is called the conditional entropy of $\bold y$ given $\bold x$. The conditional entropy satisfies the relation
$$ \text H[\bold x,\bold y]=\text H[\bold y|\bold x]+\text H[\bold x] $$
where $\text H[\bold x,\bold y]$ is the differential entropy of $p(\bold x,\bold y)$ and $\text H[\bold x]$ is the differential entropy of the marginal distribution $p(\bold x)$.