Why does this double integral give me different answers when evaluated in different ways?

142 Views Asked by At

MWE: Evaluate $\int\limits_0^1\int\limits_0^4 (x-y)xy\,dx\,dy$. We have
$\int\limits_0^1\int\limits_0^4 (x-y)xy\,dx\,dy=\int\limits_{x=0}^1\left \{ \int\limits_{y=0}^4 (x-y)xy\, dy \right\}\, dx=-8$
On the other hand,
$\int\limits_0^1\int\limits_0^4 (x-y)xy\,dx\,dy=\int\limits_{y=0}^1\left \{ \int\limits_{x=0}^4 (x-y)xy\, dx \right\}\, dy=8$

What is the correct way and where am I going wrong?

1

There are 1 best solutions below

0
On

You're integrating over different regions. The correct one is the one which gives 8, since you kept the order of the variables with respect to which you're integrating as they are. In the other case, you swapped them.

The question asks you to find $$\int_0^1\int_0^4 f(x,y)\,dx\,dy$$which means $$\int_{y=0}^{y=1}\left(\int_{x=0}^{x=4}f(x,y)\,dx\right)\,dy$$This represents integrating over the $\color{red}{\text{red}}$ region shown below.

What about $\int_{x=0}^{x=1}\left(\int_{y=0}^{y=4}f(x,y)\,dy\right)\,dx$?

This is integrating the function over the $\color{blue}{\text{blue}}$ region, which is different.

enter image description here

If you had swapped the integral limits along with the variables, i.e. as $$\int_0^4\left(\int_0^1 f(x,y)\,dy\right)\,dx$$then this would have been correct, as pointed out in the comments to the question. This is because you are still integrating over the same region if you swap both things (the order of integration variables, and the limits).