I was trying to solve the following:

Let $\lambda>0$ and $X$ a random variable with $X \sim exp(\lambda)$. Show that $Y=[X]+1$ has geometric distribution of parameter $p=1-e^{-\lambda}$, where $[x]$ denotes the integer part of a number.

I did the following:

$$P(Y=n)=P([X]+1=n)$$$$=P(n-1 \leq X <n)$$$$=F_X(n)-F_X(n-1)$$$$=1-e^{-\lambda n}-(1-e^{-\lambda (n-1)})$$$$=e^{-\lambda (n-1)}-e^{-\lambda n}$$$$=e^{-\lambda (n-1)}(1-e^{-\lambda})$$

If I call $p=1-e^{-\lambda}$, then we have $$P(Y=n)=(1-p)^{n-1}p$$

which is exactly the density function of a geometric random variable with parameter $p=1-e^{-\lambda}$.

I was having doubts with my solution, could anyone tell me if my answer is correct?

  • 2
    $\begingroup$ Your answer is correct. $\endgroup$
    – A.S.
    Commented Oct 16, 2015 at 5:09
  • 1
    $\begingroup$ Clearly explained, well done. $\endgroup$ Commented Oct 16, 2015 at 6:08

1 Answer 1


Thanks, the $p=1-e^{-\lambda}$ relation was helpful and seems correct. I verified with numpy. Maybe this helps someone.

Note: I replaced $\lambda$ by $-1/\beta$ ($beta$ = scale), since that is what np.random.exponential expects.

I also understand this is not an answer in typical StackExchange fashion, so feel free to delete if it does not belong.


import matplotlib.pyplot as plt
import numpy as np

N = 10000

for scale in [1,3,7]:
    p = 1 - np.exp(-1/scale)

    print(f"scale (β) (numpy parameter): {scale}")
    print(f"λ: {1/scale}")
    print(f"p: {p:.3f}")
    rvs1 = np.random.geometric(p=p, size=N)

    rvs2 = np.random.exponential(scale=scale, size=N)



enter image description here

One can see how nicely geometric and exponential line up.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .