This is an extension of another question.
Let $X_1$ and $X_2$ be independent exponential random variables such that
$$ f(x_1) = \begin{cases} \frac{1}{\beta}e^{-\frac{x_1}{\beta}}, & x>0 \\ \text{and } 0 & \text{elsewhere} \end{cases} $$
$$ f(x_2) = \begin{cases} \frac{1}{\beta}e^{-\frac{x_2}{\beta}}, & x>0 \\ \text{and } 0 & \text{elsewhere} \end{cases} $$
Define $W_1 = X_1 + X_2$. My goal is to find the marginal density of $W_1$. Since $X_1$ and $X_2$ are independent, their joint density is just the product of their marginal. In order to use the Jacobian change of variable method, I need an injective function between $X_1$, $X_2$ and $W_1$. Therefore, I define $W_2 = X_1$. Then, $(W_1, W_2) = \phi(X_1, X_2) = (X_1+X_2, X_1)$. Then $\phi^{-1}(W_1, W_2) = (W_1 - W_2, W_2)$
The determinant of the Jacobian of $\phi^{-1}(W_1, W_2)$ is $-1$. Therefore, the joint-density of $(W_1, W_2)$ is
$$P(W_1, W_2) = \frac{1}{\beta^2}e^{-\frac{W_1 - W_2 + W_2}{\beta}} = \frac{1}{\beta^2}e^{-\frac{W_1}{\beta}}$$
To get the marginal density of $W_1$, I will integrate the previous expression w.r.t $W_2$ from $0$ to $\infty$, but that gives infinity. Please tell me where went wrong.
Following @Andrew Zhang's comment, the issue is with not having an indicator function. The joint density should be the following:
$$ P(W_1, W_2) = \frac{1}{\beta^2}e^{-\frac{W_1}{\beta}} I(W_1 > 0) I(0 < W_2 < W_1) $$
Then, integrating w.r.t $W_2$ would give $\frac{W_1}{\beta^2}e^{-\frac{W_1}{\beta}} I(W_1 > 0)$, which is the correct marginal density for $W_1$.