# Any advice on simplifying this nasty integral

Can anyone think of any smart way of approximating this nasty integral $$F = \int_{-c}^c f_X(x) \, dx$$

where $c$ is a non-negative constant (for example $\frac{1}{64}$) and where the integrand is given by

$$f_X(x)= \int_{\max\{-1,-1-x\}}^{\min\{1,1-x\}} \left( \frac{1}{\pi^2\sqrt{1-(x+y)^2}} \frac{1}{\sqrt{1-y^2}}\right) \, dy$$

I would really like to avoid numerical integration. Can anyone think of any simplifications that can reduce the complexity of my problem.

Thanks

• How does it arise? Maybe it can be avoided and computed another way. It does look painful.
– MPW
Jan 24, 2015 at 3:39
• The function $f_X(x)$is the probability density function of $X=\cos(U)-\cos(V)$ where $U,V$ are uniform random variables. The reason I am integrating $F$ is because I had a function of this random variable $X$ and I had to take the expectation with respect to it.... does that make any sense? @MPW Jan 24, 2015 at 3:42
• I should say $U,V\sim [-\pi,\pi]$... Jan 24, 2015 at 3:48
• So is the question really "what is the expected value of $\cos U +\cos V$ where $U$ and $V$ are independent random variables uniformly distributed on $[-\pi,\pi]$?"?
– MPW
Jan 24, 2015 at 3:48
• No the function that I had to average (take the expectation over) was $\mathbb{E}[G(X)]$ where $G(x)= 1, -c\leq x\leq c$. and 0 everywhere else, this is why I have $F$ in this form shown above..@MPW Jan 24, 2015 at 3:54

The following answer provides the result in terms of a convergent series in Eq. (1).

The inner integral can be solved explicitly in terms of the complete elliptic integral of the first kind with the result (valid for $|x|<2$) $$f_X(x) = \frac1{\pi^2} K\Bigl(\sqrt{1-x^2/4}\Bigr) = \frac{1}{\pi^2}K'(|x|/2).$$

Using the expansion of $K$ around 1, we can obtain the expression $$F= \frac{2 c \log(2^3e/c)}{\pi^2} + \frac{c^3 \log(2^9/e^2 c^3)}{72 \pi^2} + O(c^5 \log c)$$ valid for $c\ll1$.

In fact using the formula 19.12.1, the integral $F$ can be obtained as a convergent series. Indeed, we have that $$K'(k)= \sum_{m=0}^\infty \left(\frac{\left(\tfrac12\right)_m k^m}{m!}\right)^2 \left[\log(1/k) + d(m)\right]$$ for $k<1$ with $d(m)= \psi(1+m) - \psi(1/2 +m)$; here, $\psi$ is the digamma function and $(a)_n =\Gamma(a+n)/\Gamma(a)$ the Pochhammer symbol.

Integrating $F= \int_{-c}^c f_X(x)$ term by term yields $$F= \frac{1}{\pi^2} \sum_{m=0}^\infty \left(\frac{\left(\tfrac12\right)_m }{m!}\right)^2 \frac{c^{2m+1}}{(2m+1)2^{2m-1}} \left[\frac{1 + (2m+1) \log(2/c)}{2m+1} + d(m)\right] \tag{1},$$ where we have used that $$\int_{-c}^c \!dx\,x^{2m}= \frac{2 c^{2m+1}}{2m+1}$$ and $$\int_{-c}^c\!dx\,x^{2m}\log(1/x) = \frac{2 c^{2m+1} [1 + (2m+1) \log(1/c)]}{(2m+1)^2}.$$

A special point occurs at $c=2$ where the logarithmic terms in (1) vanish and we simply obtain $F(c=2) = 1$.

Edit: Following the general procedure and specifying $0<x<1$ (it can be checked that the result remains unmodified in the other cases), we factor $$(1- (x+y)^2)(1-y^2) =(1-y) (1-x-y) (y+1)(y+1+x) .$$ This leads to the substitution $$t= \sqrt{\frac{2 (1+y)}{(2-x)(1+x+y)}}.$$ Via this substitution the boundaries $y=-1$ and $y=1-x$ are transformed to $t=0$ and $t=1$ and we obtain $$\int_{-1}^{1-x}\frac{dx}{\sqrt{(1- (x+y)^2)(1-y^2)}} = \int_0^1\frac{dt}{\sqrt{(1-t^2)[1-(1-x^2/4) t^2]}}$$ which is the standard form of the complete elliptic integral of the first kind.

• wow impressive can you please provide more details....i dont understand how you were able to do it Jan 24, 2015 at 6:34
• @Henry: Of course it is not the first time, I have solved an ellliptic integral... ;-) Jan 24, 2015 at 7:52
• thank you. If you dont mind i want to ask : what to do you mean by expansion of $K$ around 1. Also why did you take x between 0 and 1... in my case its between -1 and 1. Thanks Jan 24, 2015 at 12:52
• @Henry: you have to treat the cases $x<-1$, $-1<x<0$, $0<x<1$, $x>1$ differently as they ask for different substitutions. It turns out that they all the cases lead to the result quoted in particular it is not difficult to convince yourself that $x$ and $-x$ lead to the same result. Jan 24, 2015 at 15:14
• thank you and i agree.. cam you please tell me how you got the expansiom aroung $K=1$us that an approximation? Jan 24, 2015 at 15:16

According to your comments, for $$G(x) = \mathbb{1}(|x|\le c) = \begin{cases} 1, & -c \le x \le c \\ 0, & \text{otherwise} \end{cases}$$ we then simply have $$\mathbb E[G(X)] = \Pr[|X| \le c].$$ If $X = \cos U - \cos V$ where $U, V \sim \operatorname{Uniform}(?,?)$ are independent, then you need to specify the support of the uniform distribution before we can proceed further.

• Thanks, the support of $U,V \sim U(-\pi,\pi)$, for which I think the distribution of $X$ is $f_X(x)$ in my question.... Jan 24, 2015 at 4:18