# 416 probability/particle.in.box.p

## Description

This article is from the Puzzles FAQ,
by Chris Cole chris@questrel.questrel.com and Matthew Daly
mwdaly@pobox.com with numerous contributions by others.

# 416 probability/particle.in.box.p

A particle is bouncing randomly in a two-dimensional box. How far does it

travel between bounces, on average?

Suppose the particle is initially at some random position in the box and is

traveling in a straight line in a random direction and rebounds normally

at the edges.

probability/particle.in.box.s

Let theta be the angle of the point's initial vector. After traveling a

distance r, the point has moved r*cos(theta) horizontally and r*sin(theta)

vertically, and thus has struck r*(sin(theta)+cos(theta))+O(1) walls. Hence

the average distance between walls will be 1/(sin(theta)+cos(theta)). We now

average this over all angles theta:

2/pi * intg from theta=0 to pi/2 (1/(sin(theta)+cos(theta))) dtheta

which (in a computation which is left as an exercise) reduces to

2*sqrt(2)*ln(1+sqrt(2))/pi = 0.793515.

Continue to: