I am trying to find the result of $$\int x^{-d/2}(1-x)^{(d-3)/2}dx$$ where $0<x<1$ and $d\ge2$ is an integer.

Mathematica gives the following:

Integrate[x^(-d/2) (1 - x)^((d - 3)/2), x, Assumptions -> 0 < x < 1]
-((2 x^(1 - d/2)Hypergeometric2F1[(3 - d)/2, 1 - d/2, 2 - d/2, x])/(-2 + d))

This seems to be fine except for even values of $d\ge4$ because in this case the hypergeometric series is not defined. I've also tried the following:

d = 2 k;
$Assumptions = k > 0 && k \[Element] Integers;
Integrate[x^(-d/2) (1 - x)^((d - 3)/2), x, Assumptions -> 0 < x < 1]

but Mathematica still gives the same expression:

(x^(1 - k) Hypergeometric2F1[1 - k, 3/2 - k, 2 - k, x])/(1 - k)

If I try to evaluate this expression for any integer value of $k\ge1$ it gives


as expected.

However, the integral clearly exists as if I tell Mathematica to integrate $\int x^{-d/2}(1-x)^{(d-3)/2}dx$ for a specific value of $d$ it always gives an answer; for example, for $d=4$:

d = 4;
Integrate[x^(-d/2) (1 - x)^((d - 3)/2), x, Assumptions -> 0 < x < 1]
-(Sqrt[1 - x]/x) + ArcTanh[Sqrt[1 - x]]

I need an expression for general $d$, however. Any idea how I can get Mathematica to do this integral in general?

New contributor
Radu Moga is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    $\begingroup$ Welcome to Mathematica StackExchange! I am slightly confused. You are integrating over $x$, yet you are putting the $x$ range to assumptions. Clearly you want a definite integral, $\int_0^1 x^{-d/2}(1-x)^{(d-3)/2}\, \mathrm{d}x$, right? Then you should use Integrate[(1 - x)^(1/2 (-3 + d)) x^(-d/2), {x, 0, 1}]. This gives $\Gamma \left(1-d/2\right) \Gamma \left((d-1)/2\right)/\sqrt{\pi }$ for $1< d < 2$. $\endgroup$
    – Domen
    2 days ago
  • $\begingroup$ No, I do not want a definite integral, I want the indefinite integral. In the context in which I am trying to solve this integral my $x$ is between $0$ and $1$, but I don't need the definite integral. $\endgroup$
    – Radu Moga
    2 days ago
  • 5
    $\begingroup$ You can do a math trick: shift your $d$ by $3$ and integrate $\int x^{-(d+3)/2}(1-x)^{d/2}dx$. $\endgroup$
    – user58955
    2 days ago
  • $\begingroup$ You say you don't need the definite integral, but beware. $\endgroup$
    – march

3 Answers 3


This is an incomplete Euler beta function: Beta[z0, z1, a, b] is

$$ B_{z_0,z_1}(a,b)=\int_{z_0}^{z_1}t^{a-1}(1-t)^{b-1}dt. $$


f[d_, x_] = Beta[1, x, 1 - d/2, (d - 1)/2];

and check that its $x$-derivative matches your expression:

D[f[d, x], x] // FullSimplify
(*    (1 - x)^(1/2 (-3 + d)) x^(-d/2)    *)

where I've quite arbitrarily picked $z_0=1$; any value $z_0\in(0,1]$ will work (but not $z_0=0$!); even some complex values would work, as in the hypergeometric solutions coming from user58955's comment.

Plot some values:

Plot[Evaluate@Table[f[d, x], {d, 1, 10}], {x, 0, 1}]

enter image description here


An extension of @user58955's trick:

ans = Integrate[
    int = x^(-d/2) (1 - x)^((d - 3)/2) /. d -> d + 3, {x, 1/4, x}, 
    Assumptions -> 0 < x < 1] /. d -> d - 3 // Normal
4 I^(3 - d) Hypergeometric2F1[1/2, (3 - d)/2, 3/2, 4] - 
 (2 I^(3 - d) Hypergeometric2F1[1/2, (3 - d)/2, 3/2, 1/x])/Sqrt[x]

psol = ParametricNDSolveValue[{y'[x] == int /. d -> d - 3, 
   y[1/4] == 0}, y, {x, 0, 1}, {d}]

  Plot[{ans, psol[d][x]} /. d -> d0 // Evaluate, {x, 0, 1}, 
   PlotStyle -> {AbsoluteThickness[6], AbsoluteThickness[3]}],
 {d0, 4, 10, 1, Appearance -> "Labeled"}
  • 1
    $\begingroup$ As a warning to others, in 12.3 or 13.0, a different (wrong?) result is obtained. $\endgroup$
    – Domen
  • 1
    $\begingroup$ @Domen Just to be clear, the error comes from the Integrate[] result for even values of d. Apparently Integrate[] changes its behavior now and then. :) $\endgroup$
    – Michael E2

You demand the impossible.

The hypergeometric series were developed by Euler, Lagrange, Gauss and Jacobi to cover all functions defined by the definite integral

$$\int_0^1\ \frac{s^a \ (1-s)^b} { (1-x\ s )^c } \ ds$$

The starting point was the elliptic integral for the period of the rotating mathematical pendulum. The conservation of energy can be simplified to

$$ \frac{d\phi^2}{dt^2} \ = \ 1 - k^2 \sin^2 \phi \ \ \to \ \ t =\int_0^\phi \frac{ds}{\sqrt{1 - k^2 \sin^2 s}} = \int_0^{\arcsin \phi} \frac{du} {\sqrt{1 - k^2 u^2 } \ \ \sqrt{1-u^2}}$$

Besides the elliptic integrals, hypergeometric series, confluent hypergeometric series Phi and Psi, Eulers ansatz covers all series of orthogonal polynomials.

Consequently, a general indefinite integral is a print command of all of NIST volumes on special functions, most elementary functions included, as a decision tree.

Jacobi lists 23 cases, because there are singular points at $s=0, 1, 1/x \pm \infty$ . The most delicate definitions are integrals along a branch cut between two neighboring singular points.

In the history of mathematics these integrals were the spark that started the glorious century of complex analysis from Euler, Cauchy, Jacobi to Riemann and Weierstrass.

Since there is some rumor about distraction from the goal, consider the re-substitution

    (1 - x)^(d/2)/(x^(d/2 ) (1 - x)^(3/2)) dx /. 
    {x -> Cos[\[Phi]]^2,  dx -> d\[Phi] D[Cos[\[Phi]]^2, \[Phi]]}
      //   FullSimplify // PowerExpand

    -2 d\[Phi] Cos[\[Phi]]^(1 - d) Sin[\[Phi]]^(-2 + d)

The integral will produce an undesired numerator of the exponents. Thats common with integrals. I cancel it

      i[d_, \[Phi]_] = (d - 1)*
      Integrate[-2  Cos[\[Phi]]^(1 - d)  Sin[\[Phi]]^(-2 + d),

        -2 Cos[\[Phi]]^-d (Cos[\[Phi]]^2)^(d/2) 
  Hypergeometric2F1[1/2 (-1 + d), d/2, (1 + d)/2,
  Sin[\[Phi]]^2]* Sin[\[Phi]]^(-1 + d)

This function is well behaved. The singularities came from poles in d. Now one can substitute $\sqrt x $ for $\sin \phi$

  • 2
    $\begingroup$ Did you write this with ChatGPT? It looks like nonsense. $\endgroup$
    – Roman
  • $\begingroup$ Not a good point concerning your reading capability or education background in Mathematics. ChatGPT would copy such texts. The content is based largely on the orignal 'Jacobi Gesammelte Werke Vol 6 Berlin 1881. Written in Latin, French and German. My style in English is not perfect, naturally. I sometimes use translate.google to find some idiomatic mathematical terms, that differ somtimes a bit in German and English. $\endgroup$
    – Roland F
  • 2
    $\begingroup$ I figured that it would take a ML model to provide a non-answer that's so far off the mark; but I stand corrected. $\endgroup$
    – Roman
  • 2
    $\begingroup$ Fascinating historical take. But of no relevance to the question raised in this thread. Which makes it an uncomfortable distraction. $\endgroup$ yesterday

Your Answer

Radu Moga is a new contributor. Be nice, and check out our Code of Conduct.

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

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