2. The side $BC$ of triangle $ABC$ with points $M_{0}=B, M_{1}, M_{2}, \ldots, M_{n-1}$, $M_{n}=C$ is divided into $n$ segments, and from these points, segments parallel to sides $AC$ and $AB$ are constructed respectively.

a) In how many different ways can one reach point $M_{k}(k=0,1,2, \ldots, n)$ from point $A$ along the resulting grid, if movement is allowed in the direction of vector $\overrightarrow{A B}$ and in the direction of vector $\overrightarrow{A C}$.

b) Determine the number of the above described paths that lead from point $A$ to all points $M_{0}, M_{1}, \ldots, M_{n}$.

c) If the points $M_{0}, M_{1}, \ldots, M_{n}$ are equidistant, determine the sum of the lengths of all paths $A M_{k}$.
Solution. a) The path to point $M_{k}$ consists of $k$ segments parallel to line $A C$ and $n-k$ segments parallel to line $A B$ (see diagram).

From this, it follows that the desired number is equal to $\binom{n}{k}$.

b) From a) it follows that the desired number is:

$$
\binom{n}{0}+\binom{n}{1}+\ldots+\binom{n}{n}=2^{n}
$$

c) The length of all paths is equal to

![](https://cdn.mathpix.com/cropped/2024_06_05_faf575a75202fd173f3cg-07.jpg?height=380&width=526&top_left_y=192&top_left_x=958)

$$
\begin{aligned}
\sum_{k=0}^{n}\binom{n}{k}\left(k \frac{A B}{n}+(n-k) \frac{A C}{n}\right) & =A B \sum_{k=1}^{n} \frac{(n-1)!}{(k-1)!(n-k)!}+A C \sum_{k=0}^{n-1} \frac{(n-1)!}{k!(n-1-k)!} \\
& =2^{n-1}(A B+A C)
\end{aligned}
$$