Solving this equation
$$x = 1-\cfrac{2}{1-\cfrac{2}{1-\cfrac{2}{\ddots}}}$$
Sub in $x$
$$x=1-\frac{2}{x}\implies x^2=x-2 \implies x^2-x=-2$$
Solve through completing the square \begin{align} x^2-x+\frac{1}{4}&=-2+\frac{1}{4}\\ \left(x-\frac{1}{2}\right)^2&=-\frac74\\ x-\frac{1}{2}&=\pm\sqrt{\frac{7}{4}}i\\ x&=\frac{1}{2}\pm\sqrt{\frac{7}{4}}i\\ \end{align} When you substitute this value back in for $x$ it works.
But i don't understand why a equation like this can equal a complex value
Maybe I am missing something important here?
EDIT: So this equation diverges right. Does that make my working invalid, or just explain the non-real part.
Can anything useful be done by defining this recursively
$$f(x)=1-\frac{2}{f(x)}$$
and then using a seed value
I also wonder whether we would end up dividing by zero at some point. Can you prove we do or don't?
The simple answer is that this repeated fraction isn't convergent for any initial value. Here's a plot of the first thousand iterations of $f_n(x) = 1 - \frac 2 {f_{n-1}(x)}$.
The animation shows how the plot changes for different values of $f_0$. As you can tell, it bounces around a lot. Here's what the first 200 values look like with a line drawn between them (using $f_0=0.001$):
The only stable values of the function are in the complex plane. And even in the complex plane, the function isn't exactly convergent (here the initial value is $f_0=1+i$:
Instead of converging to a single value, the output of the function "orbits" around one of the stable points.