# Joint entropy

In information theory, joint entropy is a measure of the uncertainty associated with a set of variables.

## Definition

The joint Shannon entropy (in bits) of two discrete random variables $X$ and $Y$ with images ${\mathcal {X}}$ and ${\mathcal {Y}}$ is defined as$^{:16}$
| $\mathrm {H} (X,Y)=-\sum _{x\in {\mathcal {X}}}\sum _{y\in {\mathcal {Y}}}P(x,y)\log _{2}[P(x,y)]$ | (Eq.1) |
where $x$ and $y$ are particular values of $X$ and $Y$, respectively, $P(x,y)$ is the joint probability of these values occurring together, and $P(x,y)\log _{2}[P(x,y)]$ is defined to be 0 if $P(x,y)=0$.
For more than two random variables $X_{1},...,X_{n}$ this expands to
| $\mathrm {H} (X_{1},...,X_{n})=-\sum _{x_{1}\in {\mathcal {X}}_{1}}...\sum _{x_{n}\in {\mathcal {X}}_{n}}P(x_{1},...,x_{n})\log _{2}[P(x_{1},...,x_{n})]$ | (Eq.2) |
where $x_{1},...,x_{n}$ are particular values of $X_{1},...,X_{n}$, respectively, $P(x_{1},...,x_{n})$ is the probability of these values occurring together, and $P(x_{1},...,x_{n})\log _{2}[P(x_{1},...,x_{n})]$ is defined to be 0 if $P(x_{1},...,x_{n})=0$.

## Properties
### Nonnegativity

The joint entropy of a set of random variables is a nonnegative number.
    $\mathrm {H} (X,Y)\geq 0$
    $\mathrm {H} (X_{1},\ldots ,X_{n})\geq 0$

### Greater than individual entropies

The joint entropy of a set of variables is greater than or equal to the maximum of all of the individual entropies of the variables in the set.
    $\mathrm {H} (X,Y)\geq \max \left[\mathrm {H} (X),\mathrm {H} (Y)\right]$
    $\mathrm {H} {\biglX_{1},\ldots ,X_{n}{\bigr )}\geq \max _{1\leq i\leq n}{\Bigl \\mathrm {H} {\biglX_{i}{\bigr )}{\Bigr \}}$

### Less than or equal to the sum of individual entropies

The joint entropy of a set of variables is less than or equal to the sum of the individual entropies of the variables in the set. This is an example of subadditivity. This inequality is an equality if and only if $X$ and $Y$ are statistically independent.$^{:30}$
    $\mathrm {H} (X,Y)\leq \mathrm {H} (X)+\mathrm {H} (Y)$
    $\mathrm {H} (X_{1},\ldots ,X_{n})\leq \mathrm {H} (X_{1})+\ldots +\mathrm {H} (X_{n})$

## Relations to other entropy measures

Joint entropy is used in the definition of conditional entropy$^{:22}$
    $\mathrm {H} (X|Y)=\mathrm {H} (X,Y)-\mathrm {H} (Y)\,$,
and
    $\mathrm {H} (X_{1},\dots ,X_{n})=\sum _{k=1}^{n}\mathrm {H} (X_{k}|X_{k-1},\dots ,X_{1})$.
It is also used in the definition of mutual information$^{:21}$
    $\operatorname {I} (X;Y)=\mathrm {H} (X)+\mathrm {H} (Y)-\mathrm {H} (X,Y)\,$.
In quantum information theory, the joint entropy is generalized into the joint quantum entropy.

## Joint differential entropy
### Definition

The above definition is for discrete random variables and just as valid in the case of continuous random variables. The continuous version of discrete joint entropy is called joint differential (or continuous) entropy. Let $X$ and $Y$ be a continuous random variables with a joint probability density function $f(x,y)$. The differential joint entropy $h(X,Y)$ is defined as$^{:249}$
| $h(X,Y)=-\int _{{\mathcal {X}},{\mathcal {Y}}}f(x,y)\log f(x,y)\,dxdy$ | (Eq.3) |
For more than two continuous random variables $X_{1},...,X_{n}$ the definition is generalized to:
| $h(X_{1},\ldots ,X_{n})=-\int f(x_{1},\ldots ,x_{n})\log f(x_{1},\ldots ,x_{n})\,dx_{1}\ldots dx_{n}$ | (Eq.4) |
The integral is taken over the support of $f$. It is possible that the integral does not exist in which case we say that the differential entropy is not defined.

### Properties

As in the discrete case the joint differential entropy of a set of random variables is smaller or equal than the sum of the entropies of the individual random variables:
    $h(X_{1},X_{2},\ldots ,X_{n})\leq \sum _{i=1}^{n}h(X_{i})$$^{:253}$
The following chain rule holds for two random variables:
    $h(X,Y)=h(X|Y)+h(Y)$
In the case of more than two random variables this generalizes to:$^{:253}$
    $h(X_{1},X_{2},\ldots ,X_{n})=\sum _{i=1}^{n}h(X_{i}|X_{1},X_{2},\ldots ,X_{i-1})$
Joint differential entropy is also used in the definition of the mutual information between continuous random variables:
    $\operatorname {I} (X,Y)=h(X)+h(Y)-h(X,Y)$