Daily Mathematics / Solutions
Solutions for 21 October 2026
Two cards went out that day: a hard definite integral and an original Putnam-style problem. Try each one first; the solutions are folded away below.
Integral
A Fresnel phase against a hyperbolic secant

Evaluate in closed form.
\[\int_{0}^{\infty}\frac{\sin(\pi x^{2})}{\cosh(\pi x)}\,dx\]Show the solution
Call the integral \(I\). The obvious expansion \(\operatorname{sech}(\pi x)=2\sum_{k\ge0}(-1)^{k}e^{-(2k+1)\pi x}\) produces incomplete Fresnel integrals \(\int_{0}^{\infty}\sin(\pi x^{2})e^{-(2k+1)\pi x}\,dx\), none of which has a closed form, so termwise work goes nowhere. Parseval with the self-dual pair \(\operatorname{sech}(\pi x)\) and \(e^{\pi i x^{2}}\) only shows that the full-line integral has argument \(\pi/8\), not its size. The route that works is a contour shift by half a period of \(\cosh\).
Step 1: complexify. Put \(J=\int_{-\infty}^{\infty}\frac{e^{\pi i x^{2}}}{\cosh(\pi x)}\,dx\), which converges absolutely. The integrand of \(I\) is even, so \(I=\tfrac12\operatorname{Im}J\).
Step 2: the contour. Let \(\varphi(w)=e^{\pi i w^{2}}/\cosh(\pi w)\). The zeros of \(\cosh(\pi w)\) are \(w=i(k+\tfrac12)\), so in the closed strip \(0\le\operatorname{Im}w\le\tfrac12\) the only pole is \(w=i/2\), on the top edge. Integrate \(\varphi\) around the rectangle with vertices \(\pm T\) and \(\pm T+\tfrac{i}{2}\), indenting the top edge by a small half circle below \(i/2\). The function is analytic inside, so the total is \(0\). As the radius shrinks, the clockwise half circle contributes \(-\pi i\operatorname{Res}_{w=i/2}\varphi\), and therefore
\[\int_{-T}^{T}\varphi(x)\,dx=\mathrm{PV}\!\int_{-T}^{T}\varphi\!\left(x+\tfrac{i}{2}\right)dx+\pi i\operatorname{Res}_{w=i/2}\varphi-(\text{vertical sides}).\]Step 3: the vertical sides vanish. On \(w=\pm T+iy\) with \(0\le y\le\tfrac12\) we have \(\lvert e^{\pi i w^{2}}\rvert=e^{\mp2\pi Ty}\) and \(\lvert\cosh(\pi w)\rvert\ge\sinh(\pi T)\). The right side is at most \(\tfrac12/\sinh(\pi T)\), and the left side at most \(\int_{0}^{1/2}e^{2\pi Ty}\,dy/\sinh(\pi T)\le e^{\pi T}/(2\pi T\sinh(\pi T))\). Both tend to \(0\).
Step 4: the residue. Since \(\frac{d}{dw}\cosh(\pi w)=\pi\sinh(\pi w)\) equals \(\pi i\) at \(w=i/2\), and \(e^{\pi i(i/2)^{2}}=e^{-\pi i/4}\), we get \(\operatorname{Res}_{w=i/2}\varphi=e^{-\pi i/4}/(\pi i)\), so \(\pi i\operatorname{Res}=e^{-\pi i/4}\).
Step 5: the top edge. Here \(\cosh\bigl(\pi x+\tfrac{\pi i}{2}\bigr)=i\sinh(\pi x)\) and \(e^{\pi i(x+i/2)^{2}}=e^{\pi i x^{2}}e^{-\pi x}e^{-\pi i/4}\). Hence
\[\varphi\!\left(x+\tfrac{i}{2}\right)=\frac{e^{-\pi i/4}}{i}\,e^{\pi i x^{2}}\,\frac{e^{-\pi x}}{\sinh(\pi x)}=\frac{e^{-\pi i/4}}{i}\,e^{\pi i x^{2}}\bigl(\coth(\pi x)-1\bigr).\]The piece \(e^{\pi i x^{2}}\coth(\pi x)\) is odd, so its principal value over \([-T,T]\) is exactly \(0\) for every \(T\). The remaining piece gives \(-\frac{e^{-\pi i/4}}{i}\int_{-T}^{T}e^{\pi i x^{2}}\,dx\), and by the Fresnel integral \(\int_{-\infty}^{\infty}e^{\pi i x^{2}}\,dx=e^{\pi i/4}\) this tends to \(-\frac{e^{-\pi i/4}e^{\pi i/4}}{i}=i\).
Step 6: assemble. Letting \(T\to\infty\),
\[J=i+e^{-\pi i/4}=\frac{1}{\sqrt2}+i\left(1-\frac{1}{\sqrt2}\right).\]As a check, \(\tan(\arg J)=\sqrt2-1=\tan(\pi/8)\), exactly the argument that Parseval predicts. Taking imaginary parts, \(\int_{-\infty}^{\infty}\frac{\sin(\pi x^{2})}{\cosh(\pi x)}\,dx=1-\frac{1}{\sqrt2}\), so \(I=\frac{2-\sqrt2}{4}\). The real part gives the companion \(\int_{0}^{\infty}\frac{\cos(\pi x^{2})}{\cosh(\pi x)}\,dx=\frac{1}{2\sqrt2}\). These are Ramanujan's evaluations, special cases of Mordell integrals.
Check. Composite 100-node Gauss-Legendre quadrature on \([0,16]\) with 200 and with 800 panels agrees with \((2-\sqrt2)/4\approx0.1464466094\) to within \(3\times10^{-16}\), and with \(1/(2\sqrt2)\) for the cosine companion to the same accuracy.
Competition problem
Two quadratics with swapped coefficients modulo a prime

Let \(p\) be a prime with \(p\equiv 5\pmod 6\). Determine, in terms of \(p\), the number of ordered pairs \((a,b)\) with \(a,b\in\{0,1,\dots,p-1\}\) such that both
\[x^{2}+ax+b\quad\text{and}\quad x^{2}+bx+a\]have a root modulo \(p\).
Show the solution
Work in \(\mathbb{F}_{p}\), let \(\chi\) be the Legendre symbol with \(\chi(0)=0\), and let \(\delta(D)=1\) if \(D=0\) and \(0\) otherwise. Write \(D_{1}=a^{2}-4b\), \(D_{2}=b^{2}-4a\), and let \(N\) be the required count. The natural first move, expanding everything into Legendre symbols, leaves the sum \(\sum_{a,b}\chi\bigl((a^{2}-4b)(b^{2}-4a)\bigr)\), a character sum along a quartic surface with no closed form in general: for \(p\equiv1\pmod 6\) the count is irregular (\(22\) for \(p=7\), \(55\) for \(p=13\)). The point is to evaluate that sum by counting roots instead.
Step 1: indicators. Since \(p\) is odd, \(x^{2}+ax+b\) has a root exactly when \(D_{1}\) is a square or \(0\), and then it has exactly \(1+\chi(D_{1})\) roots. The indicator of the first event is \(\tfrac12\bigl(1+\chi(D_{1})+\delta(D_{1})\bigr)\), so
\[4N=\sum_{a,b}\bigl(1+\chi(D_{1})+\delta(D_{1})\bigr)\bigl(1+\chi(D_{2})+\delta(D_{2})\bigr).\]Step 2: the key fact. As \(p\equiv2\pmod 3\), \(\gcd(3,p-1)=1\), so \(x\mapsto x^{3}\) is a bijection of \(\mathbb{F}_{p}\); in particular \(1\) is the only cube root of unity and \(64\) has the unique cube root \(4\).
Step 3: the easy terms. \(\sum1=p^{2}\). For fixed \(a\), \(D_{1}\) runs over all of \(\mathbb{F}_{p}\) as \(b\) varies, so \(\sum\chi(D_{1})=0\) and \(\sum\delta(D_{1})=p\); likewise for \(D_{2}\). The pairs with \(D_{1}=D_{2}=0\) satisfy \(4b=a^{2}\) and \(a^{4}=64a\), so \(a=0\) or \(a^{3}=64\), giving only \((0,0)\) and \((4,4)\): \(\sum\delta(D_{1})\delta(D_{2})=2\).
Step 4: the mixed terms. \(\delta(D_{2})=1\) forces \(a=b^{2}/4\); put \(b=4c\), so \(a=4c^{2}\) and \(D_{1}=16(c^{4}-c)\). Hence \(\sum\chi(D_{1})\delta(D_{2})=\sum_{c}\chi(c^{4}-c)\). The term \(c=0\) is \(0\), and for \(c\ne0\), \(\chi(c^{4}-c)=\chi(c^{4})\chi(1-c^{-3})=\chi(1-c^{-3})\). By Step 2, \(u=c^{-3}\) runs over \(\mathbb{F}_{p}^{\times}\), so the sum is \(\sum_{u\ne0}\chi(1-u)=\sum_{v}\chi(v)-\chi(1)=-1\). By symmetry \(\sum\delta(D_{1})\chi(D_{2})=-1\).
Step 5: the hard term by double counting. Let \(M\) be the number of quadruples \((a,b,r,s)\) with \(r^{2}+ar+b=0\) and \(s^{2}+bs+a=0\). Counting roots for each \((a,b)\),
\[M=\sum_{a,b}\bigl(1+\chi(D_{1})\bigr)\bigl(1+\chi(D_{2})\bigr)=p^{2}+S,\qquad S=\sum_{a,b}\chi(D_{1})\chi(D_{2}).\]Now count by \((r,s)\) instead. The first equation gives \(b=-r^{2}-ar\), and the second becomes \(s^{2}-r^{2}s+a(1-rs)=0\), which is linear in \(a\). If \(rs\ne1\) there is exactly one \(a\) (and then one \(b\)); there are \(p^{2}-(p-1)\) such pairs. If \(rs=1\) we need \(s(s-r^{2})=0\); since \(s\ne0\) this means \(s=r^{2}\), so \(r^{3}=1\), hence \(r=s=1\) by Step 2, and then every \(a\) works: \(p\) solutions. The other \(p-2\) pairs with \(rs=1\) give none. Thus \(M=p^{2}-p+1+p=p^{2}+1\) and \(S=1\).
Step 6: total. Adding everything,
\[4N=p^{2}+(0+0)+(p+p)+S+(-1)+(-1)+2=p^{2}+2p+1,\]so \(N=\left(\frac{p+1}{2}\right)^{2}\). For example \(p=5\) gives \(9\) and \(p=2027\) gives \(1014^{2}\).
Check. A brute-force count over all \(p^{2}\) pairs agrees with \(\bigl(\tfrac{p+1}{2}\bigr)^{2}\) for every prime \(p\equiv5\pmod 6\) below \(400\) (39 primes, from \(5\) to \(389\)), and confirms that the formula fails for \(p\equiv1\pmod 6\).