Expected value with unit cubes and random lines

237 Views Asked by At

I am trying to solve this month's Jane Street puzzle in which there is a 3-space partitioned into unit cubes and a line of length D is randomly chosen uniformly in location and orientation. I want to find the expected number of faces crossed by this line in terms of its length D. An old puzzle dealt with the 2-dimensional case of this problem (see solution) and modeled the expected value of square edge crosses given $ \theta $ as $ D sin\theta + D cos\theta $ which makes some sense but I'm not entirely sure how to generalize this to my 3-dimensional problem. I thought I could just add another angle, $\phi$ which is similar to theta making $E[N | (\theta , \phi)]$ = $D^2((sin\theta + cos\theta)(sin\phi + cos\phi))$ but I'm not convinced this is accurate and I'm at a loss for how to come up with an accurate conditional expected value $E[N | (\theta , \phi)]$ (where $N$ represents the total planes(faces) of the cube crossed) like was done in the solution to the 2d case anyone have nay insight in to how this was derived for the 2d single-cross problem or how I can go about finding this property for the 3d case?

*Note: When trying out my approach that basically squares the conditional expected value, after integrating over $\theta , \phi$ the actual expected number of crosses came out to be the square of the expected value in the 2d case. Not sure if this is intuitively correct and helpful or not.