# Find probability given moment generating function?

So, I have a question that asks me to find the probability $P(Y<2)$ if $Y$ has a moment generating function $$M_Y(t) = (1-p+pe^t)^5$$

Is this a special distribution? Is there a trick I'm missing? Solving it algebraically/ with calculus gets really messy

## 2 Answers

Suppose $$M_X(t) = 1-p+p\exp(t)=(1-p)\exp(0t)+p\exp(1t)$$

Hence $X$ is a Bernoulli distribution with success probability $p$.

It is raised to the power of $5$, $M_Y(t)=\prod_{i=1}^5M_{X_i}(t)=M_{\sum_{i=1}^5X_i}(t)$ means $5$ independent Bernoulli trials are sum up, Hence $Y$ is a binomial distirbution with $5$ trials and success probabiity $p$.

# Method 1: Genarally analysing MGF

we have $$M_Y(t)= (1-p+pe^t)^5$$ if we put 1-p=q or supposing p+q=1 we will get'

$$M_Y(t)=(q+pe^t)^5$$

we know that binomial random variable have MGF $$M_Y(t)=(q+pe^t)^n$$ after matching the corresponding terms with our give MGF we get n=5 hence

$$Y\sim Bin (5,p)$$ so $$P(Y<2)=P(Y=0)+P(Y=1)$$ $$\Rightarrow P(Y<2)= \binom{5}{0}p^0(1-p)^5+\binom{5}{1}p^1(1-p)^4$$

$$\Rightarrow P(Y<2)=4p^5-15p^4+20p^3-10p^2+1$$

Now put your value of p (i.e generally called probability of success) and get your answer

# Method 2 : By generating function method

we know that

$$M_Y(log_e(t))= G_Y(t)$$

where $$M_Y(\bullet)$$ denotes Moment generating function of Y and $$G_Y(\bullet)$$ represents generating function of Y, So we have to generally replace $$t$$ by $$log_e(t)$$ by doing that with the MGF you have given we will get

$$M_Y(log_e(t))=(1-p+pe^{log_et})^5$$

$$G_Y(t)=(1-p +pt)^5$$ $$G_Y(t)=p^5 t^5 - 5 p^5 t^4 + 10 p^5 t^3 - 10 p^5 t^2 + 5 p^5 t - p^5 + 5 p^4 t^4 - 20 p^4 t^3 + 30 p^4 t^2 - 20 p^4 t + 5 p^4 + 10 p^3 t^3 - 30 p^3 t^2 + 30 p^3 t - 10 p^3 + 10 p^2 t^2 - 20 p^2 t + 10 p^2 + 5 p t - 5 p + 1$$

as we know that $$G_Y(t)=p_0+p_1t+p_2t^2\ldots\ldots\ldots\ldots$$

where

$$p_0 = P(Y=0)$$

$$p_1= P(Y=1)$$

$$p_2=P(Y=2)$$

$$\cdots$$

$$\cdots$$

as in our Generating function we can see that $$p_0= - p^5+5 p^4 - 10 p^3 +10 p^2- 5 p + 1=P(Y=0)= constant \;term \;in\;G_Y(t)$$

$$p_1= 5 p^5- 20 p^4 +30 p^3- 20 p^2+5p =P(Y=1)= coefficient\; of\; t\; in\; G_Y(t)$$

so we have to find $$P(Y<2)=P(Y=0)+P(Y=1)$$ which is $$P(Y<2)=p_0+p_1$$ $$\Rightarrow P(Y<2)=(- p^5+5 p^4 - 10 p^3 +10 p^2- 5 p + 1)+(5 p^5- 20 p^4 +30 p^3- 20 p^2+5p)$$

$$\Rightarrow P(Y<2)=4p^5-15p^4+20p^3-10p^2+1$$

Here method 2 is lengthy but you should keep this method in mind because in some problems it is not lengthy and it is easy , here another thing that you should notice that t have not any negative powers it means probability of negative do not exist here but in some problems where t have any negative powers there probability for negative exists