edit: i shouldn't have called it an analysis problem, since i am not even certain that that is the correct route to solving it. so think of it as a geometry problem with a probable calculus twist.

I saw this problem on another forum, and when I tried to solve it (with mysomewhatlimited math skills), I got almost nowhere.

Start with a unit square WXYZ.

For ALL AnBn with unit length, where Ai is on WX and Bi is on XY, construct the point Pi on AiBi such that ZPi is perpendicular to AiBi. Let theta=angle PiZY. Find the length of XP in terms of theta. The included picture gives an idea of the problem with 2 P values there. Not to scale obviously.

I tried all sorts of ways just to even find an algebraic formula for the curve created by all values of P. The algebra gets too messy and I am convinced there is a simple, elegant solution to this problem. It seems to be sort of an optimization problem similar to the "ladder around a corner", except with a few twists. A few nudges in the right direction would be nice (such as a good program to model the problem better, since I can't do it with MATLAB and AutoCAD), as I am pretty sure once I can nail down the function form of the curve I could do the rest of the problem. Thanks in advance.