# Problem 53 Solution

Here is my solution inspired by Presh Talwalker. Here is also a video solution: VERY HARD Puzzle: What Is The Distance Between Two Random Points In A Square?. To appreciate his solution, you'll need to know this integral:

Integral of sec^3(x) = (sec(s) + tan(x))/2 + ln(sec(x) + tan(x))/2

Here is another solution that doesn't rely on knowing that integral, submitted by Igor Volkov: First, let I(x,y) stand for "the integral from x to y of ...", and sqr stand for "the square root of...".

To find the answer we must solve I(0,1) I(0,1) I(0,1) I(0,1) sqr((x-a)2+(y-b)2) db da dy dx.

Even the first integration of this is very messy, requiring a big table of integrals, and I think at best a small book of integrals would only take you through the second one. So we need to be more creative to make the problem more managable. First we introduce a change of variables:

• u=x-a
• s=x
• v=y-b
• t=y

Or:

• x=s
• y=t
• a=s-u
• b=t-v

(1): Now we have I(0,1) I(t,t-1) I(0,1) I(s,s-1) sqr(u2 + v2) * |J| du ds dv dt

Where |J| = the Jacobian =

```| db/du db/ds db/dv du/dt |   |  0  0 -1  1 |
|                         |   |             |
| da/du da/ds da/dv da/dt |   | -1  1  0  0 |
|                         | = |             | = -1
| dy/du dy/ds dy/dv dy/dt |   |  0  0  0  1 |
|                         |   |             |
| dx/du dx/ds dx/dv dx/dt |   |  0  1  0  0 |
```

Now lets solve the following inner two integrals of equation (1):

(2): I(0,1) I(s,s-1) sqr(u2 + v2) du ds.

The area of integration is bounded by the quadrilateral with vertices (0,0), (1,1), (0,1), and (-1,0), with s being the horizontal axis and u being the vertical.

Changing the order of integral we get:

I(-1,0) I(0,u+1) sqr(u2 + v2) ds du + I(0,1) I(u,1) sqr(u2 + v2) ds du =

I(1,0) sqr(u2 + v2) * (1+u) du + I(0,1) sqr(u2 + v2) * (1-u) du =

-I(1,0) sqr(p2 + v2) * (1-p) dp + I(0,1) sqr(u2 + v2) * (1-u) du (letting p=-u in the first integral) =

I(0,1) sqr(p2 + v2) * (1-p) dp + I(0,1) sqr(u2 + v2) * (1-u) du (Notice the two terms are equal)=

2* I(0,1) sqr(u2 + v2) * (1-u) du.

Now put this into equation (1), and moving the constant terms to the left:

-2* I(0,1) I(t,t-1) I(0,1) sqr(u2 + v2) * (1-u) du dv dt =

-2* I(0,1) I(0,1) I(t,t-1) sqr(u2 + v2) * (1-u) dv dt du (changing the order of integration)=

-2* I(0,1) (1-u) I(0,1) I(t,t-1) sqr(u2 + v2) dv dt du =

Note that the inner two integral are of the same form as equation (2), thus:

4* I(0,1) I(0,1) sqr(u2 + v2) * (1-u) * (1-v) dv du =

4* I(0,1) I(0,1) sqr(u2 + v2) * (1-u) * (1-v) du dv (changing the order of integration)

Next we make another substitution:

• u=r*sin(w)
• v=r*cos(w)

This time the Jacobian shall equal:

```| du/dr du/dw |   | sin(w)  r*cos(w) |
|             | = |                  | = -r
| dv/dr dv/dw |   | cos(w) -r*sin(w) |
```

Thus the integral as a function of w and r is:

-8 * I(0,pi/4) I(0,1/cos(w)) -r * sqr(r*sin2(w) + r*cos2(w)) * (1-r*cos(w)) * (1-r*sin(w)) dr dw.

Note that we halved the area of integration, going from 0 to pi/4 as opposed to pi/2, and multiplying by 8 instead of the 4. This is permissible because of the symetry of the two regions.

= 8 * I(0,pi/4) I(0,1/cos(w)) r2 * (1-r*cos(w)) * (1-r*sin(w)) dr dw.

= 8 * I(0,pi/4) I(0,1/cos(w)) r2 - r3*(cos(w)+sin(w)) + r4*(cos(w)+sin(w)) dr dw.

= 8 * I(0,pi/4) r3/3 - r4*(cos(w)+sin(w))/4 + r5*(cos(w)+sin(w))/5 ( from 0 to 1/cos(w) ) dw.

= 8 * I(0,pi/4) (3*cos3(w))-1 - (cos(w)+sin(w))/(4*cos4) + (cos(w)+sin(w))/(5*cos5(w)) dw.

= 8 * I(0,pi/4) (3*cos3(w))-1 - (4*cos3(w))-1 - sin(w)*(4*cos4(w))-1 + sin(w)*(5*cos4(w))-1 dw.

= 8 * I(0,pi/4) (12*cos3(w))-1 - sin(w)*(20*cos4(w))-1 dw.

(3) = 2/15 * I(0,pi/4) 5/cos3(w) - 3*sin(w)/cos4(w) dw.

Next we must dust off our table of integrals to help us with the integral of cos-3(w).

I dx/cosn(x) = (1/(n-1)) * sin(x)/cosn-1(x) + ((n-2)/(n-1)) * I dx/cosn-2(x).

In our case n=3 so,

I dx/cos3(x) = (1/2) * sin(x)/cos2(x) + (1/2) * I sec(x) dx.

Now lets look up the integral of sec(x):

I sec(x) dx = (1/2) * ln((1+sin(x))/(1-sin(x))).

Now we are ready to integrate cos-3(w):

I(0,pi/4) cos-3(w) dw = sin(w)/(2*cos2(w)) (from 0 to pi/4) + (1/2)*I(0,pi/4) sec(x) dx.

= (1/2)*(2-1/2/2-1 - 0) + (1/4)*ln((2+sqr(2))/(2-sqr(2))).

= (1/2)*sqr(2) + (1/4)*ln(((2+sqr(2))/2+sqr(2))/((2-sqr(2))*(2+sqr(2))).

= 1/sqr(2) + (1/4)*ln((4+4*sqr(2)+2)/(4-2)).

= 1/sqr(2) + (1/4)*ln(3+2*sqr(2)).

= 1/sqr(2) + (1/2)*ln(3+2*sqr(2))1/2.

= 1/sqr(2) + (1/2)*ln(1+sqr(2)).

Now lets integrate sin(w)/cos4(w).

let m=cos(w), thus dm=-sin(w) dw.

I(0,pi/4) sin(w)/cos4(w).

= I(1,1/sqr(2)) -1*m-4 dm.

= 1/(3*m3) from 0 to 1/sqr(2).

= (1/3) * (2*sqr(2) - 1).

Not it is time to plus these integrals into equation (3):

(2/15) * [ 5*(1/sqr(2) + (1/2)*ln(1+sqr(2))) + 3*((1/3) * (2*sqr(2) - 1)) ]

= (2/15) * [ 5*sqr(2)/2 + (5/2)*ln(1+sqr(2)) - 4*sqr(2)/2 + 1 ]

= (2/15) * [ sqr(2)/2 + (5/2)*ln(1+sqr(2)) + 1 ]

= (sqr(2) + 2 + 5*ln(1+sqr(2))) / 15.

Congradulations and thanks to Igor Volkov for this solution.

Michael Shackleford, A.S.A.