# Integrating the derivative of a function does not give expected result [closed]

I was trying to do the following integral:

f[z_]:=Hypergeometric2F1[1,-a,1-a,1/(1-z)]/((1-z)^a-1)
Integrate[D[f[z],z],z]


I thought the result should be f[z] itself. But it turns out that Mathematica is not able to do the integral: Is it normal that Mathematica is not able to do such thing? Is there anything I can do to make it able to do the integral?

• Quiet@Integrate[Evaluate[D[f[z], z] // FullSimplify], z] – Dr. belisarius Dec 26 '15 at 15:38
• @Dr.belisarius, I tried your command, but it's still not able to do the integral. – Nahc Dec 26 '15 at 15:41
• Dr. belisarius method works for me (Mathematica 10.3.1). Call the result int. Then evaluate FullSimplify[int == f[z]] and obtain output True, – murray Dec 26 '15 at 16:00
• @murray Also works here, v9 – Dr. belisarius Dec 26 '15 at 16:11
• @Dr.belisarius That works for me now, thank you. I'm now trying to calculate f[z_]:=(1-z)^a Hypergeometric2F1[1,-a,1-a,1/(1-z)]/((1-z)^a-1) Integrate[D[f[z],z],z]. And it seems that your method doesn't work for this case. – Nahc Dec 26 '15 at 16:57

\$Version

(*  "10.3.1 for Mac OS X x86 (64-bit) (December 9, 2015)"  *)

f[z_] = Hypergeometric2F1[1, -a, 1 - a, 1/(1 - z)]/((1 - z)^a - 1);

f2[z_] = Integrate[D[f[z], z] // FullSimplify, z] // Quiet

(*  -((a*(1/(1 - z))^a*Beta[1/(1 - z),
-a, 0])/(-1 + (1 - z)^a))  *)

f3[z] = f2[z] // FullSimplify

(*  Hypergeometric2F1[1, -a, 1 - a,
1/(1 - z)]/(-1 + (1 - z)^a)  *)

f[z] == f2[z] == f3[z] // FullSimplify

(*  True  *)


EDIT: to address OP's question in comment. I do not know why changing the sign makes the problem harder for Mathematica; however, there is a straightforward workaround.

f4[z_] = -Hypergeometric2F1[1, -a, 1 - a, 1/(1 - z)]/((1 - z)^a - 1);

f5[z_] = -Integrate[D[-f4[z], z] // FullSimplify, z] // Quiet

(*  (a (1/(1 - z))^a Beta[1/(1 - z), -a, 0])/(-1 + (1 - z)^a)  *)

f6[z] = -(-f5[z] // FullSimplify)

(*  -(Hypergeometric2F1[1, -a, 1 - a, 1/(1 - z)]/(-1 + (1 - z)^a))  *)

f4[z] == f5[z] == f6[z] // FullSimplify

(*  True  *)

• That works for me, thank you. But if I add a minus sign in f[z] (f[z_] = -Hypergeometric2F1[1, -a, 1 - a, 1/(1 - z)]/((1 - z)^a - 1)) then it does't work. Do yo know why? – Nahc Dec 26 '15 at 17:28
• @HChan - see edit above. – Bob Hanlon Dec 26 '15 at 17:45