I guess I need to find a line perpendicular to y = -x and find the distance
That's right. In general the distance $d(x,y)$ from a point $P(x,y)$ to a straight line $r$ whose equation is $Ax+By+C=0$ can be derived algebraically as follows:
- Find the equation of the straight line $s$ passing through $P$ and being orthogonal to $r$. Call $Q$ the intersecting point of $r$ and $s$.
- Find the coordinates of $Q(x_{Q},y_{Q})$.
- Find the distance $d(x,y)$ from $P(x,y)$ to $Q(x_{Q},y_{Q})$. We get the formula $\begin{equation*} d(x,y)=\frac{|Ax+By+C|}{\sqrt{A^{2}+B^{2}}}.\tag{0} \end{equation*}$
In the present case, since the given equation is $x+y=0$, we have $A=B=1,C=0$. So $\begin{equation*} d(x,y)=\frac{|x+y|}{\sqrt{2}}.\tag{1}\qquad \end{equation*}$
Let $R$ be the given quarter disc, centered at $(0,0)$ and radius $a\ge 0$. Its area $A$ is $\pi a^{2}/4$. In the following picture $d(x_k,y_k)$ is the distance of the point $(x_k,y_k)$ to the line $y=-x$.
Notice that
- $x^{2}+y^{2}=a^{2}$ is equivalent to $y=\pm \sqrt{a^{2}-x^{2}}$.
- The condition $y\geq 0$ excludes the negative sign.
- $|x+y|=x+y$ in $R$.
Therefore
$\begin{equation*} d(x,y)=\frac{x+y}{\sqrt{2}}.\tag{2} \end{equation*}$
Let's decompose $R$ by a partition of $n$ rectangular cells. If the area of the $k^{th}$ cell is $\Delta A_{k}$ and we choose an arbitrary point $\left( x_{k},y_{k}\right) $ in it (see picture above), then the average distance $d_{\text{avg}}$ is obtained by a limiting process. It satisfies
$\begin{eqnarray*} A\cdot d_{\text{avg}} &=&\lim_{n\rightarrow \infty }\sum_{k=1}^{n}d\left( x_{k},y_{k}\right) \Delta A_{k}=\iint_{R}\frac{x+y}{\sqrt{2}}\;\mathrm{d}A \\ \frac{\pi a^{2}}{4}d_{\text{avg}} &=&\iint_{R}\frac{x+y}{\sqrt{2}}\;\mathrm{d} A \\ &=&\frac{1}{\sqrt{2}}\int_{x=0}^{a}\int_{y=0}^{\sqrt{a^{2}-x^{2}}}x+y\;\mathrm{d}x\;\mathrm{d}y, \end{eqnarray*}$
which implies $\begin{equation*} d_{\text{avg}}=\frac{2\sqrt{2}}{\pi a^{2}}\int_{0}^{a}\left( \int_{0}^{\sqrt{a^{2}-x^{2}}}x+y\;\mathrm{d}y\right) \;\mathrm{d}x. \end{equation*}\tag{3}$
This corresponds to the integral indicated by your friend divided by the area of the region.
It looks like we are always integrating the distance from $0$ to $a$
The limits of integration are $0\le x\le a$ (with $a\ge 0$) and $0\le y\le \sqrt{a^{2}-x^{2}}$, and the distance is the function of $x$ and $y$ given by $(2)$.
If we decompose the region $R$ into cells with a shape of sectors of a circle, which corresponds to using polar coordinates $x=r\cos \theta ,y=r\sin \theta $, $R$ is limited by $0\leq r\leq a$ and $0\leq \theta \leq \pi /2$. The Jacobian of the transformation is $r$.