[ Triangle Inequality (other).]

At vertex $A$ of a unit square $A B C D$, there is an ant. It needs to reach point $C$, where the entrance to the ant hill is located. Points $A$ and $C$ are separated by a vertical wall, which has the shape of an isosceles right triangle with hypotenuse $B D$. Find the length of the shortest path the ant must travel to reach the ant hill.
Let $K$ be the vertex of the right angle of triangle $B K D$ (a vertical wall). The path of the ant consists of four segments: $A M, M P, P M$, and $M C$, where point $M$ lies on line $B D$, and point $P$ lies on segment $D K$ or $B K$. Clearly, $A M = M C$, so it is sufficient to specify points $M$ and $P$ such that the path $A M P$ is minimal.

Place the wall so that vertex $K$ coincides with $C$. Then point $P$ will coincide with some point $P_{1}$ on segment $C D$ (or $B C$), and

$$
A M + M P = A M + K P_{1} \geqslant A P_{1} \geqslant A D
$$

and this inequality becomes an equality only in the case where points $P_{1}$ and $D$ coincide. Therefore, the shortest path of the ant passes along sides $A D$ and $C D$ (or $A B$ and $B C$). The length of this path is 2.

## Second Method.

Let $K$ be the vertex of the right angle of triangle $B K D$ (a vertical wall). Suppose the ant's path intersects the leg $B K$. Consider the triangle $B A D$ as a paper fold: the fold lines are $B D$ (twice) and $B K$ (see figure). By unfolding this fold, we get that the ant's path will be a straight line segment. Thus, the length of the shortest path is 2, and the shortest path is along the sides of the square, bypassing the obstacle.

## Answer

2.