2

I want to take this integral:

$$\int_{0}^{L}\int_{0}^{L} |x-y| \,dx\,dy$$

And set $u = |x-y|$ and convert this integral into something that only needs one integral. I don't know the correct way to do this. I can't just go:

$$\int_{0}^{L}\int_{0}^{L} u \,dx\,dy$$

or

$$\int_{0}^{L} u \,du$$

Somehow I need to fit $du$ in there and replace those two integrals with one, and then take into account anything else. For example I know $u$ will also go from $0$ to $L$ based on the possible values of $|x-y|$ but I don't know the right way to go about it.

3 Answers3

1

Note that $\sqrt{(x-y)^2} = |x-y| = \begin{cases}x-y & y < x < L\\ y-x & 0<x<y\end{cases}$.

Thus, $\displaystyle\int_0^L\int_0^L \sqrt{(x-y)^2}\,dx\,dy = \int_0^L\int_0^y (y-x)\,dx\,dy + \int_0^L\int_y^L (x-y)\,dx\,dy$.

Both of these integrals are straightforward to evaluate.


EDIT: The OP just clairified that he specifically wants to use a change of variables to get the answer instead of evaluating that integral in the easiest way possible.

Let's perform the substitution $u = x-y$, $v = x+y$. Then, $x = \frac{u+v}{2}$ and $y = \frac{-u+v}{2}$.

The Jacobian is $J(u,v) = \left|\begin{matrix}\frac{\partial x}{\partial u} & \frac{\partial x}{\partial v} \\ \frac{\partial y}{\partial u} & \frac{\partial y}{\partial v}\end{matrix}\right| = \left|\begin{matrix}\frac{1}{2} & \frac{1}{2} \\ -\frac{1}{2} & \frac{1}{2}\end{matrix}\right| = \dfrac{1}{2}$.

To get the bounds, draw a picture. If $0 \le x,y \le L$, then $-L \le x-y \le L$. So, $-L \le u \le L$.

For any fixed $u > 0$, the line $x-y = u$ intersects the square $0 \le x,y \le L$ at the points $(u,0)$ and $(L,L-u)$. Hence, $u \le x+y \le 2L-u$ if $u > 0$.

For any fixed $u < 0$, the line $x-y = u$ intersects the square $0 \le x,y \le L$ at the points $(0,-u)$ and $(L+u,L)$. Hence, $-u \le x+y \le 2L+u$ if $u < 0$.

This can be consolidated into $|u| \le x+y \le 2L-|u|$. Hence $|u| \le v \le 2L-|u|$.

Therefore, the change of variables gives us: $\displaystyle\int_0^L\int_0^L \sqrt{(x-y)^2}\,dx\,dy = \dfrac{1}{2}\int_{-L}^{L}\int_{|u|}^{2L-|u|} |u|\,dv\,du$

Since the inner integrand is constant w.r.t. $v$, this becomes $\displaystyle\dfrac{1}{2}\int_{-L}^{L}(2L-2|u|)|u|\,du$.

This is a single integral which can be easily evaluated.

JimmyK4542
  • 54,331
0

$$\int_0^L\sqrt{(x-y)^2}dx=\frac{x(x-2y)\sqrt{(x-y)^2}}{2(x-y)}{\huge{|}}_0^L=\frac{L(L-2y)\sqrt{(L-y)^2}}{2(L-y)}\\ \int_0^L\frac{L(L-2y)\sqrt{(L-y)^2}}{2(L-y)}dy=\frac12Ly\sqrt{(L-y)^2}{\huge|}_0^L=0$$

RE60K
  • 17,716
0

$$\int_{0}^{L}\int_{0}^{L} |x-y| \,dx\,dy=\int_{0}^{L}\Big(\int_{0}^{y} (y-x) \,dx+\int_{y}^{L} (x-y) \,dx\Big)\,dy=\int_0^L \big[ (\frac{1}{2}y^2)+(\frac{1}{2}L^2-Ly+\frac{1}{2}y^2)\big]\,dy=\int_{0}^{L}(y^2-L y+\frac{1}{2}L^2 )\,dy=\frac{1}{3}L^3$$ Well if you ought to use change of variable , which in my opinion is pointless in this particular case , then consider $\int_{0}^{L}\int_{0}^{y} (y-x) \,dxdy$ and $\int_{0}^{L}\int_{y}^{L} (y-x) \,dxdy.$

BigM
  • 3,936
  • 1
  • 26
  • 36