4. On the hypotenuse $AB$ of the isosceles right triangle $ABC$, take two points $M$ and $N$ such that $\angle MCN = 45^{\circ}$. Let $AM = m$, $MN = x$, and $BN = n$. The shape of the triangle with side lengths $x$, $m$, and $n$ is ( ).
(A) Acute triangle
(B) Right triangle
(C) Obtuse triangle
(D) Varies with the changes in $x$, $m$, and $n$
4. B.
$$
\begin{array}{l}
\because \angle M C N=\angle A=\angle B=45^{\circ}, \\
\therefore \triangle C M N \backsim \triangle A C N \backsim \triangle B M C \\
\therefore \frac{B C}{x+n}=\frac{m+x}{A C} . \\
\because B C=A C, \\
\therefore B C^{2}=(x+n)(x+m) . \\
\text { Also } 2 B C^{2}=A B^{2}, \\
\therefore 2(x+m)(x+n)=(m+x+n)^{2} .
\end{array}
$$

Simplifying, we get $x^{2}=m^{2}+n^{2}$.