# Find average distance from line to disk

I need to solve the following problem, given in my book.

Calculus A complete course 9th - Robert A Adams

14.4 25.

"Find the average distance from points in the quarter disk $x^2 + y^2 \leq a^2 \ , \, x \geq 0 \ , \ y \geq 0, \,$ to the line $x + y = 0$.

I tried drawing an image as shown below

My friend says that the solution can be found by solving

$$\large \int_0^a \int_0^\sqrt{a^2-x^2} \frac{x+y}{\sqrt{2}} \,\mathrm{d}x \, \mathrm{d}y$$

But I can not really see why this double integral works, it looks like we are always integrating the distance from $0$ to $a$. But in my eyes the distance changes.

I guess I need to find a line perpendicular to $y = -x$ and find the distance, but could anyone help me out? I've been sitting a few hours with this problem now =(

-
Lines perpendicular to $y = -x$ will be of the form $y = x + b$ – The Chaz 2.0 Mar 8 '12 at 20:41
See here. This gives you the function you want to find the average value of over your region. You friend has the proper function, but you need to divide the integral you have by the area of the region. – David Mitra Mar 8 '12 at 21:17
The area is just a quarter of a circle right $\pi a^2/4$ ? =) – N3buchadnezzar Mar 8 '12 at 21:20
Also perhaps of interest is the fact that the answer will be the distance from the centroid of your quarter-disk to your line (which, by symmetry, will be the distance from the centroid to the origin). The calculation of the $x$ or $y$ coordinate of the centroid involves an easy one-variable integral. – Robert Israel Mar 8 '12 at 23:22
@Robert Israel: Nice comment! One might add that if we are not in an integrating mood, we can find the centroid by the theorem of Pappus. – André Nicolas Mar 9 '12 at 0:01

Let $D(x,y)$ be the distance from the point $(x,y)$ to our line. Call the quarter-disk $Q$. We calculate $$\iint_Q D(x,y) \,dA$$ and divide the result by the area of $Q$. Because of the symmetry, it seems best to use polar coordinates. But it would be worthwhile to compute using rectangular coordinates, and compare.

Suppose that point $P$ in our quarter-disk has polar coordinates $(r,\theta)$. Join the origin to $P$, and drop a perpendicular from $P$ to our line. The picture shows that the distance from $P$ to our line is $r\sin(\theta+\pi/4)$. So we want $$\iint_Q r^2 \sin(\theta+\pi/4)\,dr\,d\theta.$$

Remark: Add to your picture the point $P$, join it to the origin, and drop a perpendicular as suggested above. You will see from basic trigonometry that the distance from $P$ to the line $x+y=0$ is $r\sin(\theta+\pi/4)$. Then by the Addition Law for the sine function, $$r\sin(\theta+\pi/4)=r\sin(\pi/4)\cos\theta+r\cos(\pi/4)\sin \theta= \frac{1}{\sqrt{2}} \left(r\cos\theta+r\sin\theta\right)=\frac{1}{\sqrt{2}}(x+y).$$ This gives an explanation different from the Linear Algebra formula for the fact that the distance from $(x,y)$ to the line is $\frac{x+y}{\sqrt{2}}$.

-

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:

1. 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$.
2. Find the coordinates of $Q(x_{Q},y_{Q})$.
3. 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$.

-