The longest length through a rectangle is the diagonal.
We use the Pythagorean Theorem:
[tex]c^{2}=a^{2}+b^{2}[/tex]
⇒[tex]c^{2}=1^{2}+3^{2}[/tex]
⇒[tex]c^{2}=1+9[/tex]
⇒[tex]c^{2}=10[/tex]
⇒[tex]c=\sqrt{10}[/tex]
So the longest length that can be taken through the doorway is [tex]\sqrt{10}[/tex].