I need to find the solution of the following equation for any $n$:
$x_{n+1} = x_n^2-2x + 2$
I've done some iterations to try to see a pattern but I'm not sure how I can write this as a function that takes the form $x_n = f(n)$.
Is there a formula for this like there is for functions with the form $x_{n+1} = bx_n^a$? Or is there a way to make this function take look like $x_{n+1} = bx_n^a$?
Notice that $x_{n+1}=(x_n-1)^2+1$, so $x_{n+1}-1=(x_n-1)^2$. Thus, if you make the substitution $y_n=x_n-1$, you can rewrite the recurrence as $y_{n+1}=y_n^2$. Once you have $y_n=f(n)$ for some function $f$, you automatically have $x_n=f(n)+1$. (I’m assuming that your recurrence was intended to be $x_{n+1}=x_n^2-2x_{\color{red}n}+2$.)