If we have a finite continued rational functions, it is easy to clear the demoninator and write as a rational function (quotient of polynomials). For example,$$ \frac{1}{x+\frac{1}{x+\frac{1}{x+1}}}=\frac{x^{2}+x+1}{x^{3}+x^{2}+2x+1}$$ My question is how to go from the right to the left? I know that division algorithm is one way, but somehow it does not give me the finite continued function that I want. Therefore, I am really appreciate it if someone can let me know whether there are other ways.
To be more specific, the rational function that I really care about is the following: $$ \frac{-x^{2}-x+1}{x^{3}-2x^{2}-x+1}. $$ Somehow I need to convert it as a two-layer finite continued function. Can anyone provide some suggestions?
Diving a polynomial by other you get $$a(x) = b(x) q(x)+r(x)$$ so $$\frac{a(x)}{b(x)} = q(x)+\frac{r(x)}{b(x)}= q(x)+\frac{1}{b(x)/r(x)}$$
Now repeat the process with $b(x)$ and $r(x)$.