I came across this example:
$$\int_0^{+\infty}xe^{-x} \ dx$$
I calculated it like this:
$$\int_0^{+\infty} xe^{-x} \ dx = \left[ -xe^{-x} \right]_0^{+ \infty} - \int_0^{+ \infty} e^{-x}dx $$
$$ 0 - \left[ e^{-x} \right]^{+\infty}_0 = 0-0 = 0$$
$$ lim_{x \rightarrow \infty} \frac{x}{e^x}\biggr\vert^\beta_0 = \lim_{\beta \rightarrow \infty} \frac{\beta}{e^\beta} \quad L'H \\ lim_{\beta \rightarrow \infty} \frac{1}{e^\beta} = 0 \\ $$
But my sample solution says:
$$\int^{\infty}_0 xe^{-x} dx = \left[ - \frac{x}{e^x}-e^{-x}\right]\biggr\vert^\infty_0 = 0-0+1 = 1$$
I dont understand where the $1$ comes from, my understanding is that the limit of that function should go to zero but instead a $1$ appears.
Can someone clear this up ?
First of all, you seem to have made a typo, but this is not a problem because you seem to have fixed it after integrating $e^{-x}$: $$\begin{align}\int_0^{+\infty} xe^{-x} \ dx &= \left[ -xe^{-x} \right]_0^{+ \infty} \color{red}{+} \int_0^{+ \infty} e^{-x}dx \\&=\left[ -xe^{-x} \right]_0^{+ \infty}-\left[e^{-x}\right]_0^{+\infty}\\&=0-\left[e^{-x}\right]_0^{+\infty} \tag{1}\end{align}$$
Apart from that, the only mistake you made is when evaluating the right-hand side of $(1)$. Note that $e^0\neq 0$, but $e^0=1$, hence giving: $$\int_0^{+\infty} xe^{-x}~dx=0-(0-1)=1$$