Multivariable calculus

Double Integral of cos(x^2) Over a Triangle

The double integral of cos of x squared over the triangle where y runs from 0 to x and x runs from 0 to the square root of pi/2 equals exactly 1/2. Integrating in y first produces a factor of x, which turns the outer integral into the substitution u = x squared.

f(x,y)=cos ⁣(x2)f(x,y) = \cos\!\left(x^{2}\right)
12\dfrac{1}{2}

Numerically 0.500000, confirmed by quadrature on every build.

The inner integral supplies the factor the substitution needs

The region is the triangle below the line y=xy = x, with xx running from 00 to π/21.2533\sqrt{\pi/2} \approx 1.2533. The integrand has no yy in it, so the inner integral just measures the height of the slice.

0xcos ⁣(x2)dy=cos ⁣(x2)[y]0x=xcos ⁣(x2)\int_{0}^{x} \cos\!\left(x^{2}\right)\,dy = \cos\!\left(x^{2}\right)\Big[y\Big]_{0}^{x} = x\cos\!\left(x^{2}\right)

That xx out front is exactly half of ddx(x2)=2x\frac{d}{dx}\left(x^{2}\right) = 2x, so the outer integral is a substitution with u=x2u = x^{2}, du=2xdxdu = 2x\,dx.

0π/2xcos ⁣(x2)dx=[sin ⁣(x2)2]0π/2=sin(π/2)20=12\int_{0}^{\sqrt{\pi/2}} x\cos\!\left(x^{2}\right)\,dx = \left[\frac{\sin\!\left(x^{2}\right)}{2}\right]_{0}^{\sqrt{\pi/2}} = \frac{\sin(\pi/2)}{2} - 0 = \frac{1}{2}

Why the reversed order is a dead end

Describing the same triangle by horizontal slices puts yy outside and xx from yy to π/2\sqrt{\pi/2} inside. The value is unchanged, but the inner integral becomes impossible by hand.

0π/2 ⁣ ⁣yπ/2cos ⁣(x2)dxdy=12\int_{0}^{\sqrt{\pi/2}}\!\!\int_{y}^{\sqrt{\pi/2}} \cos\!\left(x^{2}\right)\,dx\,dy = \frac{1}{2}

The function cos ⁣(x2)\cos\!\left(x^{2}\right) has no elementary antiderivative; the integral cos(x2)dx\int \cos(x^2)\,dx is the Fresnel integral, a named special function. Without the xx that the dydy integration hands you, there is nothing to substitute with.

  • If a problem hands you this order, reversing it is the intended move, not an optional shortcut.
  • Sketch the triangle, read it by vertical slices instead, and the xx appears on its own.
  • The same pattern rescues ex2e^{x^{2}}, sin ⁣(x2)\sin\!\left(x^{2}\right) and sinxx\frac{\sin x}{x} style integrands.

The mistake: dropping the chain-rule half

After reaching xcos ⁣(x2)dx\int x\cos\!\left(x^{2}\right)\,dx, a common slip is to write the antiderivative as sin ⁣(x2)\sin\!\left(x^{2}\right) with no factor of 12\frac{1}{2}, which doubles the answer to 11.

ddxsin ⁣(x2)=2xcos ⁣(x2),ddx[sin ⁣(x2)2]=xcos ⁣(x2)\frac{d}{dx}\sin\!\left(x^{2}\right) = 2x\cos\!\left(x^{2}\right), \qquad \frac{d}{dx}\left[\frac{\sin\!\left(x^{2}\right)}{2}\right] = x\cos\!\left(x^{2}\right)

Differentiating your antiderivative back before you evaluate it catches this every time, and costs about five seconds. The integrand has one xx, not two, so the 12\frac{1}{2} has to be there.

Frequently asked questions

Why is the upper limit sqrt(pi/2) rather than something rounder?

It is chosen so that x2x^{2} reaches exactly π/2\pi/2, where sin ⁣(x2)=1\sin\!\left(x^{2}\right) = 1. That makes the final answer the clean 1/21/2 instead of a decimal with no closed form.

Is cos(x^2) positive over the whole region?

Yes. Here x2x^{2} runs from 00 to π/2\pi/2, and cosine is non-negative on that interval. So 1/21/2 is an honest volume, not a signed cancellation.