Area of a Rectangle using a Double Integral in Polar Coordinates I'm trying to find the area (which we know is equal to $ab$) of the rectangle bounded by $0\leq x\leq a$ and $0\leq y\leq b$ where $0<a<b$ using a double-integral in polar coordinates. The double-integral must be of the form $r\ d\theta\ dr$.
Here is my attempt:
$$2\int_{0}^{\sqrt{a^2+b^2}}\int_{0}^{\arccos(a/r)} r\ d\theta\ dr$$

I've attempted to integrate from $\theta=0$ until the corner of the rectangle at $\theta=\arccos(a/r)$. The first integral is in terms of $r$ and the second integral is just integrating $r$ from $r=0$ to the corner at $r=\sqrt{a^2+b^2}$. I then multiply the area of this triangle by $2$ in order to produce the complete area of the rectangle.
The issue is that the solutions to this setup are imaginary!
PS: This was a question on a Calculus 3 test I took and I was only able to get 4/16 on this part of the question. I really want to understand if my answer is correct in any way and what is going on with it. I would also appreciate any suggestions on how I might argue for more points back as well! (assuming I'm not just blatantly wrong)
My main question is about WHY this is incorrect, why does this reorganization of variables in order to satisfy the integration-order result in imaginary solutions? Is this just a consequence of the arbitrary constrain of the domain of arccos? If arccos could be extended somehow to a larger space could this integral be solved correctly?Is it possible to extract the answer, $ab$, from the imaginary solution?
EDIT: I've solved the original integral that I set up and found an oddity. Evaluation of the integral yields a result with three components that I've identified: an imaginary component, an irrational component (in terms of $\pi$), and a rational component. Turns out, the magnitude of the rational component is $ab$. Here is the result of the original integral, from Mathematica:
$$a^2\mathbb{i}+(a^2+b^2)\arccos{\left(a/\sqrt{a^2+b^2}\right) }-ab$$
Clearly the magnitude of the rational component is $ab$... but why; what is the significance of this... Is it merely a coincidence? Is it reasonable to say that, in the context of rational solutions, my original integral is correct in any sense?
 A: As it stands, it looks like you've got your order of integration switched (you're integrating $r$ over the bounds you specified for $\theta$, and vice versa). Your idea looks perfectly correct, though. 
Edit in response to your edit: I doubt changing the lower bound of $r$ from $r=0$ to $r=a$ is the solution. Since the graph of $r=a$ is a circle of radius $a$, all that change would do is remove the area enclosed by that circle from your final answer.
Edit 2: There are a couple problems. First of all, after integrating with respect to $\theta$ in the integral you presented, you're left having to integrate $\arccos(a/r)$ with respect to $r$, which is indeed imaginary. That's not good. Furthermore, your upper bound for $r$ currently describes a circle with radius $\sqrt{a^2+b^2}$, which is not the figure whose area you want to calculate. You need to express the vertical line $x=a$ in polar coordinates, which would be $r=a\sec\theta$. Thus, changing the order of integration, replacing the upper bound of $r$ with $a\sec\theta$, and replacing $\arccos(a/r)$ with $\arctan(b/a)$ (you can prove those two terms are equivalent using geometry, and using the latter removes an unnecessary $r$ from your bounds), we arrive at the following integral:
$$2\int_0^{\arctan(b/a)}\int_0^{a\sec\theta}r\ dr\ d\theta,$$
which does, in fact, evaluate to $ab$ (at least according to Desmos).
Edit 3: Here's how that integral actually evaluates to $ab$. Let's call the value of the integral $A$.
$$\begin{align}
A&=2\int_0^{\arctan(b/a)}\int_0^{a\sec\theta}r\ dr\ d\theta \\
&=2\int_0^{\arctan(b/a)}\left[\frac12r^2\right]_0^{a\sec\theta}d\theta \\
&=a^2\int_0^{\arctan(b/a)}\sec^2\theta\ d\theta \\
&=a^2\Big[\tan\theta\Big]_0^{\arctan(b/a)} \\
&=a^2\left(\frac ba\right) \\
&=ab
\end{align}$$

Another edit: In answer to your main question, yes, it does have to do with the domain of $\arccos$. To show why, let's evaluate part of your integral:
$$2\int_{0}^{\sqrt{a^2+b^2}}\int_{0}^{\arccos(a/r)} r\ d\theta\ dr=2\int_0^{\sqrt{a^2+b^2}}r\arccos\left(\frac ar\right)dr$$
The function $f(x)=x\arccos\left(\frac ax\right)$ isn't defined for $-a\lt x\lt a$, so it looks like trying to include $r=0$ and any other $r$ less than $a$ in your region of integration is what's giving you the imaginary answer. I don't think there's a way to "fix" that and extract the correct answer; I think getting the correct answer with that order of integration would require different bounds, probably involving $\theta=($some function of $r)$, as suggested by the answer to this question, if it's possible at all.

And another edit: It's very interesting that $ab$ turns up in the result of your original integral, but unless there's some deep truth of mathematics I'm not aware of, I'm willing to chalk that up as a coincidence. We often talk about separating the real part of a number from its imaginary part, so perhaps more of an argument could be made if the magnitude of the entire real part of the answer were $ab$, but that's not the case here.
I would suggest that you talk to your instructor and ask how he/she intended you to do this problem with the requisite order of integration (for your sake and also because I'm really curious now).
A: The limits of the integral in polar coordinates for the lower half of the rectangle are $$ 0\le \theta \le \tan^{-1} (b/a)$$
$$ 0\le r\le a \sec (\theta)$$
Thus you have $$ A= 2 \int _{0}^{  \tan^{-1} (b/a)} \int _{0} ^{a \sec (\theta)}rdr d \theta =ab$$
Note that the anti derivative of $\sec ^2 \theta $ is $\tan \theta $ and $\tan   (\tan ^{-1} b/a)=b/a $ 
