# How do I convert the following double integral to a single integral

I have a double integral $$I=\int_0^a\int_0^bf(x-y)\,\mathrm{d}x\,\mathrm{d}y~,$$ where the function $f$ depends only on the difference between two variables $x$ and $y$. I would like to change the above double integral into a single one. Here is my attempt: \begin{align} I&=\int_0^a\int_0^af(x-y)\,\mathrm{d}x\,\mathrm{d}y+\int_0^a\int_a^bf(x-y)\,\mathrm{d}x\,\mathrm{d}y\\ &=2\int_0^a(a-x)f(x)\,\mathrm{d}x+\int_0^a\int_a^bf(x-y)\,\mathrm{d}x\,\mathrm{d}y \end{align} Now I am stuck on how to deal with the secong dobule integral. Any ideas?

Edit: Note that I am interested in the case when the function $f(x)$ is even in $x$.

• Yes. Sorry about that! – konstant Aug 17 '16 at 10:30
• Do we know that $a\leq b$ ? – onurcanbektas Aug 17 '16 at 12:37
• I think that does not matter, but let's say yes. – konstant Aug 17 '16 at 12:49
• @konstant, why would you say it doesn't matter? It does. Anyway, you should've given all relevant information about your problem, even if you think it doesn't matter – Yuriy S Aug 17 '16 at 20:51
• If $a=b$, this is $$I=\int_{-a}^a(a-|u|)\,f(u)\,du.$$ If $a\ne b$, a similar, more complicated, formula holds. Anyway: draw a picture... – Did Aug 18 '16 at 15:16

You can treat this integral as an integral over a region of the Cartesian plane rather than as one single-parameter integral inside another, and it is useful to do so.

To check the work you've done so far, let's consider the case of your integral when $a=b=1$. Then the region of integration is the unit square. If $f$ is even, then every region below the diagonal is matched by a symmetric region above the diagonal, so we can take twice the integral below the diagonal to get the integral over the square. This then agrees perfectly with what you already found, although it depends on the function being even and (as you noted) it leaves an inconvenient region still to be integrated if $a\neq b$.

The following method can be adapted to integrate your leftover region, but I think that is as much work as just applying it to the entire original region of integration, so I will do the entire region. Treating your double integral as an integral over a region in the plane, you want to integrate $f(x-y)$ over the rectangle with vertices at $(0,0)$, $(0,a)$, $(b,a)$, and $(b,0)$. Transforming the plane according to the rule $(x,y) \mapsto (x-y, y)$, your original integral is equal to the integral of $f(x)$ over the parallelogram with vertices at $(0,0)$, $(-a,a)$, $(b-a,a)$, and $(b,0)$. You can rewrite that as three integrals over functions of $x$ alone, or if you like, as one integral over a function of $x$ defined piecewise using $f(x)$.

One of the three integrals comes from integrating $f(x)$ over the region of integration to the left of the $y$ axis. This region is the triangle with vertices at $(0,0)$, $(-a,a)$, and $(0,a)$, its cross-section along the line $x=c$ is $c+a$, and the integral is $$\int_{-a}^0 (x+a)f(x)\,\mathrm{d}x.$$ This is equal to the integral $$\int_0^a(a-x)f(x)\,\mathrm{d}x$$ from your calculations, which of course it must be since it's the integral of $f(x-y)$ over the part of the original rectangular region of integration above the line $y=x$. The other two integrals over $f(x)$ are the integral over the rectangular subregion between $x=0$ and $x=b-a$ and the third is the triangle to the right of the line $x=b-a$.

If $f$ is even, you can assume $b>a$ without loss of generality (although it appears you were already aware of that). This makes the procedure above a little easier than in the more general case ($f$ not even) since you do not have to be concerned about the regions to use if $a<b$.

• Ok. You made a good point through the example that the integral in the case when $f(x)=x$ is zero, which tells me the question need a bit more of clarification. The function $f(x)$ is even in $x$, thus your example $f(x)=x$ is not applicable for me. But, thanks for pointing that out. – konstant Aug 17 '16 at 12:01
• could you please write your last paragraph mathematically? – konstant Aug 17 '16 at 13:10
• So with your comment I would conclude that the answer is $2\int_0^{a}(a-x)f(x)dx+2\int_0^{b-a}(b-a-x)f(x)dx$. Unfortunately, if you take an example $f(x)=1/(1+x^2)$, the numerical value obtained from this expression will not be the same as from original expression. – konstant Aug 18 '16 at 8:35
• That's not what I had in mind. I said a triangle, a rectangle, then another triangle. Nowhere did I recommend to multiply anything by $2$. – David K Aug 18 '16 at 17:08