Show that $E(x)=M'_X(0)$, where $M'_X(p)=\frac{dM_X(p)}{dp}$ I am going through some more exam practice questions for my stats class - Here is the complete question, it has two parts:

Let $X$ be a continuous random variable with known probability density function (pdf) $f_X(x)$ for $-\infty < x < \infty$ and let $M_X(p)=E(e^{pX}) $ be a real valued function of $p.$
(a) Write down $M_X(p)$ as an integral involving the pdf $f_X(x)$ and $e^{pX}.$
(b) Show that $E(x)=M'_X(0)$, where $M'_X(p)=\frac{dM_X(p)}{dp}.$

Here is what I have so far:
(i) Seems pretty straightforward from the definition of $E(g(x))$. I simply have:
$$E(e^{pX}) = \int^{p}_{-\infty}e^{pX}f_X(x) dx.$$
(b) For part b, I am a little stuck. From (a), I have that
$$M'_X(p)=\frac{d}{dp} M_X(p)=\frac{d}{dp}E(e^{pX})=\frac{d}{dp}\int^{p}_{-\infty}e^{pX}f_X(x) dx.$$
Is there a theorem similar to the fundamental theorem of calculus for taking the derivative of an improper integral?
The way I have tried to evaluate this is:
$$\frac{d}{dp}\left( \lim_{b \to -\infty}\int^{p}_{b}e^{pX}f_X(x) dx\right).$$
Now I am a little stuck. I know that the definition of $E(x) = \int^{\infty}_{-\infty}xf_X(x)dx$, but when I try to integrate the above improper integral I don't think I am getting anywhere but making it more complicated. Am I even on the right track? I feel like I am making it more complicated than it is supposed to be.
Any help would be greatly appreciated!
 A: $$
  (1) \quad M_X(t) = \mathrm{E}\left[e^{tX}\right] = \int_{-\infty}^\infty e^{tx} f_X(x)\,dx \quad 
$$
$$
  (2) \quad M'_X(t) = \frac{d}{dt} \int_{-\infty}^\infty e^{tx} f_X(x)\,dx = \int_{-\infty}^\infty \frac{d}{dt} e^{tx} f_X(x)\,dx = \int_{-\infty}^\infty x\,e^{tx} f_X(x)\,dx
$$
$$
  M'_X(0) = \int_{-\infty}^\infty x\,f_X(x)\,dx = \mathrm{E}[X]
$$
Reasons: The second equality in (1) is due to the theorem known folklorically as the Law of the Unconscious Statistician; In (2) the derivation under the integral sign is justified by the Dominated Convergence Theorem.
A: You have an error:
$$Ee^{pX}=\int_{-\infty}^{\infty}e^{px}f_X(x)dx$$
Note the limits of integration, you had them wrong. This way you can differentiate under integral. Of course there are conditions, when you can do this exactly, but you can assume that they are met. 
The fact that you are integrating over infinite interval is a complication, but still everything depends on the properties of $exp$ and $f_X$. I.e. as long as the integral is differentiable function and some additional smoothness properties (probably), you can differentiate inside the integral.
