GATE PH study materials
GATE PH study resources

Keyhole Contour and the Missing Factor of Two

GATE PH · Put your knowledge to work in context.

All case studies

Keyhole Contour and the Missing Factor of Two

A student is asked to evaluate I = ∫_0^∞ (ln x)/(x^2+4) dx. They use f(z) = (log z)^2/(z^2+4), with the branch cut on the positive real axis and 0 < arg z < 2π, and a keyhole contour. The large and small circles give vanishing contributions. The student reports I ≈ 0.272, but numerical quadrature gives 0.544. They are confident about the residues at z = ±2i and about the branch range, so the error must be in the discontinuity across the cut. The residue at z = 2i is (ln 2 + iπ/2)^2/(4i); at z = -2i it is (ln 2 + i3π/2)^2/(-4i). The contour encloses both poles. You are asked to referee the calculation, reproduce the contour relation, and locate the factor-of-two error without simply quoting the standard integral.

1. Write f(x+i0) and f(x-i0) for x>0 and derive the keyhole-contour relation involving I and J = ∫_0^∞ dx/(x^2+4).

Read the worked answer

On the upper edge, arg z = 0, so f(x+i0) = (ln x)^2/(x^2+4). On the lower edge, arg z = 2π, so log(x-i0) = ln x + 2πi and f(x-i0) = (ln x + 2πi)^2/(x^2+4). Traversing the keyhole, the two straight edges contribute f(x+i0) - f(x-i0). Hence

∮ f dz = ∫_0^∞ [(ln x)^2 - (ln x + 2πi)^2]/(x^2+4) dx = ∫_0^∞ [-4πi ln x + 4π^2]/(x^2+4) dx = -4πi I + 4π^2 J.

The sign is fixed by the orientation: the upper edge is traversed left-to-right and the lower edge right-to-left. This relation contains both I and J, so the real term cannot be discarded. That is the step the student must get right before evaluating residues.

2. Evaluate the residue sum and solve for I. Check the numerical value.

Read the worked answer

Let L = ln 2, A = L + iπ/2, and B = L + i3π/2. The residue sum is

S = A^2/(4i) + B^2/(-4i) = (A^2 - B^2)/(4i).

Since A - B = -iπ and A + B = 2L + i2π,

A^2 - B^2 = (-iπ)(2L + i2π) = 2π^2 - 2πiL.

Thus S = -πL/2 - iπ^2/2, and the contour integral is

∮ f dz = 2πiS = π^3 - iπ^2L.

Equating to -4πiI + 4π^2J and using J = π/4 gives 4π^2J = π^3. The real parts cancel, as they must. The imaginary parts give -4πI = -π^2L, so I = πL/4 = π ln 2/4 ≈ 0.544. The student's 0.272 is exactly half the correct value.

3. Diagnose the factor-of-two error and state a consistency check that would have caught it.

Read the worked answer

A factor of two appears if the discontinuity is taken as 2πi ln x instead of 4πi ln x. That can happen by using log z rather than (log z)^2, or by expanding (ln x + 2πi)^2 incorrectly and halving the cross term. The cross term is 4πi ln x because

(ln x + 2πi)^2 - (ln x)^2 = 4πi ln x - 4π^2.

Dropping the 2 in (2πi)^2, or treating the two edges as equal and doubling only one contribution, gives half the imaginary coefficient and hence half of I. A good consistency check is that the real parts must cancel: J = π/4 has to emerge from 4π^2J = π^3. A second check is the general result I(a) = π ln a/(2a), which for a = 2 gives π ln 2/4. If a calculation returns half, either the real-part cancellation fails or the same wrong factor has been inserted on both sides.