# Geometric distribution

Definition
The geometric distribution is a discrete distribution having propabiity \begin{eqnarray} \mathrm{Pr}(X=k) &=& p(1-p)^{k-1} \\ && (k=1,2,\cdots) \end{eqnarray} , where $0 \leq p \leq 1$.
Example: Dice
We roll a cubic dice many times, and let $X$ be the number of times until we roll a $1$. The probability that $X = k$ obeys the geometric distribution for $p = \frac{1}{6}$, \begin{eqnarray} \mathrm{Pr}(X=k) &=& \frac{1}{6} \Big( 1- \frac{1}{6} \Big)^{k-1} \\ && (k=1,2,\cdots) \end{eqnarray}

Explanation
Let $p$ be the probability rolling a $1$. Assuming that the cubic dice is symmetric without any distortion, \begin{eqnarray} p=\frac{1}{6} \end{eqnarray} The probability of rolling not $1$ is \begin{eqnarray} 1-p=\frac{5}{6} \end{eqnarray} We roll the dice until we roll a $1$. The probability of not rolling a $1$, if we roll a dice $k-1$ times is $(1-p)^{1-k}$. So, the probability of rolling a $1$ after the $k-1$ rolls is \begin{eqnarray} p(1-p)^{1-k} = \frac{1}{6} \Big( 1- \frac{1}{6} \Big)^{k-1} \end{eqnarray} , which is the geometric distribution for $p=\frac{1}{6}$.

Expectation value
The expectation value of random variable $X$, if $X$ obeys the geometric distribution, is Proof
Since $X$ obeys the geometric distribution, , the expectation value is $$\tag{1}$$
To find the sum in the right-hand side, we use Taylor expansion of function $1/(1-x)$, . The derivative of the left-hand side is , and that of the right-hand side is . We thus have . If we put $x= 1-p$, this equation becomes .
Substituting this into $(1)$, we obtain .
Specific examples
The figure below describes the geometric distribution for $p=\frac{1}{2}$ (green)、 , $p=\frac{1}{4}$ (blue)、 $p=\frac{1}{8}$ (pink). The expectation value is The smaller $p$ is, the flatter the graph is, and the expected value increases.

Variance and Standard deviation
The variance and the standard devation of random variable $X$, if $X$ obeys the geometric distribution, are \begin{eqnarray} V(X) &=& \frac{1-p}{p^2} \\ \\ \sigma(X) &=& \sqrt{V(X)} \\ &=& \sqrt{\frac{1-p}{p^2}} \end{eqnarray}

Proof
In general, the variance is the difference between the expectation value of the square and the square of the expectation value, i.e., Since the expectation value is $E(X) = \frac{1}{p}$ , we have $$\tag{1}$$ To obtain the variance, we thus need to derive the expectation of $X^2$. The expectation value of $X^2$ with the geometric distribution is \begin{eqnarray} E(X^2) &=& \sum_{k=1}^{\infty} k^2 \hspace{0.5mm} \mathrm{Pr}(X=k) \\ &=& \sum_{k=1}^{\infty} k^2 \hspace{0.5mm} p(1-p)^{k-1} \\ &=& p \sum_{k=1}^{\infty} k^2 \hspace{0.5mm} (1-p)^{k-1} \end{eqnarray} $$\tag{2}$$ In order to obtain the sum in the right-hand side, we focus on the Taylor expansion of 1/(1−x), and differentiate both sides: We multiply the both sides by x, and differentiate both sides: We put $x=1-p$, and substitute this into $(2)$, From this and $(1)$, we obtain Therefore, the standard deviation $\sigma(X)$ is \begin{eqnarray} \sigma(X) &=& \sqrt{V(X)} \\ &=& \sqrt{\frac{1-p}{p^2} } \end{eqnarray}
Specific examples :
The figure below describes the geometric distribution for $p=\frac{1}{2}$ (green)、 , $p=\frac{1}{4}$ (blue)、 $p=\frac{1}{8}$ (pink). The variance is、 \begin{eqnarray} V(X) = \left\{ \begin{array}{cc} 2 & (p=\frac{1}{2}) \\ 12 & (p=\frac{1}{4}) \\ 56 & (p=\frac{1}{8}) \end{array} \right. \end{eqnarray} The smaller $p$ is, the flatter the graph is, and the variance increases.