# Average distance from center to random point in rectangle

I need to find average squared distance from center in rectangle. One edge is 2, other one is 1. On my understanding I need to find $$E[X^2+Y^2]$$ So I got $$\int_{-1}^{1}\int_{-0.5}^{0.5}x^2+y^2dxdy$$ Is it ok, or I am missing something?

• Assuming uniform distribution, the joint density is $\frac{1}{2}$ in the rectangle. – André Nicolas May 12 '14 at 17:28

Yes, you're off by a factor of two because your $y$-range runs from -1 to 1 but you're computing an average.
To explain further, suppose that you're computing the average distance to the origin of a line segment $[-a,a]$ for $a>0$. That should be
$$\frac{1}{2a} \int_{-a}^a |t| dt= \frac{1}{a} \int_0^a t dt = \frac{a}{2},$$