# Polar coordinates for a triangle-shaped domain.

I have to integrate the function $f(x,y)=\displaystyle\frac{x^2}{x^2+y^2}$ and the domain is given by the triangle determined by the points $(0,0)$, $(1,-1)$ and $(1,1)$.

Would polar coordinates be a good change of variables?. I tried with this first because the integral would be simplified to $\displaystyle\int\displaystyle\int\displaystyle\frac{r^2\cos^2\theta}{r^2\cos^2\theta+r^2\sin^2\theta}r\;drd\theta=\displaystyle\int\displaystyle\int r\cos^2\theta\;drd\theta$ that seems a lot handier.

But what would be the limits of integration if I'm working with polar coordinates?.

The plan so far would be work with the upper triangle determined by the points $(0,0);(1,0);(1,1)$ first and then work with the other one. Then I have $0\leq\theta\leq\pi/4$ but how could I determine de limits of $r$?. Seems that $r$ is given by a function of $\theta$ that I have some issues to find; looking at some trigonometric values an appropriate approach may be given by the definition $r(\theta)=2\sin\theta$ so that $r(0)=0$ and $r(\pi/4) = \sqrt{2}$ but this correct?.

Also, since it works reversed for the lower triangle -determined by $(0,0);(1,0);(1,-1)$- should I set the limits reversed for the integral? This is, if for the upper triangle I have $\int_0^{\pi/4}\int_{1}^{2\sin(\theta)}\small p(r,\theta)r \operatorname{dr}\operatorname{d\theta}$ then for the lower one I would work with $\int_{\color{red}{-\pi/4}}^{\color{red} 0}\int_{2\sin(\theta}^{1}\small p(r,\theta)r \operatorname{dr}\operatorname{d\theta}$ ?

Am I proceeding correctly?, maybe there is a better change of variables?

EDIT: I changed the limits of the last integral, the former one $\left(\int_0^{\pi/4}\right)$ was going through the upper triangle again...

The polar-coordinate change probably is a good choice, yes. The problem is to express $r$, along the vertical edge, as a function of $\theta$. That vertical edge consists of points where $x = 1$, i.e., where $r \cos \theta = 1$. So $r$ can be expressed as $1 / \cos(\theta)$. That means that your integral becomes

$$\int_{\theta = -\pi/4}^{\pi/4} \int_{r = 0}^{1/\cos(\theta)} r \cos^2 \theta dr~d\theta$$

I don't know whether that integral works out nicely or not .... but it looks as if it does, and I'll leave it to you to do the actual integration.

If you consider the triangle with vertices $(0,0)$ , $(1,-1)$ and $(1,1)$, then the side with vertices $(1,-1)$ and $(1,1)$ is the locus of points

$$z=r e^{i\theta}$$

s.t. $\operatorname{Re}(z)\stackrel{!}{=}1$, i.e. $r\cos\theta=1\Leftrightarrow r(\theta)=\frac{1}{\cos\theta}$, with $\theta\in[-\frac{\pi}{4},\frac{\pi}{4}]$.

If you consider the triangle with vertices $(0,0)$ , $(1,0)$ and $(1,1)$ you follow the same lines, with $\theta\in [0,\frac{\pi}{4}]$.