Multivariable calculus

Double Integral of sin x cos y Over a pi/2 Square

The double integral of sin x times cos y over the square from 0 to pi/2 in both variables equals 1. The integrand is a function of x alone times a function of y alone over constant limits, so the double integral is the product of the two single integrals, and each of them equals 1.

f(x,y)=sinxcosyf(x,y) = \sin x \cos y
0π/20π/2sinxcosydydx=1\int_{0}^{\pi/2}\int_{0}^{\pi/2} \sin x \cos y\,dy\,dx = 1

Numerically 1.000000, confirmed by quadrature on every build.

The product splits into two single integrals

In the inner integral xx is frozen, so sinx\sin x is a constant multiplier and comes straight out.

0π/2sinxcosydy=sinx[siny]0π/2=sinx\int_{0}^{\pi/2} \sin x \cos y\,dy = \sin x \left[\sin y\right]_{0}^{\pi/2} = \sin x

The outer integral is then an ordinary one-variable problem, and the whole computation collapses to a product.

0π/20π/2sinxcosydydx=(0π/2sinxdx)(0π/2cosydy)=(1)(1)=1\int_{0}^{\pi/2}\int_{0}^{\pi/2} \sin x \cos y\,dy\,dx = \left(\int_{0}^{\pi/2} \sin x\,dx\right)\left(\int_{0}^{\pi/2} \cos y\,dy\right) = (1)(1) = 1

The two conditions the shortcut needs

  • The integrand must be g(x)h(y)g(x)h(y), a genuine product with each variable in its own factor.
  • Every limit must be a constant, so the inner integral evaluates to a number times g(x)g(x).

Both conditions are easy to lose. sin(x+y)\sin(x+y) is not a product of that shape, and over the same square it integrates to 2 rather than 1, so the difference is not cosmetic.

The mechanism behind both conditions is one line. The inner integral 0π/2g(x)h(y)dy\int_{0}^{\pi/2} g(x)h(y)\,dy pulls g(x)g(x) out as a constant and leaves g(x)g(x) times the number 0π/2h(y)dy\int_{0}^{\pi/2} h(y)\,dy, and a number pulls straight out of the outer integral as well. That is what leaves a bare product. Break either condition and one of those two steps stops working.

The mistake: splitting when the limits are not constant

Keep the integrand and change the region to the triangle where 0xπ20 \le x \le \frac{\pi}{2} and 0yx0 \le y \le x. The inner integral now ends at a moving limit.

0xsinxcosydy=sinx[siny]0x=sin2x\int_{0}^{x} \sin x \cos y\,dy = \sin x \left[\sin y\right]_{0}^{x} = \sin^2 x
0π/2sin2xdx=π40.785\int_{0}^{\pi/2} \sin^2 x\,dx = \frac{\pi}{4} \approx 0.785

The split fails because the inner answer still depends on xx once the upper limit does. Whenever a limit contains a variable, drop the shortcut and integrate one layer at a time.

Frequently asked questions

Does the order of integration matter here?

No. Integrating in xx first gives cosy[cosx]0π/2=cosy\cos y \left[-\cos x\right]_{0}^{\pi/2} = \cos y, and then 0π/2cosydy=1\int_{0}^{\pi/2}\cos y\,dy = 1. Fubini's theorem guarantees the match for a continuous integrand on a rectangle.

What is the average value of the integrand on this square?

The integral divided by the area: 1π2/4=4π20.405\frac{1}{\pi^2/4} = \frac{4}{\pi^2} \approx 0.405. That sits between the corner values 0 and 1, as it must.