I am trying to prove Cauchy's identity with Mathematica ResourceFunction["IntegrateByParts"]. It doesn't seem to work with definite integration. Cauchy's identity says: $$ \int_{a}^{x}dz\int_{a}^{z}dy f(y)=\int_{a}^{x} (x-y)f(y)dy $$ To prove Cauchy's identity I introduce a function F[z_] -> Inactive[Integrate][f[y], {y, a, z}]. Then, using IntegrateByParts on F[z], and applying the substitution rule F'[z] -> f[z] yields:

ResourceFunction["IntegrateByParts"][ F[z], {z, a, x}];
% /. {F[z_] -> Inactive[Integrate][f[y], {y, a, z}]};
% /. F'[z_] -> f[z] // Activate

This is not the expected result from Cauchy's identity. How can the IntegrationByParts be modified to work and verify Cauchy's identity?


1 Answer 1


I think it's a bug of ResourceFunction["IntegrateByParts"]. The output of

ResourceFunction["IntegrateByParts"][F[z], {z, a, x}]


-F[a] + F[x] - Inactive[Integrate][z Derivative[1][F][z], {z, a, x}]

but clearly the correct output should be

-a F[a] + x F[x] - Inactive[Integrate][z Derivative[1][F][z], {z, a, x}]

By checking the source code (it can be found by DirectoryName@FindFile@"ResourceFunctionHelpers`" <> "\\IntegrateByPart.wl" // SystemOpen, at least on Windows 10), there seems to be a mistake in the definition of makeResult. The

Subtract@@(f /. {{x -> hi}, {x -> lo}})

should be modified to

Subtract@@(u v /. {{x -> hi}, {x -> lo}})

With this correction, your code will give the desired result. BTW the code can be simplified to

ResourceFunction["IntegrateByParts"][F[z], {z, a, x}]
% /. F -> Function[z, Inactive[Integrate][f[y], {y, a, z}]]
% // Activate
  • 1
    $\begingroup$ Thanks! This looks good. But I can't check the source code, I get $Failed when running DirectoryName@FindFile@"ResourceFunctionHelpers`" <> "\\IntegrateByPart.wl" // SystemOpen. Am I missing something? $\endgroup$
    – Ferca
    Jul 15, 2020 at 10:32
  • $\begingroup$ @Ferca Which system are you in? Does $UserBasePacletsDirectory <> "\\Repository\\ResourceFunctionHelpers-1.3.1\\Kernel\\IntegrateByPart.wl" // SystemOpen work? Can you find a IntegrateByPart.wl file under $UserBasePacletsDirectory? $\endgroup$
    – xzczd
    Jul 15, 2020 at 10:43
  • $\begingroup$ I am running a Mathematica (V notebook in a Mac OS X x86. The filenames I get after running $UserBasePacletsDirectory are {"Configuration", "Repository", "Temporary"}. The command $UserBasePacletsDirectory <> "\\Repository\\ResourceFunctionHelpers-1.3.1\\Kernel\\\ IntegrateByPart.wl" // SystemOpenalso gives me $Failed $\endgroup$
    – Ferca
    Jul 15, 2020 at 10:55
  • $\begingroup$ @Ferca I'm on Windows 10 so can't test, but can you visit the directory outside of Mathematica? $\endgroup$
    – xzczd
    Jul 15, 2020 at 11:03
  • 1
    $\begingroup$ @Ferca The directory is hidden on Windows, I guess it's similar on Mac OS X. $\endgroup$
    – xzczd
    Jul 15, 2020 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.