Calculate the following integral: double integral over D
Calculate the following integral: $$ \iint_D x\sin(x+y)\,dx\,dy, $$ where $0<x<\pi$ and $0<y<\frac{\pi}{2}$.
Explanation of Method
Integrating first with respect to $y$ (treating $x$ as a constant) is straightforward since $\sin(x+y)$ has an elementary antiderivative in $y$. The resulting expression $x(\sin x+\cos x)$ is then handled with two applications of integration by parts in $x$.
- Integrate with respect to $y$ using $u=x+y$.
- Simplify using $\cos(x+\tfrac\pi2)=-\sin x$.
- Integrate $x\sin x$ and $x\cos x$ separately by parts.
Step 1 · Identify the region
$D=[0,\pi]\times\left[0,\frac\pi2\right]$.
Step 2 · Set up the integral
$$ I = \int_0^{\pi}\int_0^{\pi/2} x\sin(x+y)\,dy\,dx. $$
Step 3 · Integrate with respect to $y$
With $u=x+y$: $\displaystyle\int_0^{\pi/2}\sin(x+y)\,dy = \int_x^{x+\pi/2}\sin u\,du = \Big[-\cos u\Big]_x^{x+\pi/2} = \cos x-\cos\!\left(x+\frac\pi2\right)$.
Using $\cos\!\left(x+\frac\pi2\right)=-\sin x$:
$$ x\int_0^{\pi/2}\sin(x+y)\,dy = x(\sin x+\cos x). $$
Step 4 · Integrate with respect to $x$
$$ I = \int_0^{\pi} x\sin x\,dx + \int_0^{\pi} x\cos x\,dx. $$
First integral (parts, $u=x$, $dv=\sin x\,dx$):
$$ \int_0^{\pi} x\sin x\,dx = \Big[-x\cos x\Big]_0^{\pi} + \int_0^{\pi}\cos x\,dx = \pi + \Big[\sin x\Big]_0^{\pi} = \pi + 0 = \pi. $$
Second integral (parts, $u=x$, $dv=\cos x\,dx$):
$$ \int_0^{\pi} x\cos x\,dx = \Big[x\sin x\Big]_0^{\pi} - \int_0^{\pi}\sin x\,dx = 0 - \Big[-\cos x\Big]_0^{\pi} = -(1+1) = -2. $$
Step 5 · Combine the results
$$ I = \pi + (-2) = \pi - 2. $$
Additional Notes
- Both $\int_0^\pi x\sin x\,dx=\pi$ and $\int_0^\pi x\cos x\,dx=-2$ are standard integration-by-parts results worth remembering.
Result
The solution to the integral is: