Solve the following system of equations:

$$
\begin{aligned}
2 x_{1}-2 x_{2} & =A \\
-x_{1}+4 x_{2}-3 x_{3} & =0 \\
-2 x_{2}+6 x_{3}-4 x_{4} & =0 \\
-3 x_{3}+8 x_{4}-5 x_{5} & =0 \\
\vdots & \vdots \\
-(n-2) x_{n-2}+2(n-1) x_{n-1}-n x_{n} & =0 \\
-(n-1) x_{n-1}+2 n x_{n} & =B
\end{aligned}
$$
Let's introduce the variables $y_{1}=x_{1}, y_{2}=2 x_{2}, y_{3}=3 x_{3}, y_{4}=4 x_{4}, \ldots, y_{n-1}=(n-1) x_{n-1}, y_{n}=n x_{n}$, and rearrange the equations $(2),(3),(4), \ldots,(n-1)$:

$$
2 y_{2}=y_{1}+y_{3}, \quad 2 y_{3}=y_{2}+y_{4}, \quad 2 y_{4}=y_{3}+y_{5}, \ldots, 2 y_{n-1}=y_{n-2}+y_{n}
$$

These equations together imply that the unknowns

$$
y_{1}, y_{2}, y_{3}, y_{4}, \ldots, y_{n-1}, y_{n}
$$

are such that, except for the two extreme values, each number is the arithmetic mean of its neighbors. Geometrically, we can visualize this property by plotting the points $Q_{i}\left(i ; y_{i}\right)$ in the coordinate system, as this property precisely means that these points lie on a straight line. According to this, for any $1<i<n$, $Q_{i}$ divides the segment $Q_{1} Q_{n}$ in the ratio $(i-1):(n-i)$, i.e.,

$$
y_{i}=\frac{(i-1) y_{n}+(n-i) y_{1}}{n-1}
$$

Applying this for $i=2$ and $i=n-1$:

$$
y_{2}=\frac{y_{n}+(n-2) y_{1}}{n-1}, \quad y_{n-1}=\frac{(n-2) y_{n}+y_{1}}{n-1}
$$

Substituting these into (1) and $(n)$, we get the system of equations for the unknowns $y_{1}, y_{n}$:

$$
\begin{array}{r}
2 y_{1}-\frac{y_{n}+(n-2) y_{1}}{n-1}=A \\
-\frac{(n-2) y_{n}+y_{1}}{n-1}+2 y_{n}=B
\end{array}
$$

By summing the two equations, we have:

$$
2\left(y_{1}+y_{n}\right)-\left(y_{1}+y_{n}\right)=A+B
$$

Thus,

$$
y_{1}=\frac{n A+B}{n+1}, \quad y_{n}=\frac{A+n B}{n+1}
$$

Substituting these into the (*) equation, we get:

$$
y_{i}=\frac{(n+1-i) A+i B}{n+1}, \quad x_{i}=\frac{(n+1-i) A+i B}{i(n+1)}
$$

which is now valid for any $i$ between 1 and $n$.

Remark. Upon examining our result, we can arrive at a slightly shorter solution. Let's introduce the variables

$$
y_{0}=A, \quad y_{n+1}=B
$$

With these, (1) and ( $n$ ) also mean that

$$
2 y_{1}=y_{0}+y_{2}, \quad 2 y_{n}=y_{n-1}+y_{n+1}
$$

and the equation corresponding to (*)

$$
y_{i}=\frac{(n+1-i) y_{0}+i y_{n+1}}{n+1}
$$

directly gives the final result.