Learning Contour Integration
Prelude
I was bored (even though I had like quite a few SACs coming up), so I chose to learn a bit of contour integration. I think I started learning because I thought it’d be useful in Daily Integrals, and today there was this one integral that is doable with contour integrals!
Daily Integral 10/6/26 - Hard
Setting up the integral
∫ 0 ∞ cos 2 x x 4 + 1 d x Using the power reduction formula cos 2 x = 1 + cos 2 x 2 = 1 2 ∫ 0 ∞ 1 + cos 2 x x 4 + 1 d x Extending this to the entire real line = 1 4 ∫ − ∞ ∞ 1 + cos 2 x x 4 + 1 d x Selecting a contour of the upper semicircle Poles at z = e π i 4 , e 3 π i 4 1 4 Re ( ∮ 1 z 4 + 1 d z + ∮ e 2 i z z 4 + 1 d z ) \begin{gathered}
\int_0^\infty \frac{\cos^2 x}{x^4+1}\ dx \\
\ \\
\text{Using the power reduction formula} \\
\cos^2 x = \frac{1 + \cos 2x}{2} \\
=\frac{1}{2}\int_0^\infty\frac{1+\cos 2x}{x^4+1}\ dx \\
\ \\
\text{Extending this to the entire real line} \\
=\frac{1}{4}\int_{-\infty}^\infty\frac{1+\cos 2x}{x^4+1}\ dx \\
\ \\
\text{Selecting a contour of the upper semicircle} \\
\text{Poles at $z=e^{\frac{\pi i}{4}}, e^{\frac{3\pi i}{4}}$} \\
\ \\
\frac{1}{4}\text{Re}(\oint\frac{1}{z^4+1}\ dz + \oint \frac{e^{2iz}}{z^4+1}\ dz)
\end{gathered}
∫ 0 ∞ x 4 + 1 cos 2 x d x Using the power reduction formula cos 2 x = 2 1 + cos 2 x = 2 1 ∫ 0 ∞ x 4 + 1 1 + cos 2 x d x Extending this to the entire real line = 4 1 ∫ − ∞ ∞ x 4 + 1 1 + cos 2 x d x Selecting a contour of the upper semicircle Poles at z = e 4 π i , e 4 3 π i 4 1 Re ( ∮ z 4 + 1 1 d z + ∮ z 4 + 1 e 2 i z d z )
Solving for ∮ 1 z 4 + 1 d z \oint\frac{1}{z^4+1}\ dz ∮ z 4 + 1 1 d z
∮ 1 z 4 + 1 d z = 2 π i ∑ Res ( 1 z 4 + 1 , z k ) Where z 0 = e π i 4 and z 1 = e 3 π i 4 Res ( 1 z 4 + 1 , z k ) = 1 4 z k 3 Since z k 4 = − 1 Res ( 1 z 4 + 1 , z k ) = − z k 4 ∴ Res ( 1 z 4 + 1 , z 0 ) + Res ( 1 z 4 + 1 , z 0 ) = − e π i 4 4 − e 3 π i 4 4 = − 1 4 ( e π i 4 + e 3 π i 4 ) = − 1 8 ( 2 + 2 i − 2 + 2 i ) = − 2 i 4 ∴ 2 π i ∑ Res ( 1 z 4 + 1 , z k ) = 2 π i ⋅ − 2 i 4 = π 2 2 \begin{gathered}
\oint\frac{1}{z^4+1}\ dz = 2\pi i \sum \text{Res}(\frac{1}{z^4+1}, z_k) \\
\text{Where $z_0 = e^{\frac{\pi i}{4}}$ and $z_1 = e^{\frac{3\pi i}{4}}$} \\
\ \\
\text{Res}(\frac{1}{z^4+1}, z_k) = \frac{1}{4z_k^3} \\
\text{Since $z_k^4 = -1$} \\
\text{Res}(\frac{1}{z^4+1}, z_k) = -\frac{z_k}{4}
\ \\
\therefore \text{Res}(\frac{1}{z^4+1}, z_0) + \text{Res}(\frac{1}{z^4+1}, z_0) = -\frac{e^{\frac{\pi i}{4}}}{4} - \frac{e^{\frac{3 \pi i}{4}}}{4} \\
= -\frac{1}{4}(e^{\frac{\pi i}{4}}+e^{\frac{3\pi i}{4}}) \\
= -\frac{1}{8}(\sqrt 2 + \sqrt 2 i - \sqrt 2 + \sqrt 2 i) \\
= -\frac{\sqrt 2 i}{4}\\
\therefore 2\pi i \sum \text{Res}(\frac{1}{z^4+1}, z_k) = 2\pi i \cdot -\frac{\sqrt 2 i}{4}\\
=\frac{\pi\sqrt 2}{2}
\end{gathered}
∮ z 4 + 1 1 d z = 2 π i ∑ Res ( z 4 + 1 1 , z k ) Where z 0 = e 4 π i and z 1 = e 4 3 π i Res ( z 4 + 1 1 , z k ) = 4 z k 3 1 Since z k 4 = −1 Res ( z 4 + 1 1 , z k ) = − 4 z k ∴ Res ( z 4 + 1 1 , z 0 ) + Res ( z 4 + 1 1 , z 0 ) = − 4 e 4 π i − 4 e 4 3 π i = − 4 1 ( e 4 π i + e 4 3 π i ) = − 8 1 ( 2 + 2 i − 2 + 2 i ) = − 4 2 i ∴ 2 π i ∑ Res ( z 4 + 1 1 , z k ) = 2 π i ⋅ − 4 2 i = 2 π 2
Solving for ∮ e 2 i z z 4 + 1 d z \oint \frac{e^{2iz}}{z^4+1}\ dz ∮ z 4 + 1 e 2 i z d z
∮ e 2 i z z 4 + 1 d z = 2 π i ∑ Res ( e 2 i z z 4 + 1 , z k ) Where z 0 = e π i 4 and z 1 = e 3 π i 4 Res ( e 2 i z z 4 + 1 , z k ) = e 2 i z 4 z k 3 Since z k 4 = − 1 Res ( e 2 i z z 4 + 1 , z k ) = − z k e 2 i z 4 Evaluating pole at z = e π i 4 Res ( e 2 i z z 4 + 1 , e π i 4 ) = − e π i 4 e 2 i e π i 4 4 2 i e π i 4 = 2 i ( 2 + 2 i 2 ) = 2 i − 2 Res ( e 2 i z z 4 + 1 , e π i 4 ) = − e π i 4 e 2 i − 2 4 = − e i ( π 4 + 2 ) e − 2 4 Evaluating pole at z = e 3 π i 4 Res ( e 2 i z z 4 + 1 , e 3 π i 4 ) = − e 3 π i 4 e 2 i e 3 π i 4 4 2 i e 3 π i 4 = 2 i ( − 2 + 2 i 2 ) = − 2 i − 2 Res ( e 2 i z z 4 + 1 , e 3 π i 4 ) = − e 3 π i 4 e − 2 i − 2 4 = − e i ( 3 π 4 − 2 ) e − 2 4 ∴ 2 π i ∑ Res ( e 2 i z z 4 + 1 , z k ) = 2 π i ( − e i ( π 4 + 2 ) e − 2 4 − e i ( 3 π 4 − 2 ) e − 2 4 ) = − π i 2 e − 2 ( e i ( π 4 + 2 ) + e i ( 3 π 4 − 2 ) ) = − π i e − 2 ( e i ( π 4 + 2 ) ) = − π i e − 2 ( cos ( π 4 + 2 ) + i sin ( π 4 + 2 ) ) = − π i e − 2 cos ( π 4 + 2 ) + π e − 2 sin ( π 4 + 2 ) Since we are taking the real part: = π e − 2 sin ( π 4 + 2 ) \begin{gathered}
\oint\frac{e^{2iz}}{z^4+1}\ dz = 2\pi i \sum \text{Res}(\frac{e^{2iz}}{z^4+1}, z_k) \\
\text{Where $z_0 = e^{\frac{\pi i}{4}}$ and $z_1 = e^{\frac{3\pi i}{4}}$} \\
\ \\
\text{Res}(\frac{e^{2iz}}{z^4+1}, z_k) = \frac{e^{2iz}}{4z_k^3} \\
\text{Since $z_k^4 = -1$} \\
\text{Res}(\frac{e^{2iz}}{z^4+1}, z_k) = -\frac{z_ke^{2iz}}{4} \\
\ \\
\text{Evaluating pole at $z=e^{\frac{\pi i}{4}}$} \\
\text{Res}(\frac{e^{2iz}}{z^4+1}, e^{\frac{\pi i}{4}}) = -\frac{e^{\frac{\pi i}{4}}e^{2ie^{\frac{\pi i}{4}}}}{4} \\
\ \\
2ie^{\frac{\pi i}{4}} = 2i(\frac{\sqrt 2 + \sqrt 2 i}{2}) \\
=\sqrt 2 i - \sqrt 2 \\
\ \\
\text{Res}(\frac{e^{2iz}}{z^4+1}, e^{\frac{\pi i}{4}}) = -\frac{e^{\frac{\pi i}{4}}e^{\sqrt 2 i - \sqrt 2}}{4} \\
= -\frac{e^{i(\frac{\pi}{4}+\sqrt 2)}e^{-\sqrt 2}}{4} \\
\ \\
\text{Evaluating pole at $z=e^{\frac{3\pi i}{4}}$} \\
\text{Res}(\frac{e^{2iz}}{z^4+1}, e^{\frac{3\pi i}{4}}) = -\frac{e^{\frac{3\pi i}{4}}e^{2ie^{\frac{3\pi i}{4}}}}{4} \\
\ \\
2ie^{\frac{3\pi i}{4}} = 2i(\frac{-\sqrt 2 + \sqrt 2 i}{2}) \\
=-\sqrt 2 i - \sqrt 2 \\
\ \\
\text{Res}(\frac{e^{2iz}}{z^4+1}, e^{\frac{3\pi i}{4}}) = -\frac{e^{\frac{3\pi i}{4}}e^{-\sqrt 2 i - \sqrt 2}}{4} \\
= -\frac{e^{i(\frac{3\pi}{4}-\sqrt 2)}e^{-\sqrt 2}}{4} \\
\ \\
\therefore 2\pi i \sum \text{Res}(\frac{e^{2iz}}{z^4+1}, z_k) = 2\pi i (-\frac{e^{i(\frac{\pi}{4}+\sqrt 2)}e^{-\sqrt 2}}{4} -\frac{e^{i(\frac{3\pi}{4}-\sqrt 2)}e^{-\sqrt 2}}{4}) \\
=-\frac{\pi i}{2}e^{-\sqrt 2}(e^{i(\frac{\pi}{4}+\sqrt 2)} + e^{i(\frac{3\pi}{4}-\sqrt 2)}) \\
=-\pi i e^{-\sqrt 2}(e^{i(\frac{\pi}{4}+\sqrt 2)}) \\
=-\pi i e^{-\sqrt 2}(\cos(\frac{\pi}{4}+\sqrt 2) + i\sin(\frac{\pi}{4}+\sqrt 2)) \\
=-\pi i e^{-\sqrt 2}\cos(\frac{\pi}{4} + \sqrt 2) + \pi e^{-\sqrt 2}\sin(\frac{\pi}{4}+\sqrt 2) \\
\text{Since we are taking the real part:} \\
= \pi e^{-\sqrt 2}\sin(\frac{\pi}{4}+\sqrt 2)
\end{gathered}
∮ z 4 + 1 e 2 i z d z = 2 π i ∑ Res ( z 4 + 1 e 2 i z , z k ) Where z 0 = e 4 π i and z 1 = e 4 3 π i Res ( z 4 + 1 e 2 i z , z k ) = 4 z k 3 e 2 i z Since z k 4 = −1 Res ( z 4 + 1 e 2 i z , z k ) = − 4 z k e 2 i z Evaluating pole at z = e 4 π i Res ( z 4 + 1 e 2 i z , e 4 π i ) = − 4 e 4 π i e 2 i e 4 π i 2 i e 4 π i = 2 i ( 2 2 + 2 i ) = 2 i − 2 Res ( z 4 + 1 e 2 i z , e 4 π i ) = − 4 e 4 π i e 2 i − 2 = − 4 e i ( 4 π + 2 ) e − 2 Evaluating pole at z = e 4 3 π i Res ( z 4 + 1 e 2 i z , e 4 3 π i ) = − 4 e 4 3 π i e 2 i e 4 3 π i 2 i e 4 3 π i = 2 i ( 2 − 2 + 2 i ) = − 2 i − 2 Res ( z 4 + 1 e 2 i z , e 4 3 π i ) = − 4 e 4 3 π i e − 2 i − 2 = − 4 e i ( 4 3 π − 2 ) e − 2 ∴ 2 π i ∑ Res ( z 4 + 1 e 2 i z , z k ) = 2 π i ( − 4 e i ( 4 π + 2 ) e − 2 − 4 e i ( 4 3 π − 2 ) e − 2 ) = − 2 π i e − 2 ( e i ( 4 π + 2 ) + e i ( 4 3 π − 2 ) ) = − π i e − 2 ( e i ( 4 π + 2 ) ) = − π i e − 2 ( cos ( 4 π + 2 ) + i sin ( 4 π + 2 ) ) = − π i e − 2 cos ( 4 π + 2 ) + π e − 2 sin ( 4 π + 2 ) Since we are taking the real part: = π e − 2 sin ( 4 π + 2 )
Substituting into original integral
1 4 Re ( ∮ 1 z 4 + 1 d z + ∮ e 2 i z z 4 + 1 d z ) = 1 4 ( π 2 2 + π e − 2 sin ( π 4 + 2 ) ) = π 2 8 + π e − 2 sin ( π 4 + 2 ) 4 ≈ 0.71 \begin{gathered}
\frac{1}{4}\text{Re}(\oint\frac{1}{z^4+1}\ dz + \oint \frac{e^{2iz}}{z^4+1}\ dz) \\
=\frac{1}{4}(\frac{\pi\sqrt 2}{2} + \pi e^{-\sqrt 2}\sin(\frac{\pi}{4}+\sqrt 2)) \\
=\boxed{\frac{\pi\sqrt 2}{8} + \frac{\pi e^{-\sqrt 2}\sin(\frac{\pi}{4}+\sqrt 2)}{4}} \\
\approx \boxed{0.71}
\end{gathered}
4 1 Re ( ∮ z 4 + 1 1 d z + ∮ z 4 + 1 e 2 i z d z ) = 4 1 ( 2 π 2 + π e − 2 sin ( 4 π + 2 ) ) = 8 π 2 + 4 π e − 2 sin ( 4 π + 2 ) ≈ 0 . 7 1