What is average distance from center of square to some point?

Without loss of generality we find the average distance to the origin of a randomly selected point in the region $R:=\{(x,y): 0\leq y\leq x\leq L/2\}$. The region $R$ is a triangle that is one-eighth of the original square. The uniform density on this region is $$f(x,y)=\cases{8/L^2 &if $(x,y) \in R$\cr 0&\text{otherwise.}}$$

Therefore $$\begin{eqnarray} \text{average distance} &=& \int_0^{L/2} \int_0^x \sqrt{x^2+y^2}\,dy\,dx \ {8\over L^2} \\ &=& \int_0^{L/2}\int_0^1 x^2\sqrt{1+w^2}\,dw \,dx\ {8\over L^2} \\ &=& \int_0^1 \sqrt{1+w^2}\,dw\quad \int_0^{L/2} x^2\,dx \quad\ {8\over L^2} \\ &=& \int_0^1 \sqrt{1+w^2}\,dw\quad {1\over 3}\left({L\over 2}\right)^3 {8\over L^2} \\ &=& {L\over 6} \left(\sqrt{2}+\log(1+\sqrt{2})\right). \end{eqnarray} $$


Update: In the comments below, Isaac outlined a nice trig substitution to evaluate $I:=\int_0^1\sqrt{1+w^2}\,dw$. For completeness, here is another way. First do a change of variables $w=x/\sqrt{1-x^2}$, then use partial fractions to obtain $$\begin{eqnarray} I &=& \int_0^{1/ \sqrt{2}} {dx\over(1-x^2)^2} \\ &=& {1\over 4} \int_0^{1/ \sqrt{2}}\left[{1\over(1+x)^2}+{1\over(1-x)^2} +{1\over 1+x}+{1\over 1-x} \right]\, dx \\ &=& {1\over 4} \left[{1\over \sqrt{2}+1}+ {1\over \sqrt{2}-1} +(-\log(2)+\log(\sqrt{2}+2))+ (\log(2)-\log(2-\sqrt{2})) \right]\\ &=&{1\over 2}\left[\sqrt{2}+ \log(1+\sqrt{2}) \right]. \end{eqnarray}$$


For the average distance, what you want is the expected value of the distance from the center over the set of all points in the square, which is the sum of the probability of each point times the distance to that point. The problem is (more or less) that there are a whole lot of points and each point has infinitesimal probability. One way to deal with this is to use calculus.

Consider the square with sides of length 1 parallel to the axes and centered at the origin. This square is the set of points $(x,y)$ with $-\frac{1}{2}\le x\le\frac{1}{2}$ and $-\frac{1}{2}\le y\le\frac{1}{2}$. The total area of the square is 1. The sum of the probabilities of each point (not dealing with distance yet) is $\int_{-\frac{1}{2}}^{\frac{1}{2}}\int_{-\frac{1}{2}}^{\frac{1}{2}}\;dx\;dy=1$. Now, at each point, multiply the probability by the distance to get the average distance: $\int_{-\frac{1}{2}}^{\frac{1}{2}}\int_{-\frac{1}{2}}^{\frac{1}{2}}\sqrt{x^2+y^2}\;dx\;dy$.