Integrate $\cos^2(\pi x)\cos^2(\frac{n\pi}{x})$

137 Views Asked by At

I need to integrate $\int\cos^2(\pi x)\cos^2(\frac{n\pi}{x})dx$. There's no limit for $x$ but if it helps you can assume $\frac{n}{10} \le x \le n$.

Walfram calculator can gives the following integration formula for $\cos^2(\frac{n\pi}{x})$ but cannot not do this one. $$ \int \cos^2(\frac{n \pi}{x}) dx = \frac{1}{2}\left(2 \pi n \text{Si}(\frac{2 n \pi}{x})+x \cos(\frac{2 \pi n}{x})+x\right)+C $$

Can you help? The closed form is best but expansion form is fine too.

Background: $\cos^2(\pi x)=1$ when $x$ is integer and $\cos^2(n \pi/x)=1$ when $x$ divides $n$, so $\cos^2(\pi x)\cos^2(n \pi/x)=1$ iff $x$ is an integer factor of $n$, and the ratio of integration $\int_{a}^{b}\cos^2(\pi x)\cos^2(\frac{n\pi}{x})dx$ over $\int_{a}^{b}\cos^2(\frac{n\pi}{x})dx$ tells how likely there's a factor of $n$ located in $[a,b]$.