Optimization Problem - a rod inside a hallway 
The question:
I'm given the figure shown above, and need to calculate the length of the longest rod that can fit inside this figure and rotate the corner.
My thoughts: 
I have tried doing the following : put $(0,0)$ at the bottom left corner. This way, the place where the rod touches the upper block is $(2,1) $ , and if we denote by $(2+t,0)$ the place where the rod touches the lower block, we get that the place where it touches the lower block is $y=t+2 $ , and then, the length is $d=\sqrt{2}(t+2)$ which doesn't have a maximum.
What am I doing wrong ? 
THe final answer should be $ \sqrt{(1+\sqrt[3]{4} ) ^2 + (2+\sqrt[3]{2})^2 } $ .
Thanks ! 

Your mistake is in the assertion that "the place where it touches the lower block is $y=t+2$."  If you draw a picture and label the lengths of the sides of the appropriate right triangles, you'll see that in fact it touches the lower block at $y=1+{2\over t}$.  This gives $(2+t)^2+(1+{2\over t})^2$ as the expression for the square of the length of the pipe.  Differentiated appropriately, it has a minimum at $t=\sqrt[3]2$, and the rest should follow.
