(a) Let $X$ be an exponential random variable with parameter $\lambda$. Find the moment generating function of $X$.
(b) Suppose a continuous random variable $Y$ has moment generating function
$M_Y(s)= \frac{\lambda^2}{(\lambda-s)^2}$ for $s<\lambda$ and $M_Y(s)+\infty$ for $s\ge \lambda$.
Find the probability density function of $Y$.
So (a) is simple. Using $M_X(s)=E(e^{sx})=\int_0^\infty e^{sx}\lambda e^{-\lambda x }dx = \frac{\lambda}{\lambda-s }$ if $s<\lambda$ and $+\infty$ for $s\ge \lambda$.
For (b) I do see a relation between X and Y, that is, $M_Y(s)=(M_X(s))^2$.
Some of my ideas. If I derive $M_Y(s)$ I can obtain the expected value, but I am not sure as to how this can be helpful. I know that this requires manipulation of $M_X(s)$ but I also know that I cannot square the pdf of $X$. I would appreciate some help.
Recall that if $X$ has MGF $M_X(s)$, then $Y = \sum_{i=1}^n X_i$ where each $X_i \sim X$ is IID, then $$M_Y(s) = (M_X(s))^n.$$ The proof is simple: $$M_Y(s) = \operatorname{E}[e^{tY}] = \operatorname{E}[e^{t(X_1 + \cdots + X_n)}] = \operatorname{E}[e^{tX_1} e^{tX_2} \cdots e^{tX_n}] \overset{\text{ind}}{=} \prod_{i=1}^n \operatorname{E}[e^{tX_i}] = \prod_{i=1}^n M_{X_i}(s) = (M_Y(s))^n.$$ Therefore, if $M_Y(s) = M_X(s)^2$, $Y = X_1 + X_2$ where $X_1, X_2 \sim \operatorname{Exponential}(\lambda)$; that is to say, $Y$ is gamma distributed with shape $2$ and rate $\lambda$ (if $X$ was parametrized by rate as well).
For additional details, please refer to the following post: Gamma distribution out of sum of exponential random variables.