# closed form for $\int_{1/4}^{3/4} x^n(1-x)^n \, dx$

The integrand being a polynomial, I used the binomial formula to separate the monomials:

$$\int_{\frac{1}{4}}^{\frac{3}{4}} x^n(1-x)^n \, dx = \sum_{k = 0}^{n}{ n \choose k}(-1)^{k}\int_{\frac{1}{4}}^{\frac{3}{4}} x^{n+k} \, dx = \sum_{k = 0}^{n}{ n \choose k}(-1)^{k}\left[\frac{(\frac{3}{4})^{n+k+1}-(\frac{1}{4})^{n+k+1}}{n+k+1}\right].$$

I'm looking to get a closed form of the following sum or at least make it 'nicer' in terms of looks:

$$f(a) =\sum_{k = 0}^{n}{ n \choose k}(-1)^{k}\frac{a^{n+k+1}}{n+k+1},\,\, 0

We have $$f'(a) =\sum_{k = 0}^{n}{ n \choose k}(-1)^{k}a^{n+k}$$ Then :

$$f'(a) =a^n(-1)^n\sum_{k = 0}^{n}{ n \choose k}(-1)^{n-k}a^{k} = a^n(-1)^{n}(a-1)^n = a^n(1-a)^n$$

so we are back to square one.

Past this circular simplification, I thought of integrating but that will just make the formula much messier.

Maybe there's another approach?

Edit 1: My main goal is to get a closed form of the integral, so if $$\frac14$$ and $$\frac34$$ give some cancellations, it would be great if someone pointed them out.

Edit 2: the original problem :

let $$(X_1,\cdots,X_{2n+1})$$ be a $$2n+1$$ sample of independant, identically distributed random variables that are uniformly distributed over $$[0,1]$$

-Find the probability that the median $$\in [\frac14,\frac34]$$.

Edit 3:

using @JamesArathoon Observation

\begin{align}I_n & =\int_0^1 x^n (1-x)^n \, dx-2\int_0^{\frac{1}{4}} x^n (1-x)^n \, dx = B(n+1,n+1) - 2B(\frac14;n+1,n+1) \end{align}

where first special function is the beta function and second one is the incomplete beta.

\begin{align}I_n & = B(n+1,n+1) - 2B(\frac14;n+1,n+1) = \frac{\Gamma^2(n+1)}{\Gamma(2n+2)} -\frac{2}{4^{n+1}n+1}{_{2}}F_{1}(n+1,-n,n+2,\frac{1}{4}) \\ &=\frac{(n^2)!}{(2n+1)!} -\frac{2}{4^{n+1}n+1} {_{2}}F_{1}(n+1,-n,n+2,\frac{1}{4}) \end{align}

because one of the arguments of the hypergeomtric function is negative then the series terminates and is given by

\begin{align}{_{2}}F_{1}(n+1,-n,n+2,\frac{1}{4}) &= \sum_{k=0}^{n} (-1)^k \binom{n}{k} \frac{(n+1)_k}{4^k(n+2)_k} \\ &= 1 + \sum_{k=1}^{n} (-1)^k \frac{n!}{k!(n-k)!} \frac{(n+1)(n+2)\cdots(n+k)}{4^k(n+2)(n+3)\cdots(n+k+1)} \\ &=1 + \sum_{k=1}^{n} (-1)^k \frac{n!}{k!(n-k)!} \frac{(n+1)}{4^k(n+k+1)} \\ \end{align}

now that looks like it's got the potential to be turned into a binomial formula with $$a = -1, b = \frac14$$

but I still can't see it

• Is this an $XY$ problem? The result depends on $n$. What is the motivation for finding a "closed form"? Where are these two numbers $1/4$ and $3/4$ from?
– user587192
Jan 30, 2019 at 19:35
• I'd do some graph transformations to make the endpoints $0$ and $1$ to start with. Resulting in $$2^{4n-1}\int_0^1(2x+1)^n(3-2x)^n dx\,.$$ These integrals are invariably related to $$\int_0^1 x^m(1-x)^n dx$$ however, I've rarely seen them cut off or dilated. I half expect an incomplete $\Gamma$ or $B$ function to appear.
– user123641
Jan 30, 2019 at 19:39
• Using a natural substitution $x=\frac12-u$ (to center things), you end up with the integral $$4^{-2n}\int_{-1/4}^{1/4}(1-4u^2)^{2n}\,du.$$ As far as techniques go, this is a prototypical example for trigonometric substitutions; the problem is that it ends up where you're already at, I think (I didn't work it out, though). Jan 30, 2019 at 19:49
• Since $\int_0^{1/4} x^n (1-x)^n \, dx=\int_{3/4}^{1 } x^n (1-x)^n \, dx$ you can write $$I_n=\int_0^1 x^n (1-x)^n \, dx-2\int_0^{\frac{1}{4}} x^n (1-x)^n \, dx$$ which might simplify things slightly. Jan 30, 2019 at 20:50
• @user587192 I added the original problem to my post. Jan 30, 2019 at 21:06

Here is an attempt along lines that have been suggested in the comments.

Let $$I_n = \int_{\frac{1}{4}}^{\frac{3}{4}} x^n (1 - x)^n \, dx, \qquad n \in \mathbb{N}.$$

From properties of the definite integral we may write $$I_n = \int_0^1 x^n (1 - x)^n \, dx - \int_0^{\frac{1}{4}} x^n (1 - x)^n \, dx - \int_{\frac{3}{4}}^{1} x^n (1 - x)^n \, dx. \tag1$$ Noting that (to see this, enforce of substitution of $$x \mapsto 1 - x$$ in the integral to the right) $$\int_0^{\frac{1}{4}} x^n (1 - x)^n \, dx = \int_{\frac{3}{4}}^{1} x^n (1 - x)^n \, dx,$$ (1) can be rewritten as $$I_n = \int_0^1 x^n (1 - x)^n \, dx - 2\int_0^{\frac{1}{4}} x^n (1 - x)^n \, dx \tag2$$ The first of these integrals is a standard beta function. Here $$\int_0^1 x^n (1 - x)^n \, dx = \operatorname{B} (n + 1,n+1) = \frac{1}{(2n + 1) \binom{2n}{n}}.$$ The second of the integrals is an incomplete beta function. Here $$\int_0^{\frac{1}{4}} x^n (1 - x)^n \, dx = \operatorname{B} \left (\frac{1}{4}; n + 1, n+ 1 \right ).$$ Thus (2) becomes $$I_n = \frac{1}{(2n + 1) \binom{2n}{n}} - 2 \operatorname{B} \left (\frac{1}{4}; n + 1, n + 1 \right ). \tag3$$

If it helps, (3) can be rewritten in terms of the hypergeometric function $$_2 F_1 (a,b;c;x)$$. Using, for example, the first of the results found here, namely $$\operatorname{B} (x;a,b) = \frac{x^a}{a} {_2} F_1 (a, 1 - b; a + 1; x),$$ (3) becomes $$I_n = \frac{1}{(2n + 1) \binom{2n}{n}} - \frac{1}{2 \cdot 4^n (n + 1)} {_2} F_1 \left (n + 1, -n; n + 2; \frac{1}{4} \right ).$$

Of course, one of the other forms for the incomplete beta function in terms of the hypergeometric function found in the link may be more useful for your particular purpose.

Update

To arrive at the result given by the OP in Edit 3, use of the incomplete beta function or the hypergeometric function can be avoid altogether. By making use of the binomial expansion in the second of the integrals appearing in (2) we are taken directly to \begin{align} \int_0^{\frac{1}{4}} x^n (1 - x)^n \, dx &= \sum_{k = 0}^n \binom{n}{k} (-1)^k \int_0^{\frac{1}{4}} x^{n + k} \, dx\\ &= \frac{1}{4^{n + 1}} \sum_{k = 0}^n \binom{n}{k} \frac{(-1)^k}{4^k (n + k + 1)}. \end{align} As this sum consists of a finite number of terms it is in closed form but it would of course be nice if it could be written more compactly using less terms.

• I was able to simplify it slightly more starting from that formula, see my post Jan 30, 2019 at 21:33