5. In rectangle $A B C D$, $A B=1, B C=2$, point $E$ is on side $B C$, and point $F$ is on side $C D$. If $|E F|=1$, then the minimum value of $A E \mathrm{~g} A F$ is $\qquad$

Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
5. $5-\sqrt{5}$.

Analysis: Taking $C$ as the origin, $C D, C B$ as the positive $x, y$ axes, then $C(0,0), A(1,2)$. Given $|E F|=1$, we can assume $E(0, \sin \theta), F(\cos \theta, 0)$, thus $\stackrel{\text { umu }}{A E}=(-1, \sin \theta-2), \stackrel{\text { um }}{A F}=(\cos \theta-1,-2)$, therefore $\stackrel{\text { uмu }}{A E} \cdot \stackrel{\text { unu }}{A F}=1-\cos \theta-2(\sin \theta-2)=5-(2 \sin \theta+\cos \theta) \geq 5-\sqrt{5}$

The equality holds when $\sin \theta=\frac{2}{\sqrt{5}}, \cos \theta=\frac{1}{\sqrt{5}}$. Hence the minimum value is $5-\sqrt{5}$.