Possible outcomes when tossing a coin twice:
\[
\{HH, HT, TH, TT\}.
\]
Let $X$ be the number of heads minus the number of tails. We compute $X$ for each outcome:
- For $HH$, $X = 2 - 0 = 2$.
- For $HT$, $X = 1 - 1 = 0$.
- For $TH$, $X = 1 - 1 = 0$.
- For $TT$, $X = 0 - 2 = -2$.
The probability distribution is:
- $P(X = 2) = \frac{1}{4}$ (since only one outcome has 2 heads).
- $P(X = 0) = \frac{2}{4} = \frac{1}{2}$ (since two outcomes have 1 head and 1 tail).
- $P(X = -2) = \frac{1}{4}$ (since only one outcome has 2 tails).
Thus, the probability distribution is:
\[
P(X = 2) = \frac{1}{4}, \quad P(X = 0) = \frac{1}{2}, \quad P(X = -2) = \frac{1}{4}.
\]
To find the mean (expected value) of $X$, we use:
\[
E(X) = \sum x \cdot P(X = x) = 2 \times \frac{1}{4} + 0 \times \frac{1}{2} + (-2) \times \frac{1}{4} = \frac{2}{4} + 0 - \frac{2}{4} = 0.
\]
Thus, the mean of $X$ is $E(X) = 0$.