text: Q:
  
  integral found in a moment generating function
  
  In Statistics and Data Analysis by Tamhane I found this integral in chapter 2 used for calculating the moments of an exponential function. Can someone explain how this integral works? I don't understand how the 2nd step leads to the last step.
  for $ t < \lambda $
  $M_x(t) = \int_{0}^{\infty} e^{tx}\lambda e^{-\lambda x}dx$
  $ = \lambda \int_{0}^{\infty} e^{-(\lambda - t) x}dx$
  $ = \frac{\lambda}{\lambda - t}$
  
  A:
  
  $\lambda$ is a constant, you can take it out from the integral.
  Then use exponential properties:
  $$\large e^{tx} e^{-\lambda x} = e^{tx - \lambda x} = e^{x(t - \lambda)} = e^{-(\lambda - t)x}$$
  Now you can call $\lambda - t = z$ which is a constant and get by elementary analysis
  $$\int e^{-zx} dx = -\frac{1}{z}e^{-zx} + C$$
  Which in your case becomes
  $$\lambda\left(-\frac{1}{\lambda - t} \large e^{-x(\lambda -t)}\bigg|_0^{+\infty}\right) = -\frac{\lambda}{\lambda - t} \left(e^{-\infty(\lambda - t)} - e^{0(\lambda - t)}\right) =  \frac{\lambda}{\lambda - t}$$
  For the records: I know that writing $\infty$ is wrong, but in this way the OP will understand better. It's clearly understood that it's a limit, as $x\to +\infty$.
  
  