I have a question that should have been trivial to solve, but for some reason I keep messing up. I need to calculate the following integral:
$$\int_0^x\lambda e^{-\lambda x}dx$$
I initially tried to solve this with the substitution:
$$u=-\lambda x$$
This leads to the following:
$$ \begin{aligned} x&=-\frac{u}{\lambda}\\ dx&=-\frac{du}{\lambda} \end{aligned}$$
My first (wrong) attempt:
$$ \begin{aligned} \int_0^x\lambda e^{-\lambda x}dx &= \lambda\int_0^{\frac{-u}{\lambda}} e^{u}\frac{-du}{\lambda}\\ & = -\int_0^{\frac{-u}{\lambda}} e^{u}du = -[e^u]_0^{\frac{-u}{\lambda}}\\ &= -[e^{\frac{-u}{\lambda}}-e^0] = 1 - e^{\frac{-u}{\lambda}} = 1 - e^x \end{aligned} $$
Online tools have shown that the answer is supposed to be $1 - e^{-\lambda x}$ however.
My second slightly modified attempt:
I reuse the steps from my first attempt all the way until I get:
$$-[e^u]_0^{\frac{-u}{\lambda}}$$
and now I replace the substitution first before continuing:
$$ \begin{aligned} -[e^u]_0^{\frac{-u}{\lambda}} &= -[e^{-\lambda x}]_0^x\\ & = -[e^{-\lambda x} - e^0]\\ & = 1 - e^{-\lambda x} \end{aligned} $$
What sorcery is this? I can't seem to recall a rule about substituting the variables back to the original before filling in the limits. Otherwise, what is the point of changing the limits along with the substitution? I must be missing something obvious here, but not obvious enough for me to notice.
Without substitution works without a problem:
$$ \begin{aligned} \int_0^x\lambda e^{-\lambda x}dx &= -[e^{-\lambda x}]_0^xdx\\ & = -[e^{-\lambda x} - 1]\\ &= 1 - e^{-\lambda x} \end{aligned} $$
Why was my first attempt wrong?
In your wrong attempt you wrote: $$\int_0^x\lambda e^{-\lambda x} \ \mathrm dx = \lambda\int_0^{\color{red}{\frac{-u}{\lambda}}} e^{u}\frac{-\mathrm du}{\lambda}$$ when in fact you should have written: $$\int_0^x\lambda e^{-\lambda x} \ \mathrm dx = \lambda\int_0^{\color{red}u} e^{u}\frac{-\mathrm du}{\lambda}$$
When changing the bounds, ask yourself "when $x$ = lower bound, what is $u$? when $x$ = upper bound, what is $u$?"
The answer is "when $x=0$, $u=0$; when $x=x$, $u=u$".