5. $P, Q$ are points on the legs $AB, AC$ of Rt $\triangle ABC$, respectively. $M$ is the midpoint of the hypotenuse $BC$, and $PM \perp MQ$. If $PB=x, QC=y$, then $PM^2 + QM^2 =$ ( ).
(A) $2xy$
(B) $x^2 + y^2$
(C) $(x+y)^2$
(D) $x^2 + xy + y^2$
5. (B).

As shown, draw: $M D \perp A B$ at $F$. $M E \perp A C$ at $E$, then $D, E$ 
are the feet of the perpendiculars from $A B, A C$. Let $A B=$ 
$c, A C=b$. Then $M D=\frac{b}{2}$. 
$M E=\frac{c}{2}$. Thus,
$$
\begin{array}{l}
P M^{2}+Q M^{2}=M D^{2}+P D^{2}+M E^{2}+E Q^{2} \\
=\left(\frac{b}{2}\right)^{2}+\left(x-\frac{c}{2}\right)^{2}+\left(\frac{c}{2}\right)^{2}+\left(\frac{b}{2}-y\right)^{2} \\
=x^{2}+y^{2}+b\left(\frac{b}{2}-y\right)+c\left(x-\frac{c}{2}\right) \\
=x^{2}+y^{2}+b \cdot Q E-c \cdot P D .
\end{array}
$$

We know $\triangle M D P \backsim \triangle M E Q$,
so $\frac{M D}{P D}=\frac{M E}{E Q}$. Thus $\frac{b}{2} \cdot E Q=\frac{c}{2} \cdot P D$.
$$
\therefore b \cdot E Q-c \cdot P D=0 \text {. }
$$

Therefore, $M P^{2}+M Q^{2}=x^{2}+y^{2}$.