this might equally be a question for our friends from Math.StackExchange

I wanted to verify with Mathematica the analytical result of the derivative of a formula involving several $_{2}F_{1}$ functions. However, the numerical comparison of my calculations with Mathematica's output differ.

The formula reads

$\tilde{\Psi}(x) = x^{2-c} \left( \frac{_{2}F_{1}\left(\frac{3-c}{a}, \frac{b-c}{a}, \frac{3-c+a}{a}, -x^a\right)}{3-c} - \frac{_{2}F_{1}\left(\frac{2-c}{a}, \frac{b-c}{a}, \frac{2-c+a}{a}, -x^a\right)}{2-c} \right) + \frac{\Gamma\left(\frac{2-c}{a}\right)\Gamma\left(\frac{b-2}{a}\right)}{a\Gamma\left(\frac{b-c}{a}\right)}$

I calculated analytically its derivative (wrt to x) and I obtained

$\frac{\textrm{d}\tilde{\Psi}}{\textrm{d}x} = (2-c)x^{1-c}\left( \frac{_{2}F_{1}\left(\frac{3-c}{a}, \frac{b-c}{a}, \frac{a-c+3}{a}, -x^a\right)}{3-c}- \frac{_{2}F_{1}\left(\frac{2-c}{a}, \frac{b-c}{a}, \frac{a-c+2}{a}, -x^a\right)}{2-c} \right) + + (b-c)x^{a-c+1}\left( \frac{_{2}F_{1}\left(\frac{2-c+a}{a}, \frac{b-c+a}{a}, \frac{2a-c+2}{a}, -x^a\right)}{a-c+2} - \frac{_{2}F_{1}\left(\frac{3-c+a}{a}, \frac{b-c+a}{a}, \frac{2a-c+3}{a}, -x^a\right)}{a-c+3} \right)$

while Mathematica's result can be simplified to

(x^(1 - c) Hypergeometric2F1[(3 - c)/a, (b - c)/a, (3 + a - c)/a, -x^a]) / (-3 + c)

As I said, when compared numerically, the two differ.
Digging a bit, I found the source of the discrepancy, which originates in a suspicious behaviour of Hypergeometric2F1

First, if I define

F[x_, C_, B_] = Hypergeometric2F1[C, B, C + 1, -x^a]/C

the output reads

Hypergeometric2F1[B, C, 1 + C, -x^a]/C

As you see, it inverts the order of the first two parameters in the hypergeometric function. I'm not sure if this swapping is allowed, since I've never encountered such transformation in databases like DLMF. I checked this manually, but I don't get an equality (perhaps some Math's expert might share some insight here).

Supposing this inversion is allowed, the derivative of F does not follow the differentiation rule of the hypergeometric function, i.e.
D[Hypergeometric2F1[a, b, c, x], x] = a b Hypergeometric2F1[1+a, 1+b, 1+c, x] / c

Rather I get

D[F[x, C, B], x] = (a ((1 + x^a)^-B - Hypergeometric2F1[B, C, 1 + C, -x^a])) / x

Does anybody know what's going on or has encountered the similar behaviour and can answer my perplexities?
Thank you

I response to Bob Halon

I understood why $_{2}F_{1}(a,b,c,z)$ == $_{2}F_{1}(b,a,c,z)$ (I was basing myself on the integral representation, but looking at its power series expression the identity becomes obvious)

Still, I'm not convinced by its derivation because it does not match any of those reported in dlmf. To show this, I've written the following few lines of code

In[54]:= D[Hypergeometric2F1[a, b, c, x], x]

Out[54]= (a b Hypergeometric2F1[1 + a, 1 + b, 1 + c, x])/c

which follows exactly the rule https://dlmf.nist.gov/15.5.E1
but when I applied to my case, I get the following result

In[44]:= D[Hypergeometric2F1[C, B, C + 1, -x^a]/C, x]

Out[44]= (a ((1 + x^a)^-B - Hypergeometric2F1[B, C, 1 + C, -x^a]))/x

None of the differentiation rules given in dlmf leaves the parameters of $_{2}F_{1}$ unvaried, but this result does. So, before blindly accept what Mathematica outputs, I would like to understand to reason. If anybody knows it, I would be grateful if they could share it. Thank you

  • $\begingroup$ Add some example to compare? in MMA code. $\endgroup$ Commented May 17, 2018 at 17:09

1 Answer 1


The order of the numerator parameters in Hypergeometric2F1 is immaterial so Mathematica uses canonical ordering

Hypergeometric2F1[a, b, c, x] == Hypergeometric2F1[b, a, c, x]

(* True *)

D[Hypergeometric2F1[a, b, c, x], x] == D[Hypergeometric2F1[b, a, c, x], x]

(* True *)

f[x_] := x^(2 - 
      c) (Hypergeometric2F1[(3 - c)/a, (b - c)/a, (3 - c + a)/a, -x^a]/(3 - 
        c) - Hypergeometric2F1[(2 - c)/a, (b - c)/a, (2 - c + a)/a, -x^a]/(2 -
         c)) + Gamma[(2 - c)/a] Gamma[(b - 2)/a]/(a Gamma[(b - c)/a])

Evaluating the derivative of f

D[f[x], x] // Simplify

(* (x^(1 - c) Hypergeometric2F1[(3 - c)/a, (b - c)/a, (3 + a - c)/a, -x^a])/
  (-3 + c) *)

Recommend that you double check your analytic results.

  • 1
    $\begingroup$ My analytical calculation is right. I had just forgotten a 2π factor in my python code which yielded different results. Sorry people and thank you $\endgroup$
    – andrea
    Commented May 21, 2018 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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