Learning Contour Integration

KVZ Lv1

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

0cos2xx4+1 dx Using the power reduction formulacos2x=1+cos2x2=1201+cos2xx4+1 dx Extending this to the entire real line=141+cos2xx4+1 dx Selecting a contour of the upper semicirclePoles at z=eπi4,e3πi4 14Re(1z4+1 dz+e2izz4+1 dz)\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}

Solving for 1z4+1 dz\oint\frac{1}{z^4+1}\ dz

1z4+1 dz=2πiRes(1z4+1,zk)Where z0=eπi4 and z1=e3πi4 Res(1z4+1,zk)=14zk3Since zk4=1Res(1z4+1,zk)=zk4 Res(1z4+1,z0)+Res(1z4+1,z0)=eπi44e3πi44=14(eπi4+e3πi4)=18(2+2i2+2i)=2i42πiRes(1z4+1,zk)=2πi2i4=π22\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}

Solving for e2izz4+1 dz\oint \frac{e^{2iz}}{z^4+1}\ dz

e2izz4+1 dz=2πiRes(e2izz4+1,zk)Where z0=eπi4 and z1=e3πi4 Res(e2izz4+1,zk)=e2iz4zk3Since zk4=1Res(e2izz4+1,zk)=zke2iz4 Evaluating pole at z=eπi4Res(e2izz4+1,eπi4)=eπi4e2ieπi44 2ieπi4=2i(2+2i2)=2i2 Res(e2izz4+1,eπi4)=eπi4e2i24=ei(π4+2)e24 Evaluating pole at z=e3πi4Res(e2izz4+1,e3πi4)=e3πi4e2ie3πi44 2ie3πi4=2i(2+2i2)=2i2 Res(e2izz4+1,e3πi4)=e3πi4e2i24=ei(3π42)e24 2πiRes(e2izz4+1,zk)=2πi(ei(π4+2)e24ei(3π42)e24)=πi2e2(ei(π4+2)+ei(3π42))=πie2(ei(π4+2))=πie2(cos(π4+2)+isin(π4+2))=πie2cos(π4+2)+πe2sin(π4+2)Since we are taking the real part:=πe2sin(π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}

Substituting into original integral

14Re(1z4+1 dz+e2izz4+1 dz)=14(π22+πe2sin(π4+2))=π28+πe2sin(π4+2)40.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}

  • Title: Learning Contour Integration
  • Author: KVZ
  • Created at : 2026-06-10 09:43:55
  • Updated at : 2026-06-11 11:11:33
  • Link: https://kvznmx.com/Learning-Contour-Integration/
  • License: This work is licensed under CC BY-NC-SA 4.0.