% vim: tw=50
% 03/03/2023 10AM

\begin{example*}
    Evaluate $\int_{-\infty}^\infty \frac{\cos
    mx}{x^2 + 1} \dd x$, $m \in \RR$. $\cos z$ is
    large for $iR = z$ large $R$, so instead
    \[ \cos mx = \Re(\eps(imx)) \implies I = \Re
    \left( \int_{-\infty}^\infty
    \frac{e^{imx}}{x^2 + 1} \dd x \right) \]
    Useful contour:
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/d5562df6b9ac11ed.png}
    \end{center}
    Call this $\gamma_R$. If $m > 0$, Jordan's
    lemma implies $\int_{C_R'} \frac{e^{imz}}{z^2
    + 1} \dd z \to 0$ as $R \to \infty$. Residue
    theorem gives
    \begin{align*}
        \int_{\gamma_R} \frac{e^{imz}}{z^2 + 1}
        \dd z
        &= 2\pi i \Res_{z = i} \frac{e^{imz}}{z^2
        + 1} \\
        &= 2\pi i \cdot \frac{e^{im(i)}}{1 + i} \\
        &= \pi e^{-m}
    \end{align*}
    So
    \[ \pi e^{-m} = \int_{C_R'} \frac{e^{imz}}{z^2
    + 1} \dd z + \int_{-R}^R \frac{e^{imz}}{z^2 +
    1} \dd z \implies I = \frac{\pi}{e^m}, \quad m
    > 0 \]
    If $m < 0$, $\cos(mx) = \cos(-mx)$, so $I =
    \frac{\pi}{e^{-m}}$ by previous computation.
    If $m = 0$, we have
    \[ \left| \int_{C_R'} \frac{1}{z^2 + 1} \dd z
    \right| \le \frac{\pi R}{R^2 - 1} \to 0 \]
    as $R \to \infty$, so with the residue
    computation $\Res_{z = i} \frac{1}{z^2 + 1} =
    \frac{1}{2i}$ we have $I = \frac{\pi}{e^0} =
    \pi$. So in all cases, $I =
    \frac{\pi}{e^{|m|}}$.
\end{example*}

\begin{example*}
    Evaluate $\int_0^{2\pi} \frac{1}{5 +
    4\cos\theta}\dd \theta$. Let's use $\cos
    \theta = \half [e^{i\theta} + e^{-i\theta}]$,
    so $\cos\theta = \half \left[ z + \frac{1}{z}
    \right]$ for $z = e^{i\theta}$. So $\dd z =
    ie^{i\theta} = iz\dd \theta$.
    \begin{align*}
        \int_0^{2\pi} \frac{1}{5 + 4 \cos\theta}
        \dd \theta
        &= \int_{|z| = 1} \frac{1}{5 + 4 \left(
        \frac{z + \frac{1}{z}}{2} \right)} \cdot
        \frac{\dd z}{iz} \\
        &= \frac{1}{i} \int_{|z| = 1} \frac{1}{2z^2 + 5z
        + 2} \dd z \\
        &= \frac{1}{i} \int_{|z| = 1} \frac{1}{(2z
        + 1)(z + 2)} \dd z
    \end{align*}
    So we have
    \begin{center}
        \includegraphics[width=0.3\linewidth]
        {images/58aca2c2b9b011ed.png}
    \end{center}
    with winding number 1 around $z = -\half$. CIF
    applied to $\frac{1}{2(z + 2)}$ says
    \[ \frac{1}{2\left( -\half + 2 \right)} =
    \frac{1}{2\pi i} \int_{|z| = 1} \frac{1}{2(z +
    2)\left( z + \half \right)} \dd z \]
    so
    \[ \frac{2\pi i}{3} = \int_{|z| = 1}
    \frac{1}{2z^2 + 5z + 2} \dd z = i
    \int_0^{2\pi} \frac{1}{5 + 4 \cos\theta} \dd
    \theta \]
    so $\int_0^{2\pi} \frac{1}{5 + 4\cos\theta}
    \dd \theta = \frac{2\pi}{3}$.
\end{example*}

\begin{example*}
    Evaluate $\int_0^\infty \frac{\sin x}{x} \dd
    x$. Consider
    \begin{align*}
        \frac{1}{2i} \int_0^\infty \frac{e^{ix} -
        e^{-ix}}{x} \dd x
        &= \frac{1}{2i} \int_0^\infty
        \frac{e^{ix}}{x} \dd x - \frac{1}{2i}
        \int_0^{-\infty} \frac{e^{it}}{-t} (-\dd
        t) \\
        &= \frac{1}{2i} \int_{-\infty}^\infty
        \frac{e^{ix}}{x} \dd x
    \end{align*}
    Modify by considering $\gamma_{R,\eps}$
    contour.
    \begin{center}
        \includegraphics[width=0.3\linewidth]
        {images/070e400ab9b111ed.png}
    \end{center}
    Cauchy's theorem gives $\int_{\gamma_{R,
    \eps}} \frac{e^{iz}}{z} \dd z = 0$. Jordan's
    lemma gives $\int_{C_R'} \frac{e^{iz}}{z} \dd
    z \to 0$ as $R \to \infty$. On $C_\eps'$, $z =
    \eps e^{i\theta}$, $\dd z = i\eps e^{i\theta}
    \dd \theta = iz \dd \theta$, so
    \[ \int_{C_\eps} \frac{e^{iz}}{z} \dd z =
    \int_0^\pi e^{i\eps e^{i\theta}} i \dd \theta
    \to i\int_0^\pi 1 \dd \theta = \pi i \]
    as $\eps \to 0$. So
    \[ \int_{\gamma_{R, \eps}} \frac{e^{iz}}{z}
    \dd z = \int_{C_R'} \frac{e^{iz}}{z} \dd z +
    \int_{-R}^{-\eps} \frac{e^{iz}}{z} \dd z -
    \int_{C_\eps'} \frac{e^{iz}}{z} \dd z +
    \int_\eps^R \frac{e^{iz}}{z} \dd z \]
    As $\eps \to 0$, $R \to \infty$, we obtain
    \[ 0 = \int_{-\infty}^\infty \frac{e^{iz}}{z}
    \dd z - \pi i \]
    So
    \[ \int_0^\infty \frac{\sin x}{x} \dd x =
    \frac{1}{2i} \pi i = \frac{\pi}{2} \]
\end{example*}

\begin{example*}
    Evaluate $\int_0^\infty \frac{x^\alpha}{x^2 +
    1} \dd x$, $\alpha \in (0, 1)$. $z^\alpha =
    \exp(\alpha \log z)$, branch of log. 
    \myskip
    Claim:
    Let $\log z = \ln|z| + i\arg z$, $\arg z \in
    \left( -\frac{\pi}{2}, \frac{3\pi}{2}
    \right)$. Then for $x > 0$, we have
    $(-x)^\alpha = (-1)^\alpha x^\alpha$. Proof of
    the claim: $\log(-x) = \ln|x| + \pi i = \ln x
    + \pi i$ since $x > 0$. In particular,
    $\log(-1) = \pi i$. So $\log x + \log(-1) =
    \ln x + \pi i = \log(-x)$. So
    \[ \exp(\alpha \log x) \exp(\alpha \log(-1)) =
    \exp(\alpha \log(-x)) \]
    as claimed.
    \begin{center}
        \includegraphics[width=0.3\linewidth]
        {images/aa326c10b9b211ed.png}
    \end{center}
    So consider $\gamma_{R, \eps}$ as in previous
    example. Can show integrals along $C_R',
    C_\eps' \to 0$ as $R \to \infty$, $\eps \to
    0$. Residue theorem:
    \[ \Res_{z = i} \frac{\exp(\alpha\log z)}{(z +
    i)(z - i)} = \frac{i^\alpha}{2i} \]
    So
    \begin{align*}
        2\pi i \Res_{z = i} \frac{\exp(\alpha \log
        z)}{(z + i)(z - i)}
        &= \int_{\gamma_{R, \eps}}
        \frac{z^\alpha}{1 + z^2} \dd z \\
        &= \int_{C_R'} \frac{z^\alpha}{1 + z^2}
        \dd z - \int_{C_\eps'} \frac{z^\alpha}{z^2
        + 1} \dd z + \int_{-R}^{-\eps}
        \frac{z^\alpha}{z^2 + 1} + \int_\eps^R
        \frac{z^\alpha}{z^2 + 1} \dd z
    \end{align*}
    By substitution $t = -z$, we have
    \[ \int_{-R}^{-\eps} \frac{z^\alpha}{1 + z^2}
    \dd z = (-1)^\alpha \int_\eps^R
    \frac{z^\alpha}{z^2 + 1} \dd z \]
    So taking $\eps \to 0$, $R \to \infty$, we
    have
    \[ 2\pi i \frac{i^\alpha}{2i} = 0 - 0 +
    [(-1)^\alpha + 1] \int_0^\infty
    \frac{x^\alpha}{1 + x^2} \dd x \]
    so $\int_0^\infty \frac{x^\alpha}{1 + x^2} \dd
    x = \frac{\pi i^4}{1 + (-1)^\alpha}$.
\end{example*}

\begin{example*}
    Evaluate $\int_0^\infty \frac{x^{1/3}}{(x +
    2)^2} \dd x$. Let's define $\log z = \ln|z| +
    i\arg z$, $\arg z \in (0, 2\pi)$. We'll
    consider a ``keyhole contour'', $\gamma$.
    Integral on $\gamma$ of $\frac{z^{1/3}}{(z +
    2)^2}$.
    \begin{center}
        \includegraphics[width=0.3\linewidth]
        {images/f2153bd8b9b311ed.png}
    \end{center}
    On $C_1$:
    \[ \left| \int_{C_1} \frac{z^{1/3}}{(z + 2)^2}
    \dd z \right| \le (2\pi - 2\delta)R \cdot
    \frac{R^{1/3}}{(R - 2)^2} \to 0 \]
    as $R \to \infty$. On $C_2$:
    \[ \left| \int_{C_2} \frac{z^{1/3}}{(z - 2)^2}
    \dd z \right| \le (2\pi - 2\delta)\eps
    \frac{\eps^{1/3}}{(2 - \eps)^2} \to 0 \]
    as $\eps \to 0$. On $L_1$, $z = te^{i\delta}$,
    $t \in [\eps, R]$, $\dd z = e^{i\delta} \dd t$.
    \[ \int_\eps^R \frac{t^{1/3}
    e^{i\delta/3}}{(te^{i\delta} + 2)^2}
    e^{i\delta} \dd t \to \int_\eps^R
    \frac{t^{1/3}}{(t + 2)^2} \dd t \]
    as $\delta \to 0$. On $L_2$, $z = te^{i(2pi -
    \delta)}$,
    \[ \int_\eps^R \frac{t^{1/3} e^{i \frac{2\pi -
    \delta}{3}}}{(te^{i(2\pi - \delta)} + 2)^2}
    e^{i(2\pi - \delta)} \dd t \to e^{2\pi i/3}
    \int_\eps^R \frac{t^{1/3}}{(t + 2)^2} \dd t \]
    So we have by residue theorem,
    \[ O \left( \frac{1}{R^{2/3}} \right) - e^{2pi
    i/3} \int_\eps^R \frac{t^{1/3}}{(t + 2)^2} \dd
    t - O \left( \eps^{4/3} \right) + \int_\eps^R
    \frac{t^{1/3}}{(t + 2)^2} \dd t = \Res_{z =
    -2} \frac{z^{1/3}}{(z + 2)^2} \cdot 2\pi i \]
    Then taking $\eps \to 0$ and $R \to \infty$ we
    get
    \[ (1 - e^{2\pi i/3}) \int_0^\infty
    \frac{t^{1/3}}{(t + 2)^2} \dd t = 2\pi i
    \Res_{z = -2} \frac{z^{1/3}}{(z + 2)^2} \]
    Using residue computation trick (iii), this
    residue is
    \[ \left. \dfrac{}{z} \right|_{z = -2} =
    \left. \dfrac{}{z} \right|_{z = -2} \exp
    \left( \frac{1}{3} \log z \right) =
    \left. \frac{1}{3z} \exp \left( \frac{1}{3} \log z
    \right) \right|_{z = -2} \]
    so $\Res_{z = -2} \frac{z^{1/3}}{(z + 2)^2} =
    -\frac{1}{6} \sqrt[3]{2} e^{\pi i/3}$. Can
    compute $\frac{e^{\pi i/3}}{(1 - e^{2\pi
    i/3}}= \frac{i}{\sqrt{3}}$, so $\int_0^\infty
    \frac{t^{1/3}}{(t + 2)^2} \dd t =
    \frac{\pi}{3\sqrt{3}} \sqrt[3]{2}$.
\end{example*}
