5. As shown in Figure 3, on each side of the square $A B C D$ with side length 1, segments $A E=B F$ $=C G=D H=x$ are cut off, and lines $A F 、 B G 、 C H 、 D E$ are drawn to form quadrilateral $P Q R S$. Express the area $S$ of quadrilateral $P Q R S$ in terms of $x$, then $S=$
5. $\frac{(1-x)^{2}}{1+x^{2}}$.

Since $\angle B A F+\angle A E D=90^{\circ}$, therefore, $\angle A P E=90^{\circ}$. Hence $A F \perp D E$.
Similarly, $A F \perp B G, B G \perp C H, C H \perp D E$.
Since Rt $\triangle A P E \cong$ Rt $\triangle B Q F \cong \mathrm{Rt} \triangle C R G \cong$ Rt $\triangle D S H$, then $P Q=Q R=R S=S P$. Therefore, quadrilateral $P Q R S$ is a square.
Since $S_{\triangle W E}=\frac{x}{2}$, therefore, $S_{\triangle B C D E}=1-x$, which means $D E \cdot P Q=1-x$.
And $D E=\sqrt{1+x^{2}}$, then $P Q=\frac{1-x}{\sqrt{1+x^{2}}}$. Hence $S=P Q^{2}=\frac{(1-x)^{2}}{1+x^{2}}$.