# Integrating with indicator functions

I want to evaluate $$\int_{-\infty}^{\infty}(A_1e^{-\beta_1(b-x-y)}+B_1e^{-\beta_2(b-x-y)})(pn_1e^{-n_1y}1_{\{y\geq0\}}+qn_2e^{n_2y}1_{\{y<0\}})dy,$$ $b>x, \beta_1<n<\beta_2$. I am trying to get $$A_1e^{-\beta_1(b-x)}(\dfrac{pn_1}{n_1-\beta_1}+\dfrac{qn_2}{n_2+\beta_1})+B_1e^{-\beta_2(b-x)}(\dfrac{pn_1}{n_1-\beta_2}+\dfrac{qn_2}{n_2+\beta_2})-pe^{-n_1(b-x)}(\dfrac{A_1n_1}{n_1-\beta_1}+\dfrac{B_1n_1}{n_1-\beta_2}-1)$$ First I write my integrand as $I_1+I_2$ where \begin{align} I_1=(A_1pn_1e^{-\beta_1(b-x)}e^{(\beta_1-n_1)y}+B_1pn_1e^{-\beta_2(b-x)}e^{(\beta_2-n_1)y})1_{\{y\geq0\}}\\ I_2=(A_1qn_2e^{-\beta_1(b-x)}e^{(\beta_1+n_2)y}+B_1qn_2e^{-\beta_2(b-x)}e^{(\beta_2+n_2)y})1_{\{y<0\}} \end{align} Then $$\int_{-\infty}^{\infty}I_1+I_2=\int_{-\infty}^{b-x}I_1+I_2+\int^{\infty}_{b-x}I_1+I_2$$ Then $$\int_{-\infty}^{b-x}I_1+I_2=\int_0^{b-x}A_1pn_1e^{-\beta_1(b-x)}e^{(\beta_1-n_1)y}+B_1pn_1e^{-\beta_2(b-x)}e^{(\beta_2-n_1)y}+\int_{-\infty}^0A_1qn_2e^{-\beta_1(b-x)}e^{(\beta_1+n_2)y}+B_1qn_2e^{-\beta_2(b-x)}e^{(\beta_2+n_2)y}$$ After evaluation I get $$\int_0^{b-x}A_1pn_1e^{-\beta_1(b-x)}e^{(\beta_1-n_1)y}+B_1pn_1e^{-\beta_2(b-x)}e^{(\beta_2-n_1)y}=pe^{-n_1(b-x)}(\dfrac{A_1n_1}{\beta_1-n_1}+\dfrac{B_1n_1}{\beta_2-n_1})-\dfrac{A_1n_1p}{\beta_1-n_1}e^{-\beta_1(b-x)}-\dfrac{B_1n_1p}{\beta_2-n_1}e^{-\beta_2(b-x)}$$ and $$\int_{-\infty}^0A_1qn_2e^{-\beta_1(b-x)}e^{(\beta_1+n_2)y}+B_1qn_2e^{-\beta_2(b-x)}e^{(\beta_2+n_2)y}=\dfrac{A_1n_2q}{\beta_1+n_2}e^{-\beta_1(b-x)}+\dfrac{B_1n_2q}{\beta_2+n_2}e^{-\beta_2(b-x)}$$ So that when I add I get $$A_1e^{-\beta_1(b-x)}(\dfrac{pn_1}{n_1-\beta_1}+\dfrac{qn_2}{n_2+\beta_1})+B_1e^{-\beta_2(b-x)}(\dfrac{pn_1}{n_1-\beta_2}+\dfrac{qn_2}{n_2+\beta_2})-pe^{-n_1(b-x)}(\dfrac{A_1n_1}{n_1-\beta_1}+\dfrac{B_1n_1}{n_1-\beta_2})$$which is slightly different in the last term with -1 missing