# What is the expectation of $e^X$, where $X$ is a random variable with a geometric distribution?

if $$X$$ is a random variable with a geometric distribution how can I calculate $$E(e^X)$$ I have no idea on how to do that.

• Have you tried applying a definition of expectation? It works nicely in this case.
– whuber
May 10, 2021 at 15:30
• Is this a question from a course or textbook? If so, please add the self-study tag & read its wiki. May 10, 2021 at 15:33
• @StephanKolassa Yes I have to find that for a course I follow, I didnt know the self-study tag, thank you, I'll add it. May 10, 2021 at 15:36
• @whuber I have tried but I dont know how to deal with the exponential. I am stuck at $E[e^X]=\sum_i^n e^i P(X=i)$, I dont know how to continue. May 10, 2021 at 15:38
• @JacK'o'Lantern What is $P(X = i)$ for a given i, when you know $X$ follows a geometric distribution? After you get that, what do you know about geometric series that can help you simplify the sum? Moreover, you want to check the range of your summation, it should cover the support of a geometric random variable. May 10, 2021 at 15:44

Building on the answer by @Stephan and comment by user whuber. First, there is two versions of the geometric distribution; for now I use the one with support $$0,1,2, \ldots$$ which has moment generating function (mgf) given by $$\DeclareMathOperator{\E}{\mathbb{E}} M_X(t)= \E e^{t X} =\frac{p}{1-(1-p)e^t}$$ which is valid for $$t < -\ln(1-p)$$. That gives an expression for the expectation of $$e^X$$ by setting $$t=1$$: $$\E e^X = M_X(1)=\frac{p}{1-(1-p)e^1}$$ but only for values of $$p$$ satisfying the restriction $$1 < -\ln(1-p)$$, that is $$p > 1- e^{-1}$$, when the probability is too small the waiting time for first success becomes to long and the expectation of its exponential becomes infinite. This is easy to see from calculating the expectation directly: $$\E e^X =\sum_0^\infty e^k \cdot (1-p)^k p = p\sum_0^\infty [ e(1-p) ]^k$$ and when the bracketed expression becomes 1 or larger the sum is infinite.

The moment-generating function of any random variable $$X$$ is defined as

$$M(t) := E(e^{tX}).$$

So you can simply take the MGF of whatever geometric distribution you are referring to from its Wikipedia page and evaluate it at $$t=1$$.

• Sort of: the problem is that for many geometric distributions, $M$ is not defined. It would be more useful to explain how to find $M$ and to show why it is not always defined, as well as to state what that implies for the answer to this question.
– whuber
May 10, 2021 at 15:31
• @whuber: you are, of course, right, and your approach is better, as almost always. To be honest, this does smell suspiciously like self-study... May 10, 2021 at 15:33
• I didn't even know what a moment-generating function is, but I'll take a look, thank you! May 10, 2021 at 15:40