Contour integration

Part 1. Green’s functions for the Helmholtz (wave equation) operator in various dimensions.

September 18, 2025 math and physics play , , , , , , , , ,

[Click here for a PDF version of this post]

My favorite book on mathematical physics derives the Green’s function for the 3D Helmholtz (wave equation) operator. I tried to derive the 2D Green’s function the same way and had trouble. In this series of blog posts, I’ll attempt that again, but will start with the easier 1D and 3D cases. Presuming that I don’t hit any conceptual troubles trying both of those from first principles, I’ll attempt the seemingly trickier 2D case again.

Motivation and background.

We seek a solution to non-homogeneous Helmholtz equation
\begin{equation}\label{eqn:helmholtzGreens:20}
0 = \lr{ \spacegrad^2 + k^2 } U(\Bx) – V(\Bx).
\end{equation}

This is a problem that can be solved using Fourier transform techniques. Following [1], let’s write our transform pair in the symmetrical form:
\begin{equation}\label{eqn:helmholtzGreens:40}
\begin{aligned}
F(\Bx) &= \lr{\inv{\sqrt{2 \pi}}}^N \int \hat{F}(\Bp) e^{j \Bp \cdot \Bx} d\Bp \\
\hat{F}(\Bp) &= \lr{\inv{\sqrt{2 \pi}}}^N \int F(\Bx) e^{-j \Bp \cdot \Bx} d\Bx.
\end{aligned}
\end{equation}

Expressing \(U(\Bx), V(\Bx)\), in terms of their Fourier transforms, \ref{eqn:helmholtzGreens:20} becomes
\begin{equation}\label{eqn:helmholtzGreens:80}
\begin{aligned}
0 &=
\lr{ \spacegrad^2 + k^2 }
\lr{\inv{\sqrt{2 \pi}}}^N
\int \hat{U}(\Bp) e^{j \Bp \cdot \Bx} d\Bp

\lr{\inv{\sqrt{2 \pi}}}^N
\int \hat{V}(\Bp) e^{j \Bp \cdot \Bx} d\Bp \\
&=
\lr{\inv{\sqrt{2 \pi}}}^N
\int \lr{ \hat{U}(\Bp) \lr{ -\Bp^2 + k^2 } – \hat{V}(\Bp) } e^{j \Bp \cdot \Bx} d\Bp,
\end{aligned}
\end{equation}
which requires
\begin{equation}\label{eqn:helmholtzGreens:100}
\hat{U}(\Bp) = \frac{\hat{V}(\Bp) }{k^2 – \Bp^2}.
\end{equation}

We can now inverse transform to find \( U(\Bx) \), which gives
\begin{equation}\label{eqn:helmholtzGreens:120}
\begin{aligned}
U(\Bx) &=
\lr{\inv{\sqrt{2 \pi}}}^N \int \hat{U}(\Bp) e^{j \Bp \cdot \Bx} d\Bp \\
&=
\lr{\inv{\sqrt{2 \pi}}}^N \int
\frac{\hat{V}(\Bp) }{k^2 – \Bp^2} e^{j \Bp \cdot \Bx} d\Bp \\
&=
\lr{\inv{2 \pi}}^N \int
\inv{k^2 – \Bp^2} e^{j \Bp \cdot \Bx} d\Bp \int V(\Bx’) e^{-j \Bp \cdot \Bx’} d\Bx’ \\
&=
\int V(\Bx’) d\Bx’
\lr{\inv{2 \pi}}^N
\int
\inv{k^2 – \Bp^2} e^{j \Bp \cdot \lr{\Bx – \Bx’}}
d\Bp
.
\end{aligned}
\end{equation}

The general solution is given by
\begin{equation}\label{eqn:helmholtzGreens:140}
U(\Bx) = \int G(\Bx, \Bx’) V(\Bx’) d\Bx’,
\end{equation}
where \( G(\Bx, \Bx’) \) is called the Green’s function, and has the form
\begin{equation}\label{eqn:helmholtzGreens:160}
G(\Bx, \Bx’) = \lr{\inv{2 \pi}}^N
\int
\inv{k^2 – \Bp^2} e^{j \Bp \cdot \lr{\Bx – \Bx’}}
d\Bp.
\end{equation}

Equivalently, if we presume that a solution of the form \ref{eqn:helmholtzGreens:140} can be found, and operate on that with the Helmholtz operator \( \spacegrad^2 + k^2 \), we find
\begin{equation}\label{eqn:helmholtzGreens:60}
\lr{ \spacegrad^2 + k^2 } U(\Bx) = \int \lr{ \spacegrad^2 + k^2 } G(\Bx, \Bx’) V(\Bx’) d\Bx’ = V(\Bx),
\end{equation}
which requires that our Green’s function \( G(\Bx, \Bx’) \) has the functional form
\begin{equation}\label{eqn:helmholtzGreens:180}
\lr{ \spacegrad^2 + k^2 } G(\Bx, \Bx’) = \delta(\Bx – \Bx’).
\end{equation}

Evaluating the Green’s function in 1D.

For the one dimensional case, we want to evaluate
\begin{equation}\label{eqn:helmholtzGreens:200}
G(u) = -\inv{2 \pi} \int \inv{p^2 – k^2} e^{j p u} dp,
\end{equation}
an integral which is unfortunately non-convergent. Since we are dealing with delta functions, it is not surprising that we have convergence problems. The technique used in the book is to displace the pole slightly by a small imaginary amount, and then take the limit.

That is
\begin{equation}\label{eqn:helmholtzGreens:220}
G(u) = \lim_{\epsilon \rightarrow 0} G_\epsilon(u),
\end{equation}
where
\begin{equation}\label{eqn:helmholtzGreens:240}
\begin{aligned}
G_\epsilon(u)
&= -\inv{2 \pi} \int_{-\infty}^\infty \inv{p^2 – \lr{k + j \epsilon}^2} e^{j p u} dp \\
&= -\inv{2 \pi} \int_{-\infty}^\infty \frac{e^{j p u}}{\lr{ p – k -j \epsilon}\lr{p + k + j \epsilon}} dp.
\end{aligned}
\end{equation}
For \( u > 0 \) we can use an upper half plane infinite semicircular contour integral, as illustrated in fig. 1, where we
let \( R \rightarrow \infty \).

fig.1 Contour for u > 0.

The residue calculation for that contour gives
\begin{equation}\label{eqn:helmholtzGreens:260}
\begin{aligned}
G_\epsilon(u)
&= -\frac{2 \pi j}{2 \pi} \evalbar{\frac{e^{j p u}}{p + k + j \epsilon} }{p = k + j \epsilon} \\
&= -j \frac{e^{j \lr{k + j \epsilon} u}}{2\lr{k + j \epsilon}} \\
&= -j \frac{e^{j k u} e^{-\epsilon u}}{2\lr{k + j \epsilon}} \\
&\rightarrow -\frac{j}{2k} e^{j k u}.
\end{aligned}
\end{equation}

For \( u < 0 \) we can use a lower half plane infinite semicircular contour, as illustrated in fig. 2.

fig 2. Contour for u < 0.

For this contour, we find
\begin{equation}\label{eqn:helmholtzGreens:280}
\begin{aligned}
G_\epsilon(u)
&= -\frac{2 \pi j}{2 \pi} \evalbar{\frac{e^{j p u}}{p – k – j \epsilon} }{p = -k – j \epsilon} \\
&= j \frac{e^{-j \lr{k + j \epsilon} u}}{2\lr{k + j \epsilon}} \\
&= j \frac{e^{-j k u} e^{\epsilon u}}{2\lr{k + j \epsilon}} \\
&\rightarrow \frac{j}{2k} e^{-j k u} \\
&= \frac{j}{2k} e^{j k \Abs{u}}.
\end{aligned}
\end{equation}
We find that our Green’s function is
\begin{equation}\label{eqn:helmholtzGreens:300}
\boxed{
G(u) = \frac{-j \mathrm{sgn}(u)}{2k} e^{j k \Abs{u}}.
}
\end{equation}

Let’s plug this into the convolution integral to see the form of the general solution
\begin{equation}\label{eqn:helmholtzGreens:320}
U(x) = -\frac{j}{2k} \int_{-\infty}^\infty \mathrm{sgn}(x – x’) e^{j k \Abs{x – x’}} V(x’) dx’.
\end{equation}
We want to break this integral into two regions
\begin{equation}\label{eqn:helmholtzGreens:340}
\int_{-\infty}^\infty = \int_{-\infty}^x + \int_x^\infty,
\end{equation}
separating the integral into regions where \( x > x’ \) and \( x < x’ \) respectively. That is
\begin{equation}\label{eqn:helmholtzGreens:360}
U(x) =
-\frac{j}{2k} \int_{-\infty}^x e^{j k \lr{x – x’}} V(x’) dx’
+\frac{j}{2k} \int_x^\infty e^{-j k \lr{x – x’}} V(x’) dx’.
\end{equation}
This isn’t the most general solution, as we can also add any solution to the homogeneous Helmholtz equation. That is
\begin{equation}\label{eqn:helmholtzGreens:400}
U(x) = A e^{j k x} + B e^{-j k x} – \frac{j}{2k} \int_{-\infty}^x e^{j k \lr{x – x’}} V(x’) dx’
+\frac{j}{2k} \int_x^\infty e^{-j k \lr{x – x’}} V(x’) dx’.
\end{equation}

The real and imaginary parts of this equation must also be independent solutions. For example, taking the real parts, we find the following general solution
\begin{equation}\label{eqn:helmholtzGreens:380}
U(x) =
A’ \cos\lr{ k x } +
B’ \sin\lr{ k x }
+\inv{2} \int_{-\infty}^x \frac{\sin\lr{k \lr{x – x’}}}{k} V(x’) dx’
-\inv{2} \int_x^\infty \frac{\sin\lr{k \lr{x – x’}}}{k} V(x’) dx’.
\end{equation}

A strictly causal solution.

It is interesting that the specific solution above has equal causal and acausal contributions. Such a solution (outside of QFT) is generally undesirable. We can construct a specific solution that is either causal or acausal by picking just one of the integrals above, instead of averaging. For example, let
\begin{equation}\label{eqn:helmholtzGreens:440}
f(x) = \int_{-\infty}^x \frac{\sin\lr{k \lr{x – x’}}}{k} V(x’) dx’.
\end{equation}
We can verify that this is a specific solution to our equation using the identity
\begin{equation}\label{eqn:helmholtzGreens:460}
\frac{d}{dx} \int_a^x g(x, x’) dx’
=
\evalrange{g(x, x’) }{a}{x} + \int_a^x \frac{\partial g(x,x’)}{dx} dx’.
\end{equation}
Taking the first derivative of \( f(x) \), we find
\begin{equation}\label{eqn:helmholtzGreens:480}
\begin{aligned}
\frac{df}{dx}
&= \evalrange{ \frac{\sin\lr{k \lr{x – x’}}}{k} V(x’) }{-\infty}{x} + k \int_{-\infty}^x \frac{\cos\lr{k \lr{x – x’}}}{k} V(x’) dx’ \\
&= \frac{\sin\lr{k \lr{x + \infty}}}{k} V(-\infty) + k \int_{-\infty}^x \frac{\cos\lr{k \lr{x – x’}}}{k} V(x’) dx’ \\
&= k \int_{-\infty}^x \frac{\cos\lr{k \lr{x – x’}}}{k} V(x’) dx’,
\end{aligned}
\end{equation}
where we have assumed that our forcing function \( V(x) \) is zero at \( -\infty \). Taking the second derivative, we have
\begin{equation}\label{eqn:helmholtzGreens:500}
\begin{aligned}
\frac{d^2f}{dx^2}
&=
\evalrange{ k \frac{\cos\lr{k \lr{x – x’}}}{k} V(x’) }{-\infty}{x} – k^2 \int_{-\infty}^x \frac{\sin\lr{k \lr{x – x’}}}{k} V(x’) dx’ \\
&= V(x) – k^2 f(x),
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:helmholtzGreens:520}
\frac{d^2}{dx^2} f(x) + k^2 f(x) = V(x).
\end{equation}
This verifies that \ref{eqn:helmholtzGreens:440} is also a specific solution to the wave equation, as expected and desired.

It appears that the general solution is likely of the following form
\begin{equation}\label{eqn:helmholtzGreens:380b}
U(x) =
A’ \cos\lr{ k x } +
B’ \sin\lr{ k x }
+\alpha \int_{-\infty}^x \frac{\sin\lr{k \lr{x – x’}}}{k} V(x’) dx’
-(1-\alpha)\int_x^\infty \frac{\sin\lr{k \lr{x – x’}}}{k} V(x’) dx’,
\end{equation}
with \( \alpha \in [0,1] \).

It’s pretty cool that we can completely solve the 1D forced wave equation, for any forcing function, from first principles. Yes, I took liberties that would make a mathematician cringe, but we are telling a story, and leaving the footnotes to somebody else.

More specific boundary constraints.

Just as we have the freedom to add any homogeneous solution to our specific convolution based solution, we may do so for the Green’s function itself. Our process above, implicitly assumes that we are interested in infinite boundary value constraints. Should we wish to impose different boundary constraints, we can form
\begin{equation}\label{eqn:helmholtzGreens:420}
G(u) = A e^{ j k u} + B e^{-j k u} – \frac{j \mathrm{sgn}(u)}{2k} e^{j k \Abs{u}},
\end{equation}
but must then use the boundary value constraints to determine the desired form of the Green’s function, using the two degrees of freedom to do so. That’s also an interesting topic, and would be good to also visit in a followup post.

References

[1] F.W. Byron and R.W. Fuller. Mathematics of Classical and Quantum Physics. Dover Publications, 1992.

A generalized Gaussian integral.

July 26, 2025 math and physics play , , , , , , ,

[Click here for a PDF version of this post]

Here’s another problem from [1]. The point is to show that
\begin{equation}\label{eqn:generalizedGaussian:20}
G(x,x’,\tau) = \inv{2\pi} \int_{-\infty}^\infty e^{i k\lr{ x – x’ } } e^{-k^2 \tau} dk,
\end{equation}
has the value
\begin{equation}\label{eqn:generalizedGaussian:40}
G(x,x’,\tau) = \inv{\sqrt{4 \pi \tau} } e^{-\lr{ x – x’}^2/4 \tau },
\end{equation}
not just for real \(\tau\), but also for purely imaginary \(\tau\).

Real case.

The authors claim the real case is easy, but I don’t think the real case is that trivial. The trivial part is basically just completing the square. Writing \( x – x ‘ = \Delta x \), that is
\begin{equation}\label{eqn:generalizedGaussian:60}
\begin{aligned}
-k^2 \tau + i k\lr{ x – x’ }
&=
-\tau \lr{ k^2 – i k \Delta x/\tau } \\
&=
-\tau \lr{ \lr{ k – i \Delta x/2\tau }^2 – \lr{ – i \Delta x/2\tau }^2 } \\
&=
-\tau \lr{ \lr{ k – i \Delta x/2\tau }^2 + \lr{ \Delta x/2\tau }^2 }.
\end{aligned}
\end{equation}
So we have
\begin{equation}\label{eqn:generalizedGaussian:80}
G(x,x’,\tau) = \inv{2\pi} e^{-(\Delta x/2)^2/\tau} \int_{-\infty}^\infty e^{-\tau \lr{ k – i \Delta x/2\tau }^2 } dk.
\end{equation}
Let’s call the integral factor part of this \( I \)
\begin{equation}\label{eqn:generalizedGaussian:100}
I = \int_{-\infty}^\infty e^{-\tau \lr{ k – i \Delta x/2\tau }^2 } dk.
\end{equation}
However, making a change of variables makes this an integral over a complex path
\begin{equation}\label{eqn:generalizedGaussian:120}
I = \int_{-\infty – i \Delta x/2\tau }^{\infty – i \Delta x/2\tau} e^{-\tau k^2 } dk.
\end{equation}
If you are lazy you could say that \( \pm \infty \) adjusted by a constant, even if that constant is imaginary, leaves the integration limits unchanged. That’s clearly true if the constant is real, but I don’t think it’s that obvious if the constant is imaginary.

To answer that question more exactly, let’s consider the integral
\begin{equation}\label{eqn:generalizedGaussian:140}
0 = I + J + K + L = \oint e^{-\tau z^2} dz,
\end{equation}
where the path is illustrated in fig. 1.

fig. 1. Contour for the Gaussian.

Since there are no enclosed poles, we have
\begin{equation}\label{eqn:generalizedGaussian:160}
I = \int_{-\infty}^\infty e^{-\tau k^2 } dk + K + L,
\end{equation}
where
\begin{equation}\label{eqn:generalizedGaussian:180}
\begin{aligned}
K &= \int_{- i \Delta x/2\tau}^0 e^{-\tau z^2} dz \\
L &= \int_0^{- i \Delta x/2\tau} e^{-\tau z^2} dz.
\end{aligned}
\end{equation}
We see now that we see perfect cancellation of \( K \) and \( L \), which justifies the change of variables, and the corresponding integration limits.

We can use the usual trick to evaluate \( I^2 \), to find
\begin{equation}\label{eqn:generalizedGaussian:200}
\begin{aligned}
I^2
&=
\int_{-\infty}^\infty e^{-\tau k^2 } dk
\int_{-\infty}^\infty e^{-\tau m^2 } dm \\
&=
2 \pi \int_0^\infty r e^{-\tau r^2} r dr \\
&=
2 \pi \evalrange{ – \frac{e^{-\tau r^2}}{-2 \tau} }{0}{\infty} \\
&=
\frac{\pi}{\tau}.
\end{aligned}
\end{equation}

So, for real values of \( \tau \) we have
\begin{equation}\label{eqn:generalizedGaussian:220}
G(x,x’,\tau) = \inv{2\pi} \sqrt{\frac{\pi}{\tau}}e^{-(\Delta x/2)^2/\tau},
\end{equation}
as expected.

Imaginary case.

For the imaginary case, let \( \tau = i \alpha \). Let’s recomplete the square from scratch with this substitution
\begin{equation}\label{eqn:generalizedGaussian:240}
\begin{aligned}
-k^2 i \alpha + i k \Delta x
&=
– i \alpha \lr{ k^2 – \frac{i k \Delta x}{i \alpha} } \\
&=
– i \alpha \lr{ k^2 – \frac{k \Delta x}{\alpha} } \\
&=
– i \alpha \lr{ \lr{ k – \frac{\Delta x}{2 \alpha} }^2 – \lr{ \frac{\Delta x}{2 \alpha} }^2 }.
\end{aligned}
\end{equation}
So we have
\begin{equation}\label{eqn:generalizedGaussian:260}
\begin{aligned}
G(x,x’,\tau)
&= \inv{2\pi} e^{i \alpha(\Delta x/2\alpha)^2} \int_{-\infty}^\infty e^{- i \alpha \lr{ k – \frac{\Delta x}{2 \alpha } }^2 } dk \\
&= \inv{\sqrt{\pi^2 \alpha}} e^{- (\Delta x)^2/4\tau} \int_0^\infty e^{- i m^2 } dm.
\end{aligned}
\end{equation}
This time we can make a \( m = \sqrt{\alpha} \lr{k – \frac{\Delta x}{2 \alpha }} \) change of variables, but don’t have to worry about imaginary displacements of the integration limits.

The task is now reduced to the evaluation of an imaginary Gaussian like integral, and we are given the hint integrate \( e^{-z^2} \) over a pie shaped contour fig. 2.

fig. 2. Pie shaped integration contour.

Over \( I \) we set \( z = x, x \in [0, R] \), over \( J \), we set \( z = R e^{i\theta}, \theta \in [0, \pi/4] \), and on \( K \) we set \( z = u e^{i\pi/4}, u \in [R, 0] \). Since there are no enclosed poles we have
\begin{equation}\label{eqn:generalizedGaussian:280}
\begin{aligned}
0 &= I + J + K \\
&= \int_0^R e^{- x^2} dx + \int_0^{\pi/4} e^{-R^2 e^{2 i \theta} } i R e^{i\theta} d\theta – \int_0^R e^{-i u^2 } e^{i \pi/4} du.
\end{aligned}
\end{equation}
In the limit we have
\begin{equation}\label{eqn:generalizedGaussian:300}
\begin{aligned}
\int_0^\infty e^{-i u^2 } du
&= e^{-i\pi/4} \int_0^\infty e^{- x^2} dx + L \\
&= e^{-i\pi/4} \sqrt{\pi}/2 + L,
\end{aligned}
\end{equation}
where
\begin{equation}\label{eqn:generalizedGaussian:320}
L = \lim_{R\rightarrow \infty} e^{-i\pi/4} \int_0^{\pi/4} e^{-R^2 e^{2 i \theta} } i R e^{i\theta} d\theta.
\end{equation}
We hope that this is zero in the limit, but showing this requires a bit of care around the \( \pi/4 \) endpoint. We start with
\begin{equation}\label{eqn:generalizedGaussian:340}
\begin{aligned}
\Abs{L}
&\le \lim_{R\rightarrow \infty} \int_0^{\pi/4} R e^{-R^2 \cos\lr{2 \theta} } d\theta \\
&= \lim_{R\rightarrow \infty} \inv{2} \int_{\pi/4 – \epsilon/2}^{\pi/4} R e^{-R^2 \cos\lr{2 \theta} } (2 d\theta),
\end{aligned}
\end{equation}
Now we make a change of variables
\begin{equation}\label{eqn:generalizedGaussian:360}
t = \frac{\pi}{2} – 2 \theta.
\end{equation}
At the limits we have
\begin{equation}\label{eqn:generalizedGaussian:380}
\begin{aligned}
t(\pi/4 – \epsilon/2) &= \epsilon \\
t(\pi/4) &= 0.
\end{aligned}
\end{equation}
Also,
\begin{equation}\label{eqn:generalizedGaussian:400}
\begin{aligned}
\cos\lr{ 2 \theta }
&= \textrm{Re} \lr{ e^{2 i \theta} } \\
&= \textrm{Re} \lr{ e^{i \lr{\pi/2 – t} } } \\
&= \textrm{Re} \lr{ i e^{-i t } } \\
&= \sin t,
\end{aligned}
\end{equation}
so
\begin{equation}\label{eqn:generalizedGaussian:420}
\Abs{L} \le \lim_{R\rightarrow \infty} \inv{2} \int_0^\epsilon R e^{-R^2 \sin t} dt.
\end{equation}
Since we have forced \( t \) small, we can use the small angle approximation for the sine
\begin{equation}\label{eqn:generalizedGaussian:440}
\begin{aligned}
\int_0^\epsilon R e^{-R^2 \sin t} dt
&\approx
\int_0^\epsilon R e^{-R^2 t} dt \\
&= \evalrange{ \inv{-2 R} e^{-R^2 t} }{0}{\epsilon} \\
&= \frac{ 1 – e^{-R^2 \epsilon }}{2 R}.
\end{aligned}
\end{equation}
The numerator goes to zero for either \( \epsilon \rightarrow 0 \), or \( R \rightarrow \infty \), and the denominator to infinity, so we have the desired zero in the limit. This means that
\begin{equation}\label{eqn:generalizedGaussian:460}
\begin{aligned}
G(x,x’,\tau)
&= \frac{e^{-i\pi/4}}{\sqrt{4 \pi \alpha}} e^{- (\Delta x)^2/4\tau} \\
&= \frac{1}{\sqrt{4 \pi i \alpha}} e^{- (\Delta x)^2/4\tau} \\
&= \frac{1}{\sqrt{4 \pi \tau}} e^{- (\Delta x)^2/4\tau},
\end{aligned}
\end{equation}
as expected.

A fun application, also noted in the problem, is that we can decompose the imaginary integral
\begin{equation}\label{eqn:generalizedGaussian:480}
\int_{-\infty}^\infty e^{-i u^2} du = \sqrt{\pi} e^{-i\pi/4},
\end{equation}
into real and imaginary parts, to find
\begin{equation}\label{eqn:generalizedGaussian:500}
\int_{-\infty}^\infty \cos u^2 du = \int_{-\infty}^\infty \sin u^2 du = \sqrt{\frac{\pi}{2}}.
\end{equation}
Despite being real valued integrals, it it not at all obvious how one would go about finding those without these contour integration tricks.

References

[1] F.W. Byron and R.W. Fuller. Mathematics of Classical and Quantum Physics. Dover Publications, 1992.

More residue calculus: sinc squared, fractional exponent, log, pie contour

January 26, 2025 math and physics play , , , ,

[Click here for a PDF version of this post]

Sinc squared.

This is problem 31(g) from [1]. Find
\begin{equation}\label{eqn:sincSquared:20}
I = \int_{-\infty}^\infty \frac{\sin^2 x}{x^2} dx.
\end{equation}

We will use the same upper half plane semicircular contour, enclosing the second order pole at the origin. This time we write
\begin{equation}\label{eqn:sincSquared:40}
\sin^2 x = \frac{ 1 – \cos\lr{ 2x } }{2},
\end{equation}
allowing us to write
\begin{equation}\label{eqn:sincSquared:60}
\begin{aligned}
I
&= \inv{2} \int_{-\infty}^\infty \frac{1 – \cos\lr{ 2 x } }{x^2} dx \\
&= \inv{2} \textrm{Re} \int_{-\infty}^\infty \frac{1 – e^{2 i x } }{x^2} dx.
\end{aligned}
\end{equation}
This has exactly the structure required to apply Jordan’s lemma, and conclude that the integral over the infinite semicircular part of the contour is zero.

We can proceed to compute the residues
\begin{equation}\label{eqn:sincSquared:80}
\begin{aligned}
I
&=
\inv{2} \textrm{Re} \oint \frac{1 – e^{2 i z } }{z^2} dz \\
&=
\inv{2} \textrm{Re} \frac{ \pi i }{1!} \evalbar{ \lr{1 – e^{2 i z } }’ }{ z = 0 }.
\end{aligned}
\end{equation}
Because we are sneaking around the pole at the origin with a half semicircle, we multiply the residue by \( \pi i \), not \( 2 \pi i \). This leaves
\begin{equation}\label{eqn:sincSquared:100}
I = \textrm{Re} \frac{\pi i}{2} \evalbar{ (- 2 i) e^{2 i z } }{ z = 0 },
\end{equation}
or
\begin{equation}\label{eqn:sincSquared:640}
\boxed{
I = \pi.
}
\end{equation}

An fractional exponent integral.

Next, let’s do 31(h). Given \( 0 < a < 1 \), we want to evaluate \begin{equation}\label{eqn:sincSquared:120} I = \int_0^\infty \frac{x^{2 a – 1}}{x^2 + b^2} dx. \end{equation} Let’s start with a \( x = b u \), where we assume that \( b > 0 \). This gives us
\begin{equation}\label{eqn:sincSquared:140}
\begin{aligned}
I
&= \int_0^\infty \frac{ b^{2 a – 1} u^{2 a – 1}}{b^2 \lr{ u^2 + 1 } } b du \\
&= b^{2(a – 1)} \int_0^\infty \frac{ u^{2 a – 1}}{u^2 + 1 } du.
\end{aligned}
\end{equation}
We now want to solve the slightly simpler integral, let’s call it
\begin{equation}\label{eqn:sincSquared:160}
J = \int_0^\infty \frac{ u^{2 a – 1}}{u^2 + 1 } du.
\end{equation}

Let’s now look at
\begin{equation}\label{eqn:sincSquared:180}
\begin{aligned}
K
&= \int_{-\infty}^0 \frac{ u^{2 a – 1}}{u^2 + 1 } du \\
&= -\int_{\infty}^0 \frac{ \lr{ – v } ^{2 a – 1}}{v^2 + 1 } dv \\
&= \lr{-1}^{2 a – 1} J.
\end{aligned}
\end{equation}
However
\begin{equation}\label{eqn:sincSquared:200}
\begin{aligned}
\lr{-1}^{2 a – 1}
&=
e^{i \pi \lr{ 2 a – 1 } } \\
&=
– e^{2 i \pi a },
\end{aligned}
\end{equation}
so
\begin{equation}\label{eqn:sincSquared:220}
\begin{aligned}
J
&= \inv{ 1 – e^{2 i \pi a } } \int_{-\infty, \infty} \frac{ u^{2 a – 1}}{u^2 + 1 } du \\
&= \inv{ 1 – e^{2 i \pi a } } \oint \frac{ z^{2 a – 1}}{z^2 + 1 } dz,
\end{aligned}
\end{equation}
that is, assuming the integral on the upper half plane semicircle is zero.

On that semicircle, with \( z = R e^{i\theta} \),
\begin{equation}\label{eqn:sincSquared:240}
\begin{aligned}
\oint \frac{ z^{2 a – 1}}{z^2 + 1 } dz
&= \int_0^\pi \frac{ \lr{ R e^{i \theta} }^{2 a – 1} }{ R^2 e^{2 i \theta} + 1 } R e^{i \theta} d\theta \\
&\rightarrow \int_0^\pi R^{2 a – 1 + 1 – 2} e^{i \theta (2 a – 1) -i \theta} d\theta.
\end{aligned}
\end{equation}
Near \( a \approx 0 \) this is \( O(R^{-2}) \), which tends to zero. At the upper tend of the a range, where \( a = 1 – \epsilon \), this is
\begin{equation}\label{eqn:sincSquared:260}
O(R^{2(1 – \epsilon) – 2}) = O(1/R^{2 \epsilon}),
\end{equation}
which also tends to zero. We have only one enclosed pole, at \( z = i \), so
\begin{equation}\label{eqn:sincSquared:280}
\begin{aligned}
I
&= \frac{b^{2(a-1)}}{ 1 – e^{2 i \pi a } } ( 2 \pi i ) \evalbar{ \frac{z^{2 a – 1}}{z + i} }{z = i} \\
&= \frac{\pi b^{2(a-1)}}{ 1 – e^{2 i \pi a } } i^{2 a – 1}.
\end{aligned}
\end{equation}

But
\begin{equation}\label{eqn:sincSquared:300}
\begin{aligned}
i^{2 a – 1}
&= \lr{ e^{i \pi/2} }^{2 a – 1} \\
&= e^{i \pi a} e^{-i \pi/2} \\
&= -i e^{i \pi a},
\end{aligned}
\end{equation}
so
\begin{equation}\label{eqn:sincSquared:320}
\begin{aligned}
I
&= \frac{-i \pi b^{2(a-1)} e^{i \pi a}}{ 1 – e^{2 i \pi a } } \\
&= \frac{-i \pi b^{2(a-1)} }{ e^{-i \pi a} – e^{i \pi a } },
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:sincSquared:660}
\boxed{
I = \frac{\pi b^{2(a-1)} }{ 2 \sin\lr{ \pi a } }.
}
\end{equation}

A log integral over the positive x-axis.

Problem 31(i) is
\begin{equation}\label{eqn:sincSquared:340}
I = \int_0^\infty \frac{\ln x}{x^2 + b^2} dx.
\end{equation}
Let’s see what happens to this integral over the \( x < 0 \) range.
\begin{equation}\label{eqn:sincSquared:360}
\begin{aligned}
\int_{-\infty}^0 \frac{\ln x}{x^2 + b^2} dx
&=
-\int_{\infty}^0 \frac{\ln(- u)}{u^2 + b^2} d u \\
&=
I + \int_0^\infty \frac{\ln e^{i \pi}}{u^2 + b^2} du \\
&=
I + \frac{i \pi}{2} \int_{-\infty}^\infty \inv{u^2 + b^2} du.
\end{aligned}
\end{equation}

This means that we have
\begin{equation}\label{eqn:sincSquared:380}
\int_{-\infty}^\infty \frac{\ln x}{x^2 + b^2} dx = 2 I + \frac{i \pi}{2} \int_{-\infty}^\infty \inv{u^2 + b^2} du,
\end{equation}
or
\begin{equation}\label{eqn:sincSquared:480}
\begin{aligned}
I
&= \inv{2} \int_{-\infty}^\infty \frac{\ln x – i \pi/2}{x^2 + b^2} dx \\
&= \inv{2} \int_{-\infty}^\infty \frac{\ln(-i x)}{x^2 + b^2} dx \\
&= \inv{2} \oint \frac{\ln(-i z)}{z^2 + b^2} dz \\
&= (\pi i) \evalbar{ \frac{\ln(-i z)}{z + i b} }{z = i b},
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:sincSquared:680}
\boxed{
I = \frac{\pi \ln b}{2 b}.
}
\end{equation}

A pie contour.

Skipping ahead to 31(k), we want to find
\begin{equation}\label{eqn:sincSquared:500}
I = \int_0^\infty \frac{dx}{x^3 + a^3}.
\end{equation}
Some googling shows that we can evaluate integrals with \( x^n + b^n \) denominators, using a pie shaped contour, with slice sizes of \( 2 \pi /n \),
as plotted in fig. 1.

fig. 1. Pie shaped contour for cubic integral.

Integrating (backwards) along the \( 2 \pi/3 \) slice line, with \( \alpha = e^{\pi i/3} \), and \( z = \alpha^2 u \), we have
\begin{equation}\label{eqn:sincSquared:520}
\begin{aligned}
\int_0^\infty \frac{ \alpha^2 du }{ \alpha^6 u^3 + a^3 }
&=
\alpha^2 \int_0^\infty \frac{ du }{ u^3 + a^3 } \\
&= \alpha^2 I,
\end{aligned}
\end{equation}
so
\begin{equation}\label{eqn:sincSquared:540}
I = \inv{ 1 – \alpha^2 } \oint \frac{dz}{z^3 + a^3}.
\end{equation}
We can factor the denominator as
\begin{equation}\label{eqn:sincSquared:560}
z^3 + a^3 = \lr{ z – \alpha a }\lr{ z + a }\lr{ z – a/\alpha },
\end{equation}
where only the \( z = \alpha a \) pole is enclosed. The residue calculation is
\begin{equation}\label{eqn:sincSquared:580}
\begin{aligned}
I
&= \frac{ 2 \pi i }{1 – \alpha^2 } \evalbar{ \inv{\lr{z + a}\lr{ z – a/\alpha } } }{z = a\alpha} \\
&= \frac{ 2 \pi i }{a^2} \inv{ \lr{1 – \alpha^2 } \lr{ \alpha + 1 } \lr{ \alpha – 1/\alpha } } \\
\end{aligned}
\end{equation}
We now want to expand the denominator. I had trouble simplifying this by hand, and it took me a few tries to get it right:
\begin{equation}\label{eqn:sincSquared:600}
\begin{aligned}
-\lr{1 – \alpha^2 } \lr{ \alpha + 1 } \lr{ \alpha – 1/\alpha }
&=
-\frac{\lr{\alpha^2 -1}^2 \lr{ \alpha + 1 }}{\alpha} \\
&=
-\lr{ e^{2 \pi i/3} – 1}^2 \lr{ 1 + e^{i\pi/3} } e^{-i\pi/3} \\
&=
-\lr{ e^{4 \pi i/3} + 1 – 2 e^{ 2 \pi i /3} } \lr{ 1 + e^{-i\pi/3} } \\
&=
-\lr{ e^{4 \pi i/3} + 1 – 2 e^{ 2 \pi i /3} + e^{3 \pi i/3} + e^{-i\pi/3} – 2 e^{ \pi i /3} } \\
&=
-\lr{ e^{4 \pi i/3} – 2 e^{ 2 \pi i /3} + e^{-i\pi/3} – 2 e^{ \pi i /3} } \\
&=
-\lr{ \inv{2} \lr{ -1 – \sqrt{3} i } – \lr{-1 + \sqrt{3} i} + \inv{2}\lr{ 1 – \sqrt{3} i } – \lr{ 1 + \sqrt{3} i} } \\
&=
-\lr{ -\inv{2} – 1 – \inv{2} – 1 } \sqrt{3} i \\
&=
3 \sqrt{3} i.
\end{aligned}
\end{equation}
Putting the pieces together
\begin{equation}\label{eqn:sincSquared:620}
\boxed{
I = \frac{2 \pi}{3 \sqrt{3} a^2}.
}
\end{equation}

References

[1] F.W. Byron and R.W. Fuller. Mathematics of Classical and Quantum Physics. Dover Publications, 1992.

A weighted sinc function integral.

January 25, 2025 math and physics play , , , , ,

[Click here for a PDF version of this post]

Here’s another real integral problem from [1] (31(f)). Find
\begin{equation}\label{eqn:weightedSinc:20}
I = \int_0^\infty \frac{\sin x dx}{x\lr{ x^2 + a^2 }}.
\end{equation}
Both Mathematica and the text state that the answer is
\begin{equation}\label{eqn:weightedSinc:40}
I = \frac{\pi}{2 a^2} \lr{ 1 – e^{-a}}.
\end{equation}

My initial attempt to evaluate this using contour integral techniques gets the wrong answer. I’m going to post both my wrong solution method, and why the initial method was wrong.

Then I’ll follow up with the corrected method. The mistake, and it’s identification, is probably more interesting than the solution.

The contour.

Before delving into the residue calculations, it’s first helpful to note that the integrand is an even function, so we may transform it first into an integral over the entire real axis:
\begin{equation}\label{eqn:weightedSinc:60}
I = \inv{2} \int_{-\infty}^\infty \frac{\sin x dx}{x\lr{ x^2 + a^2 }}.
\end{equation}
The obvious choice for the contour is illustrated in fig. 1, where \( R \rightarrow \infty \), and \( \rho \rightarrow 0 \).

fig. 1. Contour with two semicircles.

We have to figure out if the circular contour integrals are zero, in the limit. Let’s start with the small contour, with \( z = \rho e^{i \theta} \)
\begin{equation}\label{eqn:weightedSinc:80}
\begin{aligned}
I_\rho
&= \inv{2} \oint \frac{\sin z dz}{z \lr{ z^2 + a^2 }} \\
&= \inv{2} \int_\pi^{2 \pi} \frac{\sin\lr{ \rho e^{i\theta} } \rho i e^{i \theta} d\theta}{\rho e^{i\theta} \lr{ \rho^2 e^{2 i \theta} + a^2 }} \\
&\approx \inv{2} \int_\pi^{2 \pi} \frac{\rho e^{i\theta} d\theta}{\lr{ \rho^2 e^{2 i \theta} + a^2 }} \\
&= \frac{\rho}{2} \int_\pi^{2 \pi} \frac{e^{i\theta} d\theta}{\lr{ \rho^2 e^{2 i \theta} + a^2 }} \\
&\rightarrow \frac{\rho}{2 a^2} \int_\pi^{2 \pi} e^{i\theta} d\theta \\
&\rightarrow 0.
\end{aligned}
\end{equation}

The wrong way.

To complete the problem, I did a similar argument showing that the limit along the infinite semicircle was zero, and then proceeded to evaluate the residues. Let’s see what we get if this is done. We are trying to evaluate

\begin{equation}\label{eqn:weightedSinc:100}
I = \inv{2} \oint \frac{\sin z dz}{z \lr{ z + ia } \lr{ z – ia } },
\end{equation}
where we have a “half-enclosed” pole at \( z = 0 \), and fully enclosed pole at \( z = i a \). The residues are

\begin{equation}\label{eqn:weightedSinc:120}
\begin{aligned}
I
&= \inv{2} \lr{ 2 \pi i } \lr{ \evalbar{ \frac{\sin z}{z \lr{ z + ia } } }{z = i a} + \evalbar{ \inv{2} \frac{\sin z}{\lr{ z^2 + a^2 }} }{z = 0} } \\
&= \inv{2} \lr{ 2 \pi i } \frac{e^{i^2 a} – e^{-i^2 a}}{2i \lr{ ia } \lr{ 2 ia } } \\
&= \frac{ \pi }{4 a^2} \lr{e^{a} – e^{-a}}.
\end{aligned}
\end{equation}

This has a similar structure to the actual answer, but is wrong. I couldn’t find any obvious mistake in the residue calculation, so I was scratching my head for a while about what I did wrong. This confusion was only compounded by figuring out a different way to evaluate this, which did yield the right answer.

The right way.

The key to getting the right answer is to notice that
\begin{equation}\label{eqn:weightedSinc:65}
\inv{2} \int_{-\infty}^\infty \frac{\cos x dx}{x\lr{ x^2 + a^2 }} = 0,
\end{equation}
so we can, instead compute
\begin{equation}\label{eqn:weightedSinc:70}
I = \inv{2} \textrm{Im} \int_{-\infty}^\infty \frac{e^{ix} dx}{x\lr{ x^2 + a^2 }}.
\end{equation}
It’s easy to repeat the argument that after the \( x \rightarrow z \) substitution, this is also zero on the small semicircle, in the \( \rho \rightarrow 0 \) limit. On the large semicircle, the integrand is now in the perfect form to apply Jordan’s lemma. Recall that lemma was:

Lemma 1.1: Jordan’s Lemma.

Given \( R(z) \rightarrow 0 \), then for \( \alpha > 0 \) on a upper half-plane semicircular arc,
\begin{equation*}
\lim_{\Abs{z} \rightarrow \infty} \oint R(z) e^{i \alpha z} dz = 0.
\end{equation*}

We have \( \alpha = 1 \), which is greater than zero, and the rest of the integrand is \( O(R^{-3}) \), so it’s zero. Now we can just compute the residues

\begin{equation}\label{eqn:weightedSinc:140}
\begin{aligned}
\inv{2} \oint \frac{e^{iz} dz}{z\lr{ z^2 + a^2 }}
&=
\lr{ \pi i } \lr{ \evalbar{ \frac{e^{iz}}{z \lr{ z + i a }} }{z = i a} + \inv{2} \evalbar{ \frac{e^{iz}}{z^2 + a^2 }}{z = 0} } \\
&=
\lr{ \pi i } \lr{ \frac{e^{-a}}{ia \lr{ 2 i a }} + \inv{2} \frac{1}{a^2}} \\
&=
\frac{\pi i}{2 a^2} \lr{ 1 – e^{-a} }.
\end{aligned}
\end{equation}
Taking the imaginary part of this integral, we have the solution.

What went wrong?

I don’t think there is anything wrong with the residue calculation for “the wrong way”, but it was not correct to argue that the integral along the infinite semicircular arc was zero in that case.

I’d made that argument in the following fashion, looking for the limit of
\begin{equation}\label{eqn:weightedSinc:160}
\begin{aligned}
\int \frac{\sin z}{z \lr{ z^2 + a^2 } } dz
=
\int \frac{e^{iz}}{2 i z \lr{ z^2 + a^2 } } dz –
\int \frac{e^{-iz}}{2 i z \lr{ z^2 + a^2 } } dz
\end{aligned}
\end{equation}
We can apply Jordan’s lemma to the first integral, but not the second. To see why specifically, consider an explicit \( z = R e^{i \theta } \) parameterization of that integral
\begin{equation}\label{eqn:weightedSinc:180}
\begin{aligned}
\Abs{\int \frac{e^{-iz}}{2 i z \lr{ z^2 + a^2 } } dz}
&=
\inv{2} \Abs{ \int_0^\pi \frac{e^{-i R e^{i\theta} }}{R e^{i\theta} \lr{ R^2 e^{2 i \theta} + a^2 } } i R e^{i \theta} d\theta } \\
&=
\inv{2} \Abs{ \int_0^\pi \frac{e^{-i R e^{i\theta} }}{\lr{ R^2 e^{2 i \theta} + a^2 } } d\theta } \\
&=
\inv{2} \Abs{ \int_0^\pi \frac{ e^{-i R \cos\theta} e^{R \sin\theta} }{\lr{ R^2 e^{2 i \theta} + a^2 } } d\theta }.
\end{aligned}
\end{equation}
Not only is this not zero, it’s very obviously infinite for \( R \rightarrow \infty \), as the real exponential will dominate (at least for some angles.) In particular, note that along the imaginary axis, say \( z = i u\), we have \( \sin z = i \sinh u \), which blows up as \( u \rightarrow \infty \). That sine is not well behaved, so we have to use the imaginary part trick, to convert it to an exponential that will submit properly to Jordan’s lemma.

The moral of the story is that if we incorrectly identify that a portion of the contour integral is zero, when it isn’t, the rest of the results that follow are garbage.

References

[1] F.W. Byron and R.W. Fuller. Mathematics of Classical and Quantum Physics. Dover Publications, 1992.

Another real integral using contour integration.

January 21, 2025 math and physics play , , ,

[Click here for a PDF version of this post]

Here’s (31(d)) from [1]. Find
\begin{equation}\label{eqn:fourPoles:20}
I = \int_0^\infty \frac{dx}{1 + x^4} = \inv{2}\int_{-\infty}^\infty \frac{dx}{1 + x^4}.
\end{equation}
This one is easy conceptually, but a bit messy algebraically. We integrate over the contour \( C \) illustrated in fig. 1.

fig. 1. Standard above the x-axis, semicircular contour.

We want to evaluate
\begin{equation}\label{eqn:fourPoles:40}
2 I = \oint_C \frac{dz}{1 + z^4},
\end{equation}
because the semicircular part of the integral is \( O(R^{-3}) \), which tends to zero in the \( R \rightarrow \infty \) limit.

The poles are at the points
\begin{equation}\label{eqn:fourPoles:60}
\begin{aligned}
z^4
&= -1 \\
&= e^{i \pi + 2 \pi i k},
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:fourPoles:80}
\begin{aligned}
z
&= e^{i \pi/4 + \pi i k/2},
\end{aligned}
\end{equation}
These are the points \( z = (\pm 1 \pm i)/\sqrt{2} \), two of which are enclosed by our contour. Specifically
\begin{equation}\label{eqn:fourPoles:100}
\begin{aligned}
2 I
&= \oint_C \frac{dz}{
\lr{ z – \frac{1 + i}{\sqrt{2}} }
\lr{ z – \frac{-1 + i}{\sqrt{2}} }
\lr{ z – \frac{1 – i}{\sqrt{2}} }
\lr{ z – \frac{-1 – i}{\sqrt{2}} }
} \\
&= \oint_C \frac{dz}{
\lr{ z – \frac{1 + i}{\sqrt{2}} }
\lr{ z – \frac{-1 + i}{\sqrt{2}} }
\lr{ \lr{z + \frac{i}{\sqrt{2}}}^2 – \inv{2} }
} \\
&=
\evalbar{
\frac{ 2 \pi i }
{
\lr{ z – \frac{-1 + i}{\sqrt{2}} }
\lr{ \lr{z + \frac{i}{\sqrt{2}}}^2 – \inv{2} }
}
}{z = \frac{1 + i}{\sqrt{2}}}
+
\evalbar{
\frac{ 2 \pi i }
{
\lr{ z – \frac{1 + i}{\sqrt{2}} }
\lr{ \lr{z + \frac{i}{\sqrt{2}}}^2 – \inv{2} }
}
}
{z = \frac{-1 + i}{\sqrt{2}} } \\
&=
\evalbar{
\frac{(2 \pi i )(2 \sqrt{2})}
{
\lr{ z’ + 1 – i }
\lr{ \lr{z’ + i}^2 – 1 }
}
}{z’ = 1 + i}
+
\evalbar{
\frac{(2 \pi i )(2 \sqrt{2})}
{
\lr{ z’ – 1 – i }
\lr{ \lr{z’ + i}^2 – 1 }
}
}
{z’ = -1 + i}
\\
&=
\frac{2 \pi i \sqrt{2}}
{
\lr{2 i + 1}^2 – 1 }

\frac{2 \pi i \sqrt{2}}
{ \lr{2 i – 1}^2 – 1 }
\\
&=
\frac{\pi i \sqrt{2}}
{
2 (-1 + i)
}
+
\frac{\pi i \sqrt{2}}
{ 2(1 + i) }
\\
&=
\lr{ -1 – i }
\frac{\pi i}
{
2 \sqrt{2}
}
+
\lr{ 1 – i }
\frac{\pi i}
{ 2 \sqrt{2} }
\\
&=
\frac{\pi}
{ \sqrt{2} }
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:fourPoles:120}
\boxed{
I = \frac{\pi}{2 \sqrt{2}}.
}
\end{equation}

References

[1] F.W. Byron and R.W. Fuller. Mathematics of Classical and Quantum Physics. Dover Publications, 1992.