# How to calculate probability distribution in logarithm scale and transform back?

I need to calculate the probability distribution (p.m.f.) of $X=X_1X_2 \cdot \cdot \cdot X_n$ where $X_i \in \{1,2\}$ and $X_i$ are iid with probabilities $p$ and $1-p$ respectively.

Since $X=2^n$ for $n \in\mathbb{N}$, then rather than inferring the distribution directly, one could consider $\log_2(X)=log_2(X_1)+log_2(X_2)+ \cdot \cdot \cdot +log_2(X_n)$ that's known to have a binomial distribution of some sort (because $X_1+ \cdot \cdot \cdot + X_n$ of bernoulli r.v.s has).

But if one infers the distribution in $log_2$ scale (and what's the p.m.f. of $\log_2(X)$?), then how do I transform back to the original scale?

• Your question is not presented well enough. Do you want to find the pdf of $X$? Are $X_i$s iid? – msm Nov 23 '16 at 11:56

## 2 Answers

Let $$X=\prod_{i=1}^{n}X_i$$ So $$Z=\log_2X=\sum_{i=1}^{n}\log_2X_i$$

Define $Y_i=\log_2X_i$. It turns out $Y\sim Bernulli(1-p)$ and $Z\sim Binom(n,1-p)$. The support of $Z$ is $[0,n]$

and $$X=2^Z,\,X\in [1,2^n]$$ $$p_X(x)= p_Z(\log_2x)=\binom{n}{\log_2x}p^{n-\log_2x}(1-p)^{\log_2x}$$ where $x=2^k$. SO it can also be written as $$p_X(2^k)= p_Z(k)=\binom{n}{k}p^{n-k}(1-p)^{k}$$

Let $X_n$, $n=1,2,\ldots$ be i.i.d. random variables with $$\mathbb P(X_1=1) = p = 1-\mathbb P(X_1=2).$$ For each positive integer $n$, let $$Y_n = \prod_{j=1}^n X_j,$$ then $$\mathbb P(Y_1=1)=p=1-\mathbb P(Y_1=2).$$ Suppose for some integers $n,k$ such that $0\leqslant k\leqslant n$ and $n>0$, $$\mathbb P\left(Y_n = 2^k\right) = \binom nk (1-p)^kp^{n-k}.$$ Then for $0\leqslant k\leqslant n+1$ we have \begin{align} \mathbb P\left(Y_{n+1}=2^k\right) &= \mathbb P\left(X_{n+1}Y_n = 2^k\right)\\ &=\mathbb P\left(X_{n+1}Y_n = 2^k\mid X_{n+1}=1\right)\mathbb P(X_{n+1}=1)\\ &\quad+\mathbb P\left(X_{n+1}Y_n = 2^k\mid X_{n+1}=2\right)\mathbb P(X_{n+1}=2)\\ &= \mathbb P\left(Y_n=2^k\right)\mathbb P(X_{n+1}=1) + \mathbb P\left(Y_n=2^{k-1}\right)\mathbb P(X_{n+1}=2)\\ &= p\binom nk (1-p)^kp^{n-k} + (1-p)\binom n{k-1} (1-p)^{k-1}p^{n+1-k}\\ &= \left(\binom nk + \binom n{k-1}\right)(1-p)^kp^{n+1-k}\\ &= \binom {n+1}k (1-p)^kp^{n+1-k}. \end{align} It follows by induction that $\xi_n := \lg Y_n$ has $\operatorname{Bin}\left(n,1-p\right)$ distribution, that is, $$\mathbb P(\xi_n = k) = \binom nk (1-p)^kp^{n-k}.$$