31.2. Inside the square $A B C D$, a point $M$ is taken such that $M A=1$, $M B=2$, $M C=3$. Find $M D$.

$$
\text { (8-9 grades) }
$$
31.2. Through point $M$ draw lines parallel to the sides of rectangle $A B C D$ (Fig. 16). Denote the points of intersection with sides $A B, \quad B C, C D, D A$ as $K, P, R, T$ respectively. Let:

$$
A K=R D=a, \quad K B=C R=b, \quad B P=A T=c, \quad P C=T D=d
$$

Then, by the Pythagorean theorem, we get:

$$
a^{2}+c^{2}=1, \quad b^{2}+c^{2}=4, \quad b^{2}+d^{2}=9
$$

Adding these equations, we have:

$$
a^{2}+d^{2}+2\left(b^{2}+c^{2}\right)=14
$$

![](https://cdn.mathpix.com/cropped/2024_05_21_f0d089db3d527e92a992g-31.jpg?height=454&width=623&top_left_y=244&top_left_x=725)

From this, taking into account that $b^{2}+c^{2}=4$, we get:

$$
a^{2}+d^{2}=6, \quad \text { i. } \quad \text { e. } \quad M D=\sqrt{a^{2}+d^{2}}=\sqrt{6}
$$