Compute $\iint_D4\cos^2{(2x+y)} \ dxdy$. 
Compute $$\iint_D4\cos^2{(2x+y)} \ dxdy,$$
where $D=\{2\leq 2x+y \leq 6, \ x\geq0, \ y\geq 0 \}.$

I want to make an apropriate change of variables. But to see what works, Here is a picure of the area:

So I realise that $u=2x+y$ is ok, but what should I set $v=$ to?
 A: Exact evaluation
For convenience, I set $v$ as the $u$-axis rotated by $90°$ anticlockwise.  i.e. $v = -x + 2y$.
\begin{align}
\begin{bmatrix}u \\ v\end{bmatrix} &= \begin{bmatrix}2 & 1 \\ -1 & 2 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} \\
\begin{bmatrix}  x \\ y \end{bmatrix} &= \begin{bmatrix}2 & 1 \\ -1 & 2 \end{bmatrix}^{-1} \begin{bmatrix} u \\ v \end{bmatrix} = \begin{bmatrix}2/5 & -1/5 \\ 1/5 & 2/5 \end{bmatrix} \begin{bmatrix} u \\ v \end{bmatrix}
\end{align}
Find the boundaries of $D$.


*

*$2 \le u \le 6$

*$x \ge 0 \iff 2u - v \ge 0 \iff v \le 2u$

*$y \ge 0 \iff u + 2v \ge 0 \iff v \ge -\dfrac12u$


Compute the Jacobian determinant.
$$\left|\frac{\partial(u,v)}{\partial(x,y)}\right| = \begin{vmatrix}2 & 1 \\ -1 & 2 \end{vmatrix} = 5$$
$$\left|\frac{\partial(x,y)}{\partial(u,v)}\right| = \frac15$$
\begin{align}
\iint_D4\cos^2{(2x+y)} \ dxdy, &= \int_2^6 \int_{-u/2}^{2u} 4 \cos^2 u \cdot \frac15 dvdu \\
&= \frac45 \int_2^6 \frac52u \cdot \frac{1+\cos(2u)}{2} du \\
&= \int_2^6 (u + u\cos(2u)) du \\
&= \frac{6^2-2^2}{2} + \left[ \frac{u\sin(2u)}{2} \right]_2^6 - \int_2^6 \frac{\sin(2u)}{2} du \\
&= 16 + 3\sin(12)-\sin(4) + \frac{\cos(12)}{4}-\frac{\cos(4)}{4}
\end{align}
Monte-Carlo estimation
I typed this section for fun.  Sometimes $D$ has a boundary that can only be expressed as implicit functions.  In this case, the MonteCarlo_double method in the book Programming for Computations will be useful.
from prog4comp.MC_double import MonteCarlo_double
from math import cos, sin

f = lambda x, y: 4*cos(2*x+y)**2
def g(x,y):
    return 1 if (x >= 0 and y >= 0 and 2 <= 2*x+y <= 6) else -1
x0, x1, y0, y1, n = 0, 3, 0, 6, 10000

I_mc = MonteCarlo_double(f, g, x0, x1, y0, y1, n)
exact = 16.0 + 3.0*sin(12.0) - sin(4.0) + cos(12.0)/4.0 - cos(4.0)/4.0
print I_mc, exact  # return: 15.551363873174763, 15.5214581362

The function f is the integrand, and g selects the points in $D$.  (i.e. $g = 1_D - 1_{D^C}$)  MonteCarlo_double estimates $\text{Area of }D \times \Bbb{E}[f(X_i)1_D]$, where $X_i \sim \mathrm{Unif}([0,3] \times [0,6])$.
An difference of about $0.03$ is observed when $n^2 = (10^4)^2 = 10^8$ points are randomly selected in the rectangle $[0,3] \times [0,6]$.  The hand-calculated value above is close enough to the Monte-Carlo estimation.
N.B.: The syntax for print in Python 2.7 differs from its counterpart in 3.4.  This estimation is a verification of an answer, but it's never an answer.
