# Does the order of integration in indefinite integral matters?

I have a function f of four variables. x1, x2, x11 and x22 like this

f = (-(x1 - x11)^4 - 6 (x1 - x11)^2 (x2 - x22)^2 + 3 (x2 - x22)^4)/(
4 Pi ((x1 - x11)^2 + (x2 - x22)^2)^3);


I want to calculate the indefinite integral, but it seems that order of integration in this particular case matters.

If I try with two different orders of integration, i get different results:

Case 1 :

FullSimplify@Integrate[f, x1, x2, x11, x22]


Case 2 :

FullSimplify@Integrate[f, x22, x11, x2, x1]


I taught that order of integration in indefinite integrals does not matter. How should this problem be tackled?

This is the problem that I'm trying to figure out. I don't understand how were these functions integrated.

• "indefinite integrals" are not functions, but equivalence classes of functions. It is better to use definite integrals only, unless you really understand what you are doing. Your different expressions are all equal modulo something closed. Stick to definite integration, and everything will always work out just fine. Indefinite integration doesn't exist -- it is not a thing. Commented Mar 20, 2020 at 12:08
• Thank you for your answer AFT. But I need to get functions from this integral, I included the page of an article that I'm trying to understand. Can you please take a look and say what you think. Commented Mar 20, 2020 at 12:34
• Note that the important equation, (39), is a definite integral. Indefinite integrals are never unique; but, if you evaluate the definite integral using any of them, you should get the same result (provided you didn't make an algebraic mistake). That being said, multidimensional integrals are not to be evaluated using Barrow's theorem. The indefinite integral is useless. I wouldn't really trust this paper (note that they say the indefinite integral is singular; this is a meaningless statement: you can always add something closed and singular to any indefinite integral!) Commented Mar 20, 2020 at 13:25
• Thx, a lot. What you said definitely cleared a lot of questions I had. Commented Mar 20, 2020 at 14:24

Clear["Global*"]

f = (-(x1 - x11)^4 - 6 (x1 - x11)^2 (x2 - x22)^2 +
3 (x2 - x22)^4)/(4 Pi ((x1 - x11)^2 + (x2 - x22)^2)^3);


An indefinite integral, i.e., antiderivative is not unique

ad1 = FullSimplify@Integrate[f, x1, x2, x11, x22]

(* (1/(16 \[Pi]))(3 (x1 - x11)^2 -
8 (x1 - x11) (x2 - x22) ArcTan[(x1 - x11)/(
x2 - x22)] + (-3 (x1 - x11)^2 + (x2 - x22)^2) Log[(x1 - x11)^2 + (x2 -
x22)^2]) *)


Verifying that ad1 is a valid antiderivative of f

f == D[ad1, x1, x2, x11, x22] // Simplify

(* True *)


The order of differentiation does not matter

Simplify[f == D[ad1, Sequence @@ #]] & /@
Permutations[{x1, x2, x11, x22}]

(* {True, True, True, True, True, True, True, True, True, True, True, True, \
True, True, True, True, True, True, True, True, True, True, True, True} *)


Similarly,

ad2 = FullSimplify@Integrate[f, x22, x11, x2, x1]

(* (1/(16 \[Pi]))(-(x2 - x22)^2 +
8 (x1 - x11) (x2 - x22) ArcTan[(x2 - x22)/(
x1 - x11)] + (-3 (x1 - x11)^2 + (x2 - x22)^2) Log[(x1 - x11)^2 + (x2 -
x22)^2]) *)


Verifying that ad2 is a valid antiderivative of f

f == D[ad2, x22, x11, x2, x1] // Simplify

(* True *)


Again, the order of differentiation does not matter

Simplify[f == D[ad2, Sequence @@ #]] & /@
Permutations[{x1, x2, x11, x22}]

(* {True, True, True, True, True, True, True, True, True, True, True, True, \
True, True, True, True, True, True, True, True, True, True, True, True} *)
`