Integrating a function over a square using polar coordinates Say we have a function $f(x,y)$ over the unit circle. To integrate with polar coordinates we replace the x and y in $f(x,y)$ with $r\cos\theta$ and $y\sin\theta$ to get $f(r,\theta)$ and we integrate $f(r,\theta)rdrd\theta$ for $r$ between $0$ and $1$ and $\theta$ between 0 and $2\pi$. What if we want to integrate over a square using polar coordinates. What must we do?
 A: For each of the four sides that make up the square, we will have $0 \le r \le p\sec(\theta-c)$, for suitable values of $p$ and $c$, and $\theta$ ranging suitably, as follows:
Notice how $r=\sec(\theta)$ is the equation of a straight line with perpendicular angle $0$ (vertical), one unit to the right of the origin, so $r = p\sec(\theta-c)$ is a line $p$ units away from the origin rotated (anti-clockwise) by $c$.
See Polar Coordinate function of a Straight Line
So for a square with corners $(\pm p,\pm p)$, its sides are the lines
$\displaystyle
p\sec\left(\theta\right),
p\sec\left(\theta-\frac{π}{2}\right),
p\sec\left(\theta-π\right),
p\sec\left(\theta-\frac{3π}{2}\right)$
with
$\theta\in
\{-\frac{π}{4},\frac{π}{4}\},
\{\frac{π}{4},\frac{3π}{4}\},
\{\frac{3π}{4},\frac{5π}{4}\},
\{\frac{5π}{4},\frac{7π}{4}\}$ respectively
So we will have the sum of $4$ double integrals, representing the four right triangles whose corners are a pair of adjacent corners of the square and its centre, which together form the square.
For $c\in\{0, \frac{\pi}{2}, \pi, \frac{3\pi}{2}\}$, we have
$\displaystyle \int_{c-\frac{π}{4}}^{c+\frac{π}{4}}\int_0^{p\sec(\theta-c)}f(r,\theta)r\,dr\,d\theta$
A: Hint:
Write the "equation of the square" in polar coordinates.
The domain is limited on the right by the inequation $$x=\rho\cos\theta\le c$$ and this holds for $$|\theta|\le\frac\pi2.$$
You can repeat the reasoning for the four sides.
