Find general term of recursive sequences $ x_{n+1}=\frac{1}{2-x_n}, x_1=1/2,$ Please help to solve:


*

*$ x_{n+1}=\frac{1}{2-x_n}, x_1=1/2,$ 

*$x_{n+1}= \frac{2}{3-x_n}, x_1=1/2$
I know answers, but can't figure out the solution.
The first one is obvious if you calculate first 3-5 terms by hand. But how can I get the result not by guessing, but mathematically?
Answers are:


*

*$x_n = \frac{n}{n+1}$

*$x_n = \frac{3\cdot2^{n-1}-2}{3\cdot2^{n-1}-1}$

If we recursively apply the recursive relation we get
$$x_{n+1} = \frac{1}{2-x_n} = \frac{2-x_{n-2}}{3-2x_{n-2}} = \frac{3-2x_{n-3}}{4-3x_{n-3}}$$
and in general
$$x_{n+1} = \frac{k-(k-1)x_{n-k}}{k+1-kx_{n-k}}$$
Setting $k=n-1$ we get
$$x_{n+1} = \frac{n-1-(n-2)\frac{1}{2}}{n-(n-1)\frac{1}{2}} = \frac{n}{n+1}$$
I haven't checked the second one but I believe the same method should produce the result.
