Mean distance from origin of a random point in unit square A unit square has vertices (0,0), (1,0), (1,1) and (0,1).
A point P is chosen at random inside the square; P is (x,y).
What is the expected mean of the distance of P from the origin O?
I think I need double integrals, but I am struggling!
 A: Start supposing X,Y are iid uniform in $(0;1)$. Now you can do a drawing of your problem...

...and realize which is the formula of your random segment...and then using the definition of
$$E[g(X,Y)]=\int_{-\infty}^{+\infty}\int_{-\infty}^{+\infty}g(x,y)f(x,y)dxdy$$
you should be able to complete the solution
A: Yes, you're right. Let $D=\sqrt{X^2+Y^2}$, you can compute:
$$\mathbf{E}[D]=\int_0^1\int_0^1\sqrt{x^2+y^2}dxdy\approx0.765196$$
A: One surprisingly fruitful resource for questions of this type

pick [some number of points] in [some geometric figure], uniformly at random; what is the [expectation/distribution/...] of the [distance / some
other quantity]

is Wolfram MathWorld, where such problems are named X Y Picking (picking Y from X). So let us see what they tell about Square Point Picking:

The expected distance to a fixed vertex is given by
$$\overline{d}_\text{vertex} = \int_0^1 \int_0^1 \sqrt{x^2+y^2} \, dx \, dy = \frac{1}{3}\left[\sqrt{2}+\sinh^{-1} 1\right] $$

which indeed has the double integral mentioned in the other answers, and a closed form expression (which numerically evaluates to about $0.7651957$).
Other similar resources there include "Square Line Picking", "Cube Point Picking", "Circle Line Picking", "Line Point Picking", "Triangle Triangle Picking" (I'm not kidding!) and many more. Quite useful at times, since the multiple integrals can be unwieldy.
