Evaluating integrals of the form $\int_{-\infty}^{\infty}R(x)\sin(x)dx$ I was reading a complex analysis textbook written by Joseph Bak and Donald Newman. And I was on the part of evaluating integrals of the form $\int_{-\infty}^{\infty}R(x)\sin(x)dx$ where $R(x)=P(x)/Q(x)$ is an integrable rational function, specifically $degQ>deg P$. I have a few questions regarding some arguments on it (I will write down some arguments below, and there is a list of questions that I have in the very end of the post).
The argument goes as follows: Consider the contour shown below:

And let the radius of this semicircle be $M$, and denote by $\Gamma_M$ the circular boundary of this contour. And let $C_M$ denote the entire contour. Consider the integral
$$\int_{C_M}R(z)e^{iz}dz.$$
We want to show that
$$
\int_{\Gamma_M}R(z)e^{iz}dz\to 0
$$
as $M\to 0$. Fix a constant $h$ and let $A=\{z\in\Gamma_M:\operatorname{Im}(z)\geq h\}$ and $B=\{z\in\Gamma_M:\operatorname{Im}(z)< h\}$. We can do $\int_A$ and show it goes to zero by taking $h=\sqrt{M}$, which I understand, but when we do $\int_B$, it says
$$
\left|\int_B R(z)e^{iz}dz\right|\leq \frac{K}{M}4h.
$$
Here we assume $|R(z)|\leq K/|z|$ for large enough $z$. But how did we get the bound $\left|\int_B e^{iz}dz\right|\leq 4h$? If we can show this then again by taking $h=\sqrt{M}$ we get $\int_B\to 0$ as $M\to \infty$.
Sorry, this is kind of a mess. A full proof is in Bak and Newman's complex analysis, pg 145-147 in the third edition. So my questions are:

*

*How did we get $\left|\int_B R(z)e^{iz}dz\right|\leq \frac{K}{M}4h$ when doing an integral along $B$?


*This is kinda stupid, but how can we show that if $R(z)=P(z)/Q(z)$ where $deg P<deg Q$, then we have $|R(z)|\leq K/|z|$ for some constant $K$? I assume this happens when $z$ is large though.
I am new to residue theorem and using it to evaluate integrals. I tried finding similar posts on the forum but I didn't find much. Thank comment will be helpful! Thank you so much!
 A: By drawing graphs it is not too hard to see that
$$\sin^{-1}(t)\le 2t$$
for $0\le t\le 1$.  Then the total length of the two pieces of the circle comprising $B$ is
$$2M\sin^{-1}\frac{h}{M}\le 4h\ .$$
You can also see this intuitively (maybe!) by noting that as $M$ becomes large, the arc of circle gets closer and closer to a vertical line of height $h$ and therefore less than $2h$.  Not sure how rigorous this is.
Must say this method seems pretty complicated to me, but perhaps that's just because I'm used to doing this kind of thing by Jordan's Inequality.
A: After some discussion I think I understand the argument now, although this is only for future reference, I think I'll go over the entire argument here.
So we want to evaluate integral of the from $I=\int_{-\infty}^\infty R(x)\sin(x)dx$, where $R(x)=P(x)/Q(x)$ with $degQ>deg P$. Then we first note that for $|z|>M$, there exists a constant $K_M$ such that $|R(z)|\leq K_M/|z|$. To see this, suppose $P(z)=a_0+\cdots+a_nz^n, Q(z)=b_0+\cdots+b_mz^m$ with $n<m$ and $a_n,b_m\neq 0$, we can write
$$
\left|\frac{P(z)}{Q(z)}\right|=\left|\frac{1}{z^{m-n}}\right|\cdot\left|\frac{\frac{a_0}{z^n}+\cdots+a_n}{\frac{b_0}{z^{m-2n}}+\cdots+b_n}\right|
$$
as $M\to\infty$. So when $M$ is large enough, we can take $\left|\frac{\frac{a_0}{z^n}+\cdots+a_n}{\frac{b_0}{z^{m-2n}}+\cdots+b_n}\right|\leq \left|\frac{a_n}{b_n}\right|+1\equiv K_M$, then $|P/Q|\leq K_M/|z|^{m-n}\leq K_M/|z|$. To evaluate $I$, we consider the integral
$$\int_{C_M} R(z)e^{iz}dz$$
over the following contour $C_M$, consisting of a semicircular arc $\Gamma_M$ with radius $M$, and the horizontal axis $-M\leq x\leq M$, shown below.

We will show that
$$\int_{\Gamma_M}R(z)e^{iz}dz\to 0$$
as $M\to\infty$. Then by the Residue theorem we will have that
$$
I=\int_{-\infty}^\infty R(x)\cos xdx=\operatorname{Re}\left[2\pi i\sum_{k}Res(R(z)e^{iz},z_k)\right]
$$
where $z_k$ are the poles of $R(z)$ in the upper half plane. To show that $\int_{\Gamma_M}R(z)e^{iz}dz\to 0$ when $M\to\infty$, consider
$$
A=\left\{z\in\Gamma_M:\operatorname{Im}z\geq h\right\}\\
B=\left\{z\in\Gamma_M:\operatorname{Im}z< h\right\}
$$
for some fixed real number $h$. We use the fact that $|R(z)|\leq K/|z|$ on $M$ and $|e^{iz}|=|e^{i(x+iy)}|=|e^{ix}|\cdot|e^{-y}|=e^{-y}$. Then the integral on $A$ is bounded by
$$
\int_A |R(z)r^{iz}|dz\leq \frac{K}{M}e^{-h}\pi M.
$$
Now, let $\sin\varphi=h/M$. Choose $M$ so large that $\varphi$ is so small such that $\sin\varphi>\varphi/2$ (we can do this since when $\varphi$ is small we have $\sin\varphi\sim\varphi$). Then $|\Gamma_B|=2M\varphi<4M\sin\varphi=4M(h/M)=4h$. And for $0\leq y<h$ we have $|e^{-y}|\leq 1$Then we have the bound for integral along $B$ given by
$$
\int_{B}|R(z)e^{iz}|dz\leq \frac{K}{M}4h.
$$
Putting everything together, and letting $h=\sqrt{M}$ we have that,
$$
\left|\int_{\Gamma_M}R(z)e^{iz}dz\right|\leq (K\pi)e^{-\sqrt{M}}+\frac{4K}{\sqrt{M}}\to 0
$$
as $M\to \infty$.

Here is an example:
Evaluate $\int_{-\infty}^\infty\frac{\sin x}{x}dx$. Note that if we write $\int_{-\infty}^\infty\frac{\sin x}{x}dx=\operatorname{Im}\int_{-\infty}^\infty\frac{e^{ix}}{x}dx$, then there is a pole of $e^{ix}/x$ at zero, so we have to modify our strategy a little bit. Instead we notice
$$\int_{-\infty}^\infty\frac{\sin x}{x}dx=\operatorname{Im}\int_{-\infty}^\infty\frac{e^{ix}-1}{x}dx.$$
Now,
$$
\int_{C_M}\frac{e^{iz}-1}{z}dz=\int_{-M}^{M}\frac{e^{ix}-1}{x}dx+\int_{\Gamma_M}\frac{e^{iz}-1}{z}dz.
$$
Since $\frac{e^{iz}-1}{z}=(z+z^2/2!+\cdots)/z=1+z/2!+\cdots$ is analytic, Cauchy's theorem implies
$$\int_{C_M}\frac{e^{iz}-1}{z}dz=0.$$
Thus we have
$$\begin{aligned} \int_{-M}^{M} \frac{e^{i x}-1}{x} d x &=\int_{\Gamma_{M}} \frac{1-e^{i z}}{z} d z=\int_{\Gamma_{M}} \frac{1}{z} d z-\int_{\Gamma_{M}} \frac{e^{i z}}{z} d z \\ &=\pi i-\int_{\Gamma_{M}} \frac{e^{i z}}{z} d z. \end{aligned}$$
We claim that
$$
\int_{\Gamma_M}\frac{e^{iz}}{z}dz\to 0
$$
as $M\to 0$. To do this let $z=Me^{it}$ with $0\leq t\leq \pi$, then $dz=iMe^{it}$, and this gives
$$
\left|\int_{\Gamma_M}\frac{e^{iz}}{z}dz\right|=\left|\int_0^{\pi}e^{iMe^{it}}dt\right|=\left|\int_0^{\pi} e^{iM\cos t-M\sin t}dt\right|\leq \left|\int_0^\pi e^{-M\sin t}dt\right|\to 0
$$
if $M\to \infty$. So we have
$$\int_{-\infty}^{\infty} \frac{e^{i x}-1}{x} d x=\pi i$$
and
$$\int_{-\infty}^{\infty} \frac{\sin x}{x} d x=\pi.$$
