Multivariable calculus

Double Integral of y sin(xy) Over a Rectangle

The double integral of y times sin(xy), with x from 0 to pi/2 and y from 0 to 1, equals 1 - 2/pi, about 0.3634. Integrating in x first is the easy order: the inner integral is a plain substitution and gives 1 - cos(pi y / 2).

f(x,y)=ysin⁡(xy)f(x,y) = y\sin(xy)
1−2π1 - \dfrac{2}{\pi}

Numerically 0.363380, confirmed by quadrature on every build.

Integrate in x first, where the y out front is the chain-rule factor

Hold yy fixed. Then ysin⁡(xy)y\sin(xy) is exactly the xx derivative of −cos⁡(xy)-\cos(xy), so the inner integral needs no technique beyond recognising it.

∫0π/2ysin⁡(xy) dx=[−cos⁡(xy)]x=0x=π/2=1−cos⁡ ⁣(πy2)\int_{0}^{\pi/2} y\sin(xy)\,dx = \Big[-\cos(xy)\Big]_{x=0}^{x=\pi/2} = 1 - \cos\!\left(\frac{\pi y}{2}\right)

Now integrate that in yy over [0,1][0,1]. The cosine picks up a factor of 2/π2/\pi when you undo its inner derivative.

∫01(1−cos⁡ ⁣(πy2)) dy=[y−2πsin⁡ ⁣(πy2)]01=1−2π\int_{0}^{1}\left(1 - \cos\!\left(\frac{\pi y}{2}\right)\right)\,dy = \left[y - \frac{2}{\pi}\sin\!\left(\frac{\pi y}{2}\right)\right]_{0}^{1} = 1 - \frac{2}{\pi}

Numerically 1−2/π≈0.36341 - 2/\pi \approx 0.3634.

Why the other order needs integration by parts

Fix xx instead and integrate in yy. Now the factor yy is a genuine second function, not a chain-rule leftover, so parts is unavoidable.

∫01ysin⁡(xy) dy=sin⁡xx2−cos⁡xx\int_{0}^{1} y\sin(xy)\,dy = \frac{\sin x}{x^{2}} - \frac{\cos x}{x}

That is a detour, not a dead end. The expression is the derivative of −sin⁡xx-\frac{\sin x}{x}, so the outer integral does close in elementary terms once you spot that.

∫0π/2(sin⁡xx2−cos⁡xx) dx=[−sin⁡xx]0π/2=−2π+1\int_{0}^{\pi/2}\left(\frac{\sin x}{x^{2}} - \frac{\cos x}{x}\right)\,dx = \left[-\frac{\sin x}{x}\right]_{0}^{\pi/2} = -\frac{2}{\pi} + 1

Same number, three extra moves: parts, a removable singularity at x=0x = 0 where sin⁡xx→1\frac{\sin x}{x} \to 1, and a quotient-rule derivative read backwards. The skill being tested is choosing the order before you start, not surviving the wrong one.

  • Look at which variable appears as a bare multiplying factor. Here it is yy.
  • That factor is usually the chain-rule derivative of the inner function, so integrate with respect to the other variable, xx.
  • The rule of thumb: integrate first in the variable that is not the loose factor out front.

The mistake: pulling y out and forgetting it is inside the sine

Because yy is constant during the xx integration, it is tempting to write y∫0π/2sin⁡(xy) dxy\int_{0}^{\pi/2}\sin(xy)\,dx and then integrate sin⁡(xy)\sin(xy) as though it were sin⁡x\sin x.

∫sin⁡(xy) dx=−cos⁡(xy)y,not−cos⁡(xy)\int \sin(xy)\,dx = -\frac{\cos(xy)}{y}, \qquad \text{not} \quad -\cos(xy)

The missing 1/y1/y is exactly what cancels the yy out front. Dropping it leaves an answer that still has a stray yy in it, and the outer integral then produces a different number.

Check any antiderivative by differentiating it back. If ∂∂x\frac{\partial}{\partial x} of your inner answer does not reproduce ysin⁡(xy)y\sin(xy) exactly, the chain-rule factor is wrong.

Frequently asked questions

Why does the inner variable here have the constant bounds?

The region is a rectangle, so both variables have constant bounds and either can be inner. The order was chosen for convenience, not necessity. With xx inner from 00 to π/2\pi/2, the inner integral is a one-line substitution.

Is 1 - 2/pi a plausible size for this volume?

Yes. The integrand ysin⁡(xy)y\sin(xy) never exceeds 11 on this region and is 00 along y=0y = 0, so the volume must be well under the base area π/2≈1.571\pi/2 \approx 1.571. The value 0.36340.3634 fits.