------\--------- B / \.......|..B/sin(theta)

theta\ |

---|-----X |\ | | \...|..A/cos(theta) | \ | | \ | | A \|

Theta is the angle off horizontal.

Minimize length = A/cos(theta) + B/sin(theta)

d(length)/d(theta)

= A*sin(theta)/cos(theta)^2 - B*cos(theta)/sin(theta)^2 (?) = 0

A*sin(theta)/cos(theta)^2 = B*cos(theta)/sin(theta)^2

B/A = sin(theta)^3/cos(theta()^3 = tan(theta)^3

theta = inverse_tan(cube_root(B/A))

If you use the trigonometric formulas cos^2 x = 1/(1 + tan^2 x) and sin x = tan x cos x, and plug through the algebra, I believe that the formula for the length reduces to

(A^(2/3) + B^(2/3))^(3/2)

At any rate this is symmetric in A and B as one would expect, and has the right values at A=B and as either A-->0 or B-->0.