Certain Integrals Arising from Ramanujan's Notebooks

In his third notebook, Ramanujan claims that $$ \int_0^\infty \frac{\cos(nx)}{x^2+1} \log x \,\mathrm{d} x + \frac{\pi}{2} \int_0^\infty \frac{\sin(nx)}{x^2+1} \mathrm{d} x = 0. $$ In a following cryptic line, which only became visible in a recent reproduction of Ramanujan's notebooks, Ramanujan indicates that a similar relation exists if $\log x$ were replaced by $\log^2x$ in the first integral and $\log x$ were inserted in the integrand of the second integral. One of the goals of the present paper is to prove this claim by contour integration. We further establish general theorems similarly relating large classes of infinite integrals and illustrate these by several examples.


Introduction
If you attempt to find the values of the integrals ∞ 0 cos(nx) x 2 + 1 log x dx and ∞ 0 sin(nx) x 2 + 1 dx, n > 0, (1.1) by consulting tables such as those of Gradshteyn and Ryzhik [3] or by invoking a computer algebra system such as Mathematica, you will be disappointed. There do not appear to exist techniques for evaluating these integrals in closed form, although the latter integral above can be expressed in terms of the exponential integral Ei(x) [3, p. 445, formula 3.723, no. 1]. Moreover, if 1/(x 2 + 1) is replaced by any even rational function with the degree of the denominator at least one greater than the degree of the numerator, it does not seem possible to evaluate any such integral in closed form. However, in his third notebook, on page 391 in the pagination of the second volume of [5], Ramanujan  With the use of the most up-to-date photographic techniques, a new edition of Ramanujan's Notebooks [5] was published in 2012 to help celebrate the 125th anniversary of Ramanujan's birth. The new reproduction is vastly clearer and easier to read than the original edition. When the first author reexamined (1.2) in the new edition, he was surprised to see that Ramanujan made a further claim concerning (1.2) that was not visible in the original edition of [5]. In a cryptic one line, he indicated that a relation similar to (1.2) existed if log x were inserted in the integrand of the first integral and log x were replaced by log 2 x in the second integral of (1.2). One of the goals of the present paper is to prove (by contour integration) this unintelligible entry in the first edition of the notebooks [5]. Secondly, we establish general theorems relating large classes of infinite integrals for which individual evaluations in closed form are not possible by presently known methods. Several further examples are given.

Ramanujan's Extension of (1.2)
We prove the entry on page 391 of [5] that resurfaced with the new printing of [5].

A Second Approach to the Entry at the Top of Page 391
Theorem 3.1. For s ∈ (−1, 2) and n ≥ 0, Before indicating a proof of Theorem 3.1, let us see how the integral (3.1) implies Ramanujan's integral relations (2.1) and (2.2). Essentially, all we have to do is to take derivatives of (3.1) with respect to s (and interchange the order of differentiation and integration); then, upon setting s = 0, we deduce (2.1) and (2.2).
First, note that upon setting s = 0 in (3.1), we obtain (2.8). On the other hand, taking a derivative of (3.1) with respect to s, and then setting s = 0, we find that which is the formula (2.1) that Ramanujan recorded on page 391. Similarly, taking two derivatives of (3.1) and then putting s = 0, we arrive at which, using (2.8), simplifies to Note that this is Ramanujan's previously unintelligible formula (2.2). If we likewise take m derivatives before setting s = 0, we obtain the following general set of relations connecting the integrals We now provide a proof of Theorem 3.1. Proof. In analogy with our previous proof, we integrate f s (z) := e inz z s z 2 + 1 over the contour C R,ε and let ε → 0 and R → ∞. Here, z s = e s log z with − 1 2 π < arg z ≤ 3 2 π, as above. By the residue theorem, Letting ε → 0 and R → ∞, and using bounds for the integrand on the semi-circles as we did above, we deduce that Combining (3.4) and (3.5), we find that We then divide both sides of (3.6) by 2e πis/2 to obtain (3.1). Note that the integrals are absolutely convergent for s ∈ (−1, 1). By Dirichlet's test, (3.6) holds for s ∈ (−1, 2). Replacing s with s + 1 in (3.1), we obtain the following companion integral.
which is well-known. After taking one derivative with respect to s in (3.7) and setting s = 0, we similarly find that which may be compared with Ramanujan's formula (2.1). As a second example, after taking two derivatives of (3.7) with respect to s, setting s = 0, and using (3.8), we arrive at the identity We offer a few additional remarks before generalizing our ideas in the next section. Equating real parts in the identity (3.6) from the proof of Theorem 3.1, we find that Hence, taking a derivative of (3.11) with respect to s, and then setting s = 0, we find that which is the formula (2.1) that Ramanujan recorded on page 391. Similarly, taking two derivatives of (3.11) and letting s = 0, we deduce that which, using (2.8), simplifies to which is the formula (2.2) arising from Ramanujan's unintelligible remark in the initial edition of [5]. The integral (3.11) has the companion which is obtained by equating imaginary parts in (3.6). However, taking derivatives of (3.12) with respect to s, and then setting s = 0, does not generate new identities. Instead, we recover precisely the previous results. For instance, taking a derivative of (3.12) with respect to s, and then setting s = 0, we again deduce (2.8). Taking two derivatives of (3.12) with respect to s, and then setting s = 0, we obtain 0 = π 2 ∞ 0 sin(nx) which is again Ramanujan's formula (2.1).

General Theorems
The phenomenon observed by Ramanujan in (1.2) can be generalized by replacing the rational function 1/(z 2 +1) by a general rational function f (z) in which the denominator has degree at least one greater than the degree of the numerator. We shall also assume that f (z) does not have any poles on the real axis. We could prove a theorem allowing for poles on the real axis, but in such instances we would need to consider the principal values of the resulting integrals on the real axis. In our arguments above, we used the fact that 1/(z 2 + 1) is an even function. For our general theorem, we require that f (z) be either even or odd. For brevity, we let Res(F (z); z 0 ) denote the residue of a function F (z) at a pole z 0 . As above, we define a branch of log z by − 1 2 π < θ = arg z ≤ 3 2 π. For a rational function f (z) as prescribed above and each nonnegative integer m, define Observe that (4.3) and (4.4) are recurrence relations that enable us to successively calculate I m and J m . With each succeeding value of m, we see that two previously non-appearing integrals arise. If f (z) is even, then these integrals are I m and J m−1 , while if f (z) is odd, these integrals are J m and I m−1 . The previously non-appearing integrals appear in either the real part or the imaginary part of the right-hand sides of (4.3) and (4.4), but not both real and imaginary parts. This fact therefore does not enable us to explicitly determine either of the two integrals. We must be satisfied with obtaining recurrence relations with increasingly more terms. Proof. We commence as in the proof of Theorem 2.1. Let C R,ε denote the positively oriented contour consisting of the semi-circle C R given by z = Re iθ , 0 ≤ θ ≤ π, [−R, − ], the semi-circle C ε given by z = εe iθ , π ≥ θ ≥ 0, and [ε, R], where 0 < ε < d, where d is the smallest modulus of the poles of f (z) in U . We also choose R larger than the moduli of all the poles of f (z) in U . By the residue theorem, where S is defined in (4.2). We next directly evaluate the integral on the left-hand side of (4.5). As in the proof of Theorem 2.1, we can easily show that as ε tends to 0. Secondly, we estimate the integral over C R . By hypothesis, there exist a positive constant A and a positive number R 0 , such that for Since sin θ ≥ 2θ/π, 0 ≤ θ ≤ π/2, upon replacing θ by π − θ, we find that The bound (4.8) also holds for the first integral on the far right-hand side of (4.7). Hence, from (4.7), as R tends to infinity. Hence, so far, by (4.5), (4.6), and (4.9), we have shown that Suppose first that f (x) is even. Then (4.10) takes the shape which establishes (4.3). Secondly, suppose that f (z) is odd. Then, (4.10) takes the form from which (4.4) follows. x sin x log m x x 2 + 1 dx.
(In the sequel, it is understood that we are assuming that n = 1 in Theorem 2.1 and in all our deliberations of the two preceding sections.) If m = 0, (4.14) reduces to which is (2.8). After simplification, if m = 1, (4.14) yields If we equate real parts in (4.16), we once again deduce (4.15). If we equate imaginary parts in (4.16), we find that which is identical with (3.9). Setting m = 2 in (4.14), we find that Equating real parts on both sides of (4.18), we once again deduce (4.17). If we equate imaginary parts in (4.18) and employ (4.15), we arrive at which is the same as (3.10). Lastly, we set m = 3 in (4.14) to find that If we equate real parts on both sides of (4.20) and simplify, we deduce (4.19) once again. On the other hand, when we equate imaginary parts on both sides of (4.20), we deduce that A slight simplification of (4.21) can be rendered with the use of (4.17).
We can replace the rational function 1/(x 2 +1) in Theorem 3.1 by other even rational functions f (x) to obtain the following generalization of Theorem 3.1. Its proof is in the same spirit as that of Theorem 4.1. Note that, as we did for (3.7), we can replace s with s + 1 in Theorem 4.3 to obtain a corresponding result for odd rational functions xf (x). This is illustrated in Example 4.7 below.
As an application, we derive from Theorem 4.3 the following explicit integral evaluation, which reduces to Theorem 3.1 when r = 0.
Proof. Setting f (z) = 1/(z 2 + 1) r in Theorem 4.3, we see that we need to calculate the residue Res e inz z s (z 2 + 1) r+1 , i = Res is analytic in a neighborhood of z = i. Equivalently, we calculate the coefficient of x r in the Taylor expansion of α(x + i) around x = 0. Using the binomial series with a = 2i, we find that Extracting the coefficient of x r , we conclude that Res e inz z s (z 2 + 1) r+1 , i =  We note that, more generally, this integral can be expressed in terms of the modified Bessel function K r+1/2 (z) of order r + 1/2. Namely, we have [3, p. 467, formula 3.773, no. 6] ∞ 0 cos(nx) (x 2 + 1) r+1 dx = n 2 r+1/2 √ π Γ(r + 1) K r+1/2 (n). (4.23) When r ≥ 0 is an integer, the Bessel function K r+1/2 (z) is elementary and the righthand side of (4.23) evaluates to the right-hand side of (4.22).
On the other hand, taking a derivative with respect to s before setting s = 0, and observing that, for j ≥ 1, d ds  We leave it to the interested reader to make explicit the corresponding generalization of (3.3). Example 4.7. As a direct extension of (3.7), replacing s with s+1 in Theorem 4.4, we obtain the following companion integral. For integers r ≥ 0, and any s ∈ (−2, 2r + 1) and n ≥ 0,