I am trying to prove that if $X$ and $Y$ have the same distribution, then they have the same moment generating function: $M_X(t) = M_Y(t)$ for all $t \in \mathbb{R}$. I came up with a proof, but am not sure if it is correct:
Suppose $X$ and $Y$ have the same distribution $F$. Then, the moment generating function for $X$ and $Y$ is: $M_X(t) = E(e^{tX})$ and $M_Y(t) = E(e^{tY})$.
Now, for the general case:
$$ M_X(t) = \int_{-\infty}^{\infty}e^{tx}dF(x). $$ and $$ M_X(t) = \int_{-\infty}^{\infty}e^{ty}dF(y). $$
But, since these two integrals differ only by indices, $M_X(t) = M_Y(t)$ for all $t \in \mathbb{R}$.
I tried looking into a proof by contradiction but was not able to formulate one. The above seems a bit too simple, does anyone have any ideas as to if it is correct or alternate proofs? Thanks!