Why can’t Wolfram Alpha compute this integral

expected valueintegrationstatisticswolfram alpha

$$\int_0^\infty \int_0^\infty \lambda_1\lambda_2 \mid{x – y} \mid e^{-\lambda_1x – \lambda_2y} dy dx$$

$$= \int_0^{\infty} e^{-\lambda_1x}\bigg[ \int_0^x(x – y)e^{-\lambda_2y}dy + \int_x^\infty(y – x)e^{-\lambda_2y}dy\bigg] dx$$

It seems like a straight forward but tedious integral to compute. Is there a way I can input this so that Wolfram is less confused by $x$ and $y$ being treated as variables and constants in different situations? Also Is there a way to specify that $\lambda_1$ and $\lambda_2$ are positive constants?

I replaced $\lambda_1$ and $\lambda_2$ with $\pi$ and $e$ and it gave me an answer.

Best Answer

The problem is that you're not telling WolframAlpha that $\lambda_1$ and $\lambda_2$ are positive. If you don't tell it this, it assumes they could be any real number (or even complex), so it doesn't know if the integral is convergent. To fix this, use the Assumptions option in Integrate like this:

Integrate[a*b*Abs[x-y]Exp[-a*x-b*y], {x, 0, Infinity}, {y, 0, Infinity}, Assumptions -> a>0 && b>0]

And it will give the correct answer: $(a^2+b^2)/[ab(a+b)] = a^{-1} + b^{-1} - 2(a+b)^{-1}$.

Related Question