Integral inequalities (4)

Problem. Let \displaystyle f: [0,1] \longrightarrow \mathbb{R} be a differentiable function such that |f'(x)| \le 1 for all x \in [0,1]. For an integer n \ge 0, let \displaystyle I_n:=\int_0^1 x^nf(x) \ dx.
Show that for any integer n \ge 0,

\displaystyle |I_{n+1}| \le \frac{1}{(n+1)(n+2)}\sum_{k=0}^n\left((k+1)|I_k|+\frac{1}{k+2}\right)-\frac{1}{(n+2)(n+3)}.

(We assume that f' is integrable).

Solution. Integration by parts gives

\displaystyle I_k=\frac{f(1)}{k+1}-\frac{1}{k+1}\int_0^1x^{k+1}f'(x) \ dx.


\displaystyle \begin{aligned} \frac{1}{(n+1)(n+2)}\sum_{k=0}^n (k+1)I_k=\frac{f(1)}{n+2}-\frac{1}{(n+1)(n+2)}\int_0^1\sum_{k=0}^nx^{k+1}f'(x) \ dx \\ =I_{n+1}+\frac{1}{n+2}\int_0^1x^{n+2}f'(x) \ dx - \frac{1}{(n+1)(n+2)}\int_0^1\sum_{k=0}^nx^{k+1}f'(x) \ dx\end{aligned}

and therefore

\displaystyle I_{n+1}=\frac{1}{(n+1)(n+2)}\left(\sum_{k=0}^n(k+1)I_k + \int_0^1\left(\sum_{k=0}^nx^{k+1}-(n+1)x^{n+2}\right)f'(x) \ dx \right).

Thus, since

\displaystyle \sum_{k=0}^n x^{k+1}-(n+1)x^{n+2}=\sum_{k=0}^n(x^{k+1}-x^{n+2}) \ge 0

and |f'(x)| \le 1, on [0,1], we have

\displaystyle \begin{aligned} |I_{n+1}| \le \frac{1}{(n+1)(n+2)}\left(\sum_{k=0}^n(k+1)|I_k|+\int_0^1 \left(\sum_{k=0}^nx^{k+1}-(n+1)x^{n+2}\right) dx\right) \\ = \frac{1}{(n+1)(n+2)}\sum_{k=0}^n\left((k+1)|I_k|+\frac{1}{k+2}\right)-\frac{1}{(n+2)(n+3)}. \ \Box \end{aligned}

Example. Let’s check the above result for the function f(x)=x, \ \ x \in [0,1].
Then, for any integer n \ge 0, we have \displaystyle I_n:=\int_0^1 x^nf(x) \ dx = \frac{1}{n+2} and so

\displaystyle \begin{aligned} \frac{1}{(n+1)(n+2)}\sum_{k=0}^n\left((k+1)|I_k|+\frac{1}{k+2}\right)-\frac{1}{(n+2)(n+3)} \\ =\frac{1}{(n+1)(n+2)}\sum_{k=0}^n\left(\frac{k+1}{k+2}+\frac{1}{k+2}\right)-\frac{1}{(n+2)(n+3)} \\ =\frac{1}{n+2}-\frac{1}{(n+2)(n+3)}=\frac{1}{n+3}=I_{n+1}.\end{aligned}

Exercise. Show that if f: [0,1] \longrightarrow \mathbb{R} satisfies the conditions given in the above problem and if \displaystyle \left|\int_0^1 f(x) \ dx\right| \le \frac{1}{2}, then \displaystyle \left|\int_0^1x^nf(x) \ dx\right| \le \frac{1}{n+2} for all integers n \ge 0.
Hint. Induction!


An application of linear algebra in Calculus

This post is for those who have some knowledge of linear algebra.

Definition. For an integer n \ge 1, the n\times n Hilbert matrix is defined by H_n=[a_{ij}], where

\displaystyle a_{ij}=\frac{1}{i+j-1}, \ \  1 \le i,j \le n.

It is known that H_n is invertible and if H_n^{-1}=[b_{ij}], then \displaystyle \sum_{i,j}b_{ij}=n^2. We are going to use these two properties of Hilbert matrices to solve the following calculus problem.

Problem. Let n \ge 1 be an integer and let f : [0,1] \longrightarrow \mathbb{R} be a continuous function. Suppose that \displaystyle \int_0^1 x^kf(x) \ dx = 1 for all  0 \le k \le n-1. Show that \displaystyle \int_0^1 (f(x))^2 dx \ge n^2.

Solution. Since H_n, the n\times n Hilbert matrix, is invertible, there exist real numbers p_0, p_1, \cdots , p_{n-1} such that

\displaystyle \sum_{i=1}^n\frac{p_{i-1}}{i+j-1}=1, \ \ \ 1 \le j \le n.

So the polynomial \displaystyle p(x)=\sum_{k=0}^{n-1}p_kx^k satisfies the conditions

\displaystyle \int_0^1x^k p(x) \ dx =1, \ \ \ 0 \le k \le n-1.

Clearly \displaystyle \sum_{k=0}^{n-1}p_k is the sum of all the entries of H_n^{-1} and so \displaystyle \sum_{k=0}^{n-1}p_k=n^2. Now let f be a real-valued continuous function on [0,1] such that

\displaystyle \int_0^1x^kf(x) \ dx  = 1, \ \ \ 0 \le k \le n-1.

Let p(x) be the above polynomial.Then since

\displaystyle (f(x))^2-2f(x)p(x)+(p(x))^2 =(f(x)-p(x))^2 \ge 0,

integrating gives

\displaystyle \begin{aligned} \int_0^1 (f(x))^2dx \ge 2\int_0^1f(x)p(x) \ dx -\int_0^1(p(x))^2dx=2\sum_{k=0}^{n-1}p_k \int_0^1 x^kf(x) \ dx - \\ \sum_{k=0}^{n-1}p_k\int_0^1x^kp(x) \ dx = 2\sum_{k=0}^{n-1}p_k-\sum_{k=0}^{n-1}p_k=\sum_{k=0}^{n-1}p_k =n^2. \ \Box \end{aligned}

Weird looking integrals (1)

For a general form of the following problem, see Exercise 3.

Problem. Show that

\displaystyle I:=\int_0^{2\pi} \exp\left(\frac{7+5 \cos x}{10+6\cos x}\right) \cos \left( \frac{\sin x}{10+6 \cos x} \right) dx=2\pi e^{2/3}.

Solution. We make the substitution \displaystyle \tan\left(\frac{x}{2}\right)=2\tan\left(\frac{t}{2}\right). Then

\displaystyle I=2\int_0^{\pi} \exp\left(\frac{7+5 \cos x}{10+6\cos x}\right) \cos \left( \frac{\sin x}{10+6 \cos x} \right) dx=8e^{5/8}\int_0^{\pi}\exp\left(\frac{\cos t}{8}\right)\cos\left(\frac{\sin t}{8}\right)\frac{dt}{5-3\cos t}. \ \ \ \ \ (1)

Now, since \displaystyle \exp\left(\frac{\cos t}{8}\right)\cos\left(\frac{\sin t}{8}\right) is the real part of

\displaystyle \exp\left(\frac{\cos t}{8}\right)\exp\left(\frac{i\sin t}{8}\right)=\exp\left(\frac{1}{8}e^{it}\right)


\displaystyle \exp\left(\frac{1}{8}e^{it}\right)=\sum_{n=0}^{\infty}\frac{1}{8^nn!}e^{nit}=\sum_{n=0}^{\infty}\frac{\cos(nt)}{8^nn!}+i\sum_{n=0}^{\infty} \frac{\sin(nt)}{8^nn!},

we have

\displaystyle \exp\left(\frac{\cos t}{8}\right)\cos\left(\frac{\sin t}{8}\right)=\sum_{n=0}^{\infty} \frac{\cos(nt)}{8^nn!}.

Thus, by (1),

\displaystyle I=8e^{5/8}\sum_{n=0}^{\infty}\frac{1}{8^nn!}\int_0^{\pi} \frac{\cos(nt)}{5-3\cos t} \ dt=\frac{4}{3}e^{5/8}\sum_{n=0}^{\infty}\frac{(-1)^n}{8^nn!}\int_0^{2\pi} \frac{\cos(nt)}{\cos t + \frac{5}{3}} \ dt. \ \ \ \ \ \ \ (2)

But here (Problem 2) I showed that

\displaystyle \int_0^{2\pi} \frac{\cos(nt)}{\cos t + c} \ dt=\frac{2\pi}{\sqrt{c^2-1}}(-c+\sqrt{c^2-1})^n,

for integers n \ge 0 and real numbers c > 1. Thus

\displaystyle \int_0^{2\pi} \frac{\cos(nt)}{\cos t + \frac{5}{3}} \ dt=(-1)^n\frac{\pi}{2 \cdot 3^{n-1}}

and so, by (2),

\displaystyle I=2\pi e^{5/8} \sum_{n=0}^{\infty} \frac{1}{24^nn!}=2\pi e^{5/8}e^{1/24}=2\pi e^{2/3}. \ \Box

Exercise 1 (for those who are familiar with complex analysis).
Show that \displaystyle \exp\left(\frac{7+5 \cos x}{10+6\cos x}\right) \cos \left( \frac{\sin x}{10+6 \cos x} \right) is the real part of \displaystyle \exp\left(\frac{e^{ix}+2}{e^{ix}+3}\right). Now apply Cauchy’s integration formula to give another solution for the above problem.

Exercise 2. Show that

\displaystyle \int_0^{2\pi} \exp\left(\frac{3+3\cos x}{5+4\cos x}\right) \cos \left( \frac{\sin x}{5+4\cos x} \right) dx=2\pi \sqrt{e}.

Exercise 3. Given real numbers a,b with b \ne \pm 1, let

\displaystyle I(a,b):=\int_0^{2\pi}\exp\left(\frac{1+ab+(a+b)\cos x}{b^2+1+2b\cos x}\right) \cos\left(\frac{(b-a)\sin x}{b^2+1+2b\cos x}\right)dx.

Show that

\displaystyle I(a,b)=\begin{cases} 2\pi e & \text{if} \ b=0 \ \text{or} \ |b| < 1 \\ 2\pi e^{a/b} & \text{if} \ |b| > 1.\end{cases}

Hint. Make the substitution \displaystyle \tan\left(\frac{x}{2}\right)=\left|\frac{b+1}{b-1}\right|\tan \left(\frac{t}{2}\right) and just do as I did in the solution of the above problem.

Remark. We also have I(a,\pm 1)=2\pi e^{\min\{1,\pm a\}}. That quickly follows if we make the substitution \displaystyle \tan\left(\frac{\pi}{2}\right)=t and use the identity \displaystyle \int_0^{\infty} \frac{\cos(\alpha x)}{x^2+1} \ dx=\frac{\pi}{2}e^{-|\alpha|}, which holds for all real numbers \alpha but I have not discussed it in this blog yet.

Limit of integrals (16)

It’s nice to see examples where limit of integrals are used to evaluate integrals. In this post, I give one of those examples.

Problem 1. Show that \displaystyle \lim_{n\to\infty} \int_0^{2\pi} \frac{\cos(nx)}{\cos x + c} \ dx = 0 for any real number c > 1.

Solution. Use integration by parts with \cos(nx) \ dx = dv and \displaystyle \frac{1}{\cos x + c} = u to get

\displaystyle \int_0^{2\pi} \frac{\cos(nx)}{\cos x + c} \ dx = -\frac{1}{n}\int_0^{2\pi} \frac{\sin (nx)\sin x}{(\cos x + c)^2} \ dx

The result now follows because \displaystyle \frac{\sin (nx)\sin x}{(\cos x + c)^2} is bounded. \Box

Problem 2. Given an integer n \ge 0 and real number c > 1, show that

\displaystyle J_n:=\int_0^{2\pi} \frac{\cos(nx)}{\cos x + c} \ dx=\frac{2\pi}{\sqrt{c^2-1}}(-c+\sqrt{c^2-1})^n.

Solution. First see that \displaystyle J_0=\frac{2\pi}{\sqrt{c^2-1}} and \displaystyle J_1=2\pi-cJ_0. For n \ge 2 we have

\displaystyle \begin{aligned} J_n=\int_0^{2\pi} \frac{2\cos x \cos((n-1)x)-\cos((n-2)x)}{\cos x + c} \ dx=-2cJ_{n-1}-J_{n-2}\end{aligned}

and therefore \displaystyle J_n+2cJ_{n-1}+J_{n-2}=0, which has the characteristic polynomial r^2+2cr+1=0 with the roots \displaystyle r=-c \pm \sqrt{c^2-1}. So

\displaystyle J_n=\alpha (-c+\sqrt{c^2-1})^n+\beta (-c-\sqrt{c^2-1})^n

for some constants \alpha, \beta. Since, by Problem 1, \displaystyle \lim_{n\to\infty}J_n=0, we must have \beta=0 (why ?) and so \displaystyle J_n=\alpha (-c+\sqrt{c^2-1})^n. We also have \displaystyle \alpha=J_0=\frac{2\pi}{\sqrt{c^2-1}}. and that completes the solution. \Box

Problem 3. Given integers m,n with 0 \le m \le n and real numbers a,b,c with c > 1, show that

\displaystyle I_{m,n}:=\int_0^{2\pi} \frac{(a\cos x + b)^m\cos(nx)}{\cos x + c} \ dx=\frac{2\pi (b-ac)^m}{\sqrt{c^2-1}}(-c+\sqrt{c^2-1})^n.

Solution. We first show that, given integers k,n with n \ge 1 and 0 \le k \le n-1,

\displaystyle \int_0^{2\pi}(\cos x + c)^k\cos (nx) \ dx =0. \ \ \ \ \ \ \ \ (1)

The proof of (1) is by induction over k. It’s clear for k=0 and the claim follows from the following identity

\displaystyle \begin{aligned} (\cos x + c)^k\cos(nx)=\frac{1}{2}(\cos x + c)^{k-1}(\cos((n+1)x)+\cos((n-1)x)+2c\cos(nx)).\end{aligned}

Next, we show that

\displaystyle I_{m,n}=(b-ac)^m \int_0^{2\pi} \frac{\cos(nx)}{\cos x + c} \ dx. \ \ \ \ \ \ \ \ \ (2)

To prove (2), in I_{m,n}, write \displaystyle a\cos x +b = a(\cos x + c)+b-ac and then expand (a\cos x +b)^m using the binomial theorem. Then divide by \cos x + c and use (1) to finish the proof. Now (2) and Problem 2 together complete the solution. \Box

Solutions of tan(x) = x

The function f(x):=\tan x - x is odd and so to study the roots of f, we only need to study positive roots of f, which is what we’re going to do in this post. We begin with a basic fact.

Problem 1. Consider the function f(x):=\tan x - x. For an integer n \ge 1, let U_n be the interval \displaystyle \left(n\pi, n\pi+\frac{\pi}{2}\right). Show that

i) f is increasing on any interval which is in its domain

ii) the set of positive roots of f is a sequence \displaystyle \{x_n : \ \ n \ge 1\} where x_n \in U_n.

Solution. i) f'(x)=\tan^2x \ge 0.

ii) Let n \ge 1 be an integer. We have f(n\pi)=-n\pi < 0. Also, the limit of f(x) as x approaches \displaystyle n\pi+\frac{\pi}{2}, from the left, is +\infty. Since f is continuous in U_n, the intermediate value theorem implies that f(x_n)=0 for some \displaystyle x_n \in U_n. Since, by i), f is increasing on U_n, \ x_n is the unique root of f in U_n.
Finally, f has no other positive roots because f is positive on \displaystyle \left(0,\frac{\pi}{2}\right), and negative on the interval \displaystyle \left((m-1)\pi+\frac{\pi}{2}, m\pi \right) for any integer m \ge 1 (why ?). \ \Box

Next, given integer n \ge 1, we’re going to refine the basic result given in Problem 1, ii), by finding an interval which is much smaller than U_n and still contains x_n. But first we need to prove something.

Problem 2. Show that the function

\displaystyle g(x):=x\cot x - \frac{\pi x}{2}+x^2, \ \ x \in (0,\pi),

is decreasing.

Solution. We find the first and the second derivatives of g; we have

\displaystyle g'(x)=\cot x - x \cot^2x+x-\frac{\pi}{2}, \ \ \ g''(x)=\frac{(2x-\sin(2x))\cos x}{\sin^3x}.

So g''(x) and \cos x have the same sign because both \sin x and 2x-\sin(2x) are positive on the interval (0,\pi). Thus the maximum of g' occurs at \displaystyle x=\frac{\pi}{2} and so g'(x) \le g'(\pi/2)=0. \ \Box

Problem 3. Let \{x_n\}_{n\ge 1} be the sequence of positive roots of f(x)=\tan x - x. Show that

\displaystyle n\pi-\frac{1}{n\pi}+\frac{\pi}{2} < x_n < n\pi-\frac{2}{n\pi^2}+\frac{\pi}{2}.

Solution. Let \displaystyle y_n:=n\pi-\frac{1}{n\pi}+\frac{\pi}{2} and \displaystyle z_n:=n\pi-\frac{2}{n\pi^2}+\frac{\pi}{2}. We are done if we show that f(y_n) < 0 and f(z_n) > 0. Let

\displaystyle g(x):=x\cot x - \frac{\pi x}{2}+x^2, \ \ x \in (0,\pi).

By Problem 2, g is decreasing and thus \displaystyle g(x) < \lim_{x\to{0^+}}g(x)=1 for all x \in (0,\pi). In particular, g(1/n\pi) < 1, i.e.

\displaystyle \frac{1}{n\pi}\cot(1/n\pi)-\frac{1}{2n}+\frac{1}{n^2\pi^2} < 1,

proving that f(y_n) < 0.
On the other hand, since \displaystyle \frac{2}{n\pi^2} \le \frac{2}{\pi^2} for all n \ge 1 and g is decreasing, we have \displaystyle g(2/n\pi^2) \ge g(2/\pi^2), i.e.

\displaystyle \frac{2}{n\pi^2}\cot(2/n\pi^2)-\frac{1}{n\pi}+\frac{4}{n^2\pi^4} \ge \frac{2}{\pi^2}\cot(2/\pi^2)-\frac{1}{\pi}+\frac{4}{\pi^4}

and that gives

\displaystyle f(z_n) \ge n\left(\cot(2/\pi^2)-\frac{3\pi}{2}+\frac{2}{\pi^2}\right) > 0. \ \Box

Example. For n=20, Problem 3 gives 64.386 < x_{20} < 64.3926 and the actual value of x_{20} is approximately 64.387. So the lower and upper bounds that Problem 3 gives for x_n are not that bad.

Exercise. Let \{x_n\}_{n\ge 1} be the positive solutions of the equation \tan(x)=x.

i) Show that \displaystyle \lim_{n\to\infty} (x_n-n\pi)=\frac{\pi}{2} and \displaystyle \lim_{n\to\infty} \frac{x_n}{n}=\lim_{n\to\infty}(x_n-x_{n-1})=\pi.

ii) Show that the series \displaystyle \sum_{n=1}^{\infty}\frac{1}{x_n} is divergent.

iii) Let \lfloor - \rfloor be the floor function. Is it true that \displaystyle \lfloor x_n \rfloor = \left \lfloor n\pi-\frac{1}{n\pi}+\frac{\pi}{2} \right \rfloor for all n \ge 1 ?

Integral inequalities (2)

Throughout this post, \displaystyle f:[0,\infty) \longrightarrow [0,1] is an integrable function, i.e. \displaystyle \int_0^xf(s) \ ds exists for any x \ge 0. Every continuous function is integrable but the converse is not true, e.g. think of functions that are piecewise continuous.

Problem 1. Suppose that there exists r \in [0,1) such that \displaystyle f(x) \le \int_0^x (f(s))^rds for all x \ge 0. Show that \displaystyle f(x) \le x^{\frac{1}{1-r}} for all x \ge 0.

Solution. The idea is to prove that

f(x) \le x^{1+r+ \cdots + r^n} \ \ \ \ \ \ \ \ \ (*)

for all x \ge 0 and all integers n \ge 0. Then taking limit of both sides of (*) as n\to\infty gives f(x) \le x^{\frac{1}{1-r}}, as required.
We prove (*) by induction over n. It is true for n=0 because

\displaystyle f(x) \le \int_0^x(f(s))^rds \le \int_0^xds=x.

Now suppose that (*) is true for n. Then

\displaystyle \begin{aligned} f(x) \le \int_0^x(f(s))^rds \le \int_0^x(s^{1+r+ \cdots + r^n})^rds=\int_0^x s^{e+r^2+ \cdots + r^{n+1}}ds \\ =\frac{1}{1+r + \cdots + r^{n+1}}x^{1+r+ \cdots + r^{n+1}} \le x^{1+r+ \cdots + r^{n+1}}. \ \Box \end{aligned}

Problem 2. Suppose that there exists r \ge 0 such that \displaystyle f(x) \le r\int_0^xf(s) \ ds for all x \ge 0. Show that f(x)=0 for all x \ge 0.

Solution. The claim is obviously true for x=0. Now let x > 0. We have

\displaystyle \begin{aligned} 0 \le f(x) \le r\int_0^{x} f(s_1) \ ds_1 \le r^2 \int_0^{x} \int_0^{s_1}f(s_2) \ ds_2 \ ds_1 \le \cdots \\ \le r^n \int_0^{x} \int_0^{s_1} \cdots \int_0^{s_{n-1}}f(s_n) \ ds_n \ ds_{n-1} \ \cdots \ ds_1 \\ \le r^n \int_0^{x} \int_0^{s_1} \cdots \int_0^{s_{n-1}} \ ds_n \ ds_{n-1} \ \cdots \ ds_1=\frac{(rx)^n}{n!}. \end{aligned}

Thus \displaystyle 0 \le f(x) \le \lim_{n\to\infty} \frac{(rx)^n}{n!}=0 and so f(x)=0. \ \Box

Exercise 1. Solve Problem 2 using induction, i.e. show, by induction over n, that \displaystyle f(x) \le \frac{(rx)^n}{n!} for all x \ge 0.

Exercise 2.  Let c be a real number. By the ratio test, the series \displaystyle \sum_{n=0}^{\infty}\frac{c^n}{n!} converges (to e^c) and so, as a result, \displaystyle \lim_{n\to\infty} \frac{c^n}{n!}=0.
Using the definition of limit, prove that \displaystyle \lim_{n\to\infty} \frac{c^n}{n!}=0.

Integral inequalities (1)

Problem. Show that if \displaystyle f: [0,1] \longrightarrow (-\infty,1] is a continuous function such that \displaystyle \int_0^1 f(x) \ dx = 0, then \displaystyle \int_0^1 (f(x))^3 dx < \frac{1}{4}.

Solution. Since f(x) \le 1 for all x \in [0,1], we have (f(x)-1)(2f(x)+1)^2 \le 0 for all x \in [0,1]. Therefore

\displaystyle 4(f(x))^3-3f(x)-1 \le 0 \ \ \ \ \ \ (*)

and integrating (*) gives \displaystyle \int_0^1(f(x))^3 \ dx \le \frac{1}{4}.
But can we have equality? The answer is no and here’s why. If \displaystyle \int_0^1(f(x))^3 \ dx = \frac{1}{4}, then \displaystyle \int_0^1(4(f(x))^3-3f(x)-1) \ dx=0 and thus, by (*) and Problem 1 in this post, \displaystyle 4(f(x))^3-3f(x)-1=0 for all x \in [0,1]. Therefore \displaystyle (f(x)-1)(2f(x)+1)^2=0 for all x \in [0,1] and hence, for every x \in [0,1], either f(x)=1 or \displaystyle f(x)=\frac{-1}{2}. Thus, since f is continuous, either \displaystyle f(x)=1 for all x \in [0,1] or \displaystyle f(x)=\frac{-1}{2} for all x \in [0,1]. In either case, \displaystyle \int_0^1 f(x) \ dx \ne 0 and \displaystyle \int_0^1 (f(x))^3 dx \ne \frac{1}{4}. \ \Box

Exercise. Extend the result given in the above problem by proving that if f:[a,b] \longrightarrow \mathbb{R} is continuous and if \displaystyle 0 \ne M:=\max_{x \in [a,b]} f(x), then

\displaystyle \int_a^b (f(x))^3dx < \frac{3}{4}M^2\int_a^bf(x) \ dx + \frac{b-a}{4}M^3.

Hint. (f(x)-M)(2f(x)+M)^2 \le 0 for all x \in [a,b].

The series \sum 1/(n^2 + a^2)

Problem. Show that \displaystyle \sum_{n=1}^{\infty} \frac{1}{n^2+a^2}=\frac{\pi a \coth(\pi a)-1}{2a^2} for all real numbers a \ne 0.

Solution. Since \displaystyle \sum_{n=1}^{\infty} \frac{1}{n^2+a^2} is an even function of a, we may assume that a > 0.
First see that

\displaystyle \int_0^{\infty}\sin(bx)e^{-ax} dx = \frac{b}{a^2+b^2}

for all real numbers a>0, \ b. So

\displaystyle \begin{aligned} \sum_{n=1}^{\infty} \frac{1}{n^2+a^2}=\sum_{n=1}^{\infty}\frac{1}{n}\int_0^{\infty}\sin(nx)e^{-ax} dx=\int_0^{\infty}\left(\sum_{n=1}^{\infty} \frac{\sin(nx)}{n}\right)e^{-ax}dx \\ =\sum_{k=0}^{\infty} \int_{2k\pi}^{(2k+1)\pi}\left(\sum_{n=1}^{\infty}\frac{\sin(nx)}{n}\right)e^{-ax}dx=\sum_{k=0}^{\infty}\int_0^{2\pi}\left(\sum_{n=1}^{\infty}\frac{\sin(nx)}{n}\right)e^{-a(2k\pi+x)}dx.\end{aligned}

But we showed here (you should also see Exercise 2 in that post!) that for x \in (0,2\pi), we have \displaystyle \sum_{n=1}^{\infty}\frac{\sin(nx)}{n}=\frac{\pi-x}{2}. So

\displaystyle \begin{aligned} \sum_{n=1}^{\infty} \frac{1}{n^2+a^2}=\sum_{k=0}^{\infty}e^{-2k\pi a}\int_0^{2\pi}\left(\frac{\pi-x}{2}\right)e^{-ax}dx  =\left(\frac{\pi(e^{-2\pi a}+1)}{2a}+\frac{e^{-2\pi a}-1}{2a^2}\right)\sum_{k=0}^{\infty}e^{-2k\pi a} \\ =\left(\frac{\pi(e^{-2\pi a}+1)}{2a}+\frac{e^{-2\pi a}-1}{2a^2}\right) \frac{1}{1-e^{-2\pi a}}=\frac{\pi(1+e^{-2\pi a})}{2a(1-e^{-2\pi a})}-\frac{1}{2a^2} \\ = \frac{\pi}{2a}\coth(\pi a)-\frac{1}{2a^2}=\frac{\pi a \coth(\pi a)-1}{2a^2}. \ \Box \end{aligned}

Remark. In the above solution, we, once again, allowed ourselves to integrate an infinite series term by term. As I have mentioned many times in this blog, this is not always allowed.

Exercise 1. Show that \displaystyle \int_0^{\infty}\sin(bx)e^{-ax} dx = \frac{b}{a^2+b^2} for all real numbers a>0, \ b.
Hint. Use integration by parts twice.

Exercise 2. Evaluate \displaystyle \lim_{a\to0} \frac{\pi a \coth(\pi a)-1}{2a^2}. Now, considering the result given in the above problem and the fact that \displaystyle \sum_{n=1}^{\infty} \frac{1}{n^2}=\frac{\pi^2}{6}. that we proved here, does the value of the limit make sense?