# Average distance between a point and the center of a unit square (Why my answer is wrong?)

This question is from the MIT OCW course on Multivariable Calculus, and that particular question has been answered in this forum before.

What I'd like to know is where is the mistake in my attempt to solve the problem, since I can't find anything incorrect in my line of reasoning, but the answer I got is incorrect.

The question is: "What's the average distance of a point in a unit square from the center?"

The answer given by MIT is $$\frac{1}{6}(\sqrt{2}+\ln(\sqrt{2}+1))$$

This answer was obtained by imagining the unit square centered at the origin and integrating with polar coordinates.

My attempt was more simplistic, but I don't see how it's wrong:

Suppose a unit square whose lower-left corner is at the origin, and the upper-right corner is at $$(1,1)$$. Its center is at the point $$(\frac{1}{2},\frac{1}{2})$$

Suppose a function $$f(x,y) = (x-\frac{1}{2})^2 + (y-\frac{1}{2})^2$$

This function outputs, for a given $$(x,y)$$ point, the square of the distance between the point and the point $$(\frac{1}{2},\frac{1}{2})$$, which is the center of the unit square.

So, applying the usual formula for the average of a function over a region $$R$$ with area $$1$$, we get that this average should be:

$$\frac{\int_0^1\int_0^1f(x,y)dA}{1}$$ = $$\int_0^1\int_0^1((x-\frac{1}{2})^2 + (y-\frac{1}{2})^2)dydx$$

Using this, the integral evaluates to $$\frac{1}{6}$$.

Since the function used was the square of the average of the distances, then I reckoned that the correct answer would be $$\sqrt{\frac{1}{6}}$$. Which is wrong.

Could anyone help me figure out where I went astray in my thinking? Thank you!

• Your reckoning is that $\sqrt{\int f \, dx} = \int \sqrt{f}\, dx$, but this is wrong.
– Jeff
Commented Apr 24, 2021 at 4:01

Since the function used was the square of the average of the distances, then I reckoned that the correct answer would be $$\sqrt{\frac{1}{6}}$$.
This is where you tripped up. It is not true that the average of the squares of some values is equal to the square of the average of those values. A simplistic check, for a finite sum: $$(1^2 + 2^2)/2 = 2.5$$ but $$[(1+2)/2]^2 = 2.25$$. The same holds even when integrating, as User Jeff points out in a comment: in general, $$\sqrt{\int f\, dx} \neq \int \sqrt{f}\, dx$$.