# What is the new probability density function by generating a random number by taking the reciprocal of a uniformly random number between 0 and 1?

I have a random number generator which can generate a random number between $0$ and $1$.

I attempt to generate a random number between 1 and infinity, by using that random number generator, but taking the reciprocal of that result.

Is the new generator uniform? Certainly not. Then what is the probability density function of the new generator?

Let the old probability density function be $f_1(x)$, and the new one be $f_2(x)$.

We have:$$\int_1^af_2(x)\mathrm dx=\int_\frac1a^1f_1(x)\mathrm dx$$where $a>1$.

We also know that $f_1(x)$ is uniform, and spans from $0$ to $1$. Therefore, $f_1(x)=1$ in that interval.

Therefore:$$\int_1^af_2(x)\mathrm dx=\int_\frac1a^1\mathrm dx=1-\frac1a$$

Differentiating both sides with respect to $a$:$$\frac{\mathrm d}{\mathrm da}\int_1^af_2(x)\mathrm dx=\frac{\mathrm d}{\mathrm da}\left(1-\frac1a\right)$$

Simplifying both sides:$$f_2(a)=\frac1{a^2}$$ $\blacksquare$

• Yours too! +1 (I found the same as you, so it was reassuring that my result is ok) – Jimmy R. Apr 3 '16 at 10:02
• I couldn't see how your first identity must be true until I noticed a theorem regarding integrals of inverse functions $\int_{c}^{d} f^{-1}(y)dy +\int_{a}^{b}f(x)dx = bd-ac$. Is this what you had in mind? – Robert Smith Apr 3 '16 at 18:46
• @RobertSmith I think what you're missing is that $X_2 \leq a$ if and only if $X_1 \geq a$ and so $\Pr(X_2 \leq a) = \Pr(X_1 \geq a)$, which gives the desired integrals. – Silverfish Apr 3 '16 at 23:25
• @RobertSmith Those are the areas which correspond to probabilities which must be same. – Kenny Lau Apr 4 '16 at 3:08

Denote with $U$ the random number you generate, then $U\sim U(0,1)$ and you want to determine the distribution of $Y=\frac{1}U$. So, for $1\le y<+\infty$, you have that $$F_{Y}(y)=P(Y\le y)=P(1/U\le y)=P(U\ge 1/y)=1-P(U<1/y)=1-F_U(1/y)$$ Hence $$f_Y(y)=\frac{d}{dy}F_Y(y)=\frac{d}{dy}\left(1-F_U(1/y)\right)=\frac1{y^2}f_U(1/y)=\frac1{y^2}\cdot1=\frac1{y^2}\mathbf{1_{y\ge1}}$$

• Nice solution!! – Kenny Lau Apr 3 '16 at 10:00