Apparently, the following appeared in Ramanujan's first letter to GH Hardy.
If $$\psi(p,n)=\int_0^a\phi(p,x)\cos(nx)dx,$$ then $$\frac{\pi}{2}\int_0^a\phi(p,x)\phi(q,nx)dx=\int_0^\infty \psi(q,x)\psi(p,nx)dx$$
I tried proving this, but with not much success. First, I wrote $$\psi(q,x)\psi(p,nx)=\int_0^a\int_0^a\phi(q,u)\phi(p,v)\cos(xu)\cos(nxv)dudv$$ Then I guess we have $$\int_0^\infty\psi(q,x)\psi(p,nx)dx=\int_0^\infty\int_0^a\int_0^a\phi(q,u)\phi(p,v)\cos(xu)\cos(nxv)dudvdx,$$ but this looks just awful. It's hard to believe that expression would somehow reduce to the desired one. If there is a way to go about it like this perhaps it is via some clever substitution or change of variables, but seeing as so little is known about $\phi$, I don't imagine there'd be much to work with.
Does anyone know how to prove Ramanujan's result?
This appears to be just a slight modification of Parseval's theorem for the Fourier cosine transform, which is just the Fourier transform of the even extension of a function.
If the Fourier cosine transform of a function $f$ is defined as $$\hat{f_c} (\omega) = \int_{0}^{\infty} f(t) \cos(\omega t) \, \mathrm dt,$$ then inverse Fourier cosine transform is $$f(x) = \frac{2}{\pi} \int_{0}^{\infty} \hat{f_c}(\omega) \cos(x \omega ) \, \mathrm d \omega. $$
(Some textbooks scale it differently.)
Note that in this particular problem we're dealing with a piecewise-defined function that is zero for $x >a$.
Then, when switching the order of integration can be justified, we have $$\begin{align} \int_{0}^{\infty} \psi(q,x)\psi(p,nx) \, \mathrm dx &= \int_{0}^{\infty}\psi(q,x) \int_{0}^{a} \phi (p,t) \cos (nxt) \, \mathrm d t \, \mathrm dx \\ &= \int_{0}^{a} \phi (p,t) \int_{0}^{\infty} \psi(q,x)\cos (nxt ) \, \mathrm dx \, \mathrm d t \\ &= \frac{\pi}{2}\int_{0}^{a} \phi(p,t) \phi (q,n t) \, \mathrm d t . \end{align}$$