Calculating double integral by converting to polar coordinates Question: Evaluate the integral 
$$\int_0^1\int_x^1 \arctan\left(\frac{y}{x}\right) \ dy\,dx $$
My attempt:
So I've converted the integral into polar coordinates, getting the integral 
$$\int_0^\frac{\pi}{4}\int_0^\frac{1}{\cos(\theta)} \theta r\,dr\,d\theta \ =\int_0^\frac{\pi}{4} \frac{\theta }{2\cos^2(\theta)} \, d\theta \ $$
However I have no idea where to go from here? Have I calculated the limits wrong or am I missing something?
Thank you
 A: Do you have your limits of integration correct?
In Cartesian, if your limits are set up correctly at the beginning, your region is 
$x=y, y=1, x=0$  And since $x<1$ you are going to get a negative value when you integrate.
After you have converted, you have $r = \csc \theta$ which is consistent with y=1.  If the rest of the set up was right, you should have $\theta$ from $\pi/4$ to $\pi/2$
Alternatively, if your region was $x = 1, y=0, x=y$ your limit become $r$ from $0$ to $\sec\theta, \theta$ from $0$ to $\pi/4$
A: You need this:
$$
\int_0^{\pi/4}\int_0^{1/\cos\theta} \theta r\,dr\,d\theta.
$$
Notice that $x$ goes from $0$ to $1$.  So you have a right triangle whose "adjacent" side has length $1$, and $r$ is the length of the hypotenuse.
$$
\frac{\text{adjacent}}{\text{hypotenuse}} = \cos\theta = \frac 1 r,
$$
so $r$ goes up to $1/\cos\theta$.  So you get
\begin{align}
& \int_0^{\pi/4} \frac \theta {2\cos^2\theta} \,d\theta = \frac 1 2 \int_0^{\pi/4} \theta \Big( \sec^2\theta \,d\theta \Big) \\[12pt]
= {} & \overbrace{\frac 1 2 \int \theta\,dv = \frac 1 2 \theta v - \frac 1 2 \int v\,d\theta}^\text{integration by parts} \\[12pt]
= {} & \frac 1 2 \left[ \theta\tan\theta \vphantom{\frac 1 1} \right]_0^{\pi/4} - \frac 1 2 \int_0^{\pi/4} \tan\theta\,d\theta = \text{etc.}
\end{align}
Recall that
\begin{align}
& \int\tan\theta\,d\theta = \int \frac{\sin\theta}{\cos\theta}\,d\theta \\[6pt]
= {} & \int \frac {-1}{\cos\theta} \Big( - \sin\theta\,d\theta\Big) = \int \frac {-1} u\,du = \text{etc.}
\end{align}
