Is there any way to test a moment generating function_ [closed]

Like isnt there way to put the function value inside and then I would get the same value as the uniform probability function? closed as off-topic by Lee David Chung Lin, zz20s, Eevee Trainer, Thomas Shelby, LeucippusMar 26 at 5:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – Lee David Chung Lin, zz20s, Eevee Trainer, Leucippus
If this question can be reworded to fit the rules in the help center, please edit the question.

The mgf is given by $$M_X(t) = \mathbb{E}\left[e^{tX}\right] = \int_\mathbb{R} e^{tx} f(x)\ dx,$$ so $$M_X(0) = 1$$ and $$M_X'(0) = \mathbb{E}[X]$$ which is a quick shortcut you can use to check things. In your case, $$\mathbb{E}[X] = 1/2$$ by symmetry.
But if you want a formal calculation, your way is correct, namely that $$M_X(t) = \int_\mathbb{R} e^{tx} f(x)\ dx = \int_0^1e^{tx} dx = \frac{e^t-1}{t}$$ The above spot-check is easy to make since $$M_X'(t) = e^t t^{-1} - \left(e^t-1\right)t^{-2} = \frac{(t-1)e^t+1}{t^2}$$ and it's easy to see by L'Hospital's Rule (twice) that $$M_X'(t) \to 1/2$$ as $$t \to 0$$...