26

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?

gen-ℤ ready to perish
  • 6,434
  • 3
  • 25
  • 41
Mitchell Browne
  • 405
  • 5
  • 12
  • Right hand side of original equation is purely real – jonsno May 22 '18 at 08:22
  • I have no proof of this, but in this case I would interpret that the continued fraction’s convergents do not converge to any real value. You may try computing the first few convergents. My interpretation could be wrong as well... – Szeto May 22 '18 at 08:28
  • You did *assume* that the fraction converge, also, how do you define continued fractions? – ℋolo May 22 '18 at 08:33
  • Just adding it as a thought, can we somehow use $f(x) = 1-\frac{2}{x}$ and study compositions of this function, then we need to find root of $\lim_{n\to \infty} f_n(x) = x$ where $f_n(x)$ is $n$ times composition of $f(x)$. Also we know from induction that $f_n(x)$ is always increasing and that it has always exactly one point of vertical asymptote.. – jonsno May 22 '18 at 10:18
  • 2
    Related: https://math.stackexchange.com/questions/1681993/why-is-1-frac11-frac11-ldots-not-real – ThePortakal May 22 '18 at 10:53
  • 1
    I suggest changing the title of this question as it's rather misleading. Should be something like "why is this a complex number" – Tal-Botvinnik May 22 '18 at 12:27
  • 3
    @Tal-Botvinnik Agreed. When I saw this in HNQ, my immediate thought was that $x^2+1=0$ contains only real numbers but has only imaginary solutions. Heck, $x+1=0$ contains only positive numbers but has only negative solutions. – David Richerby May 22 '18 at 15:29
  • This question nicely highlights the importance of being explicit about about function domains etc.. – leftaroundabout May 22 '18 at 15:47
  • How can an equation containing only integers have a rational answer? – Eric Lippert May 22 '18 at 19:42
  • 1
    @EricLippert: Heck, you might as well ask how an equation containing only integers (e.g., $x^2=2$) can have an ***irrational*** answer. – Scott May 22 '18 at 19:57
  • Heck, you might as well ask how an equation containing only integers can have *any type of object* as an answer: $x=x$. Have I gone too far? – Tal-Botvinnik May 24 '18 at 21:15

6 Answers6

32

I think none of the existing answers refer to the continued fraction, which looks real.

By simple calculations, the first few convergents of $\frac2{1-\frac2{1-\frac2\cdots}}$ are:

$$2, -2, \frac23,6,-\frac25,\frac{10}7,-\frac{14}3,\frac6{17},\frac{34}{11},-\frac{22}{23},\frac{46}{45},\mathbf{-90} ,\frac{2}{91},\frac{182}{89}$$

This suggests that the continued fraction diverges.

I am trying to come up with a rigorous proof.

EDIT:

Just to preserve @Quantaliinuxite valuable comment(which indeed can, alone, be a fabulous answer):

Actually the sheer fact that this sequence of real numbers should converge to complex number tell us that the sequence does not converge. It’s a basic result in real analysis that any sequence of real numbers which converges converges to a real number. This is true because the real line is closed. (Intuitively if it converges to some complex number which is not a real number (ie not zero) you could find a neighborhood of that complex number where all the points of your sequence belong for n big enough. But this can’t happen since all the points of our sequence are real.

Szeto
  • 10,703
  • 2
  • 14
  • 36
  • 16
    Actually the sheer fact that this sequence of real numbers should converge to a complex number tells us that the sequence does not converge. – Quantaliinuxite May 22 '18 at 10:06
  • @Quantaliinuxite Such conclusions are maybe intuitive, but can it be shown in some manner? – jonsno May 22 '18 at 10:09
  • @Quantaliinuxite Could we not just use your idea? Let $x=f(x)$ where $f(x)=1-2/f(x)$. Then $\Im(x)=0$ since there are no imaginary parts. But $$x\implies x^2-x+2=0\implies\Im(x)\neq 0.$$ Contradiction. Therefore $x$ does not exist. – gone May 22 '18 at 10:13
  • 20
    @samjoe it’s a basic result in real analysis that any sequence of real numbers which converges converges to a real number. This is true because the real line is closed. (Intuitively if it converges to some complex number which is not a real number (ie not zero) you could find a neighborhood of that complex number where all the points of your sequence belong for n big enough. But this can’t happen since all the points of our sequence are real. – Quantaliinuxite May 22 '18 at 10:18
  • 2
    @Quant Hmm I get it now, thanks. I think this comment better serves an answer than most of the present answers. – jonsno May 22 '18 at 10:24
  • 1
    According to the W.B. Jones' and W.J. Thron's book *Continued Fractions, Analytic Theory and Applications*, the continued fractions of the form $K_{n=1}^{\infty}\frac{a}{1}$ diverges for $a \in (-\infty, -1/4)$. In this case, $a = -2$, so ... – Alex Silva May 22 '18 at 11:56
  • 1
    @Quantaliinuxite Your argument is well-written and rigorous. {+1} – Szeto May 22 '18 at 12:25
  • @Szeto Thanks! And the name is just a combination of Quantum (physics) and Linux (and dynamite), which are two things I was very much into back when I chose this name :) – Quantaliinuxite May 22 '18 at 12:40
  • @Quantaliinuxite haha :) – Szeto May 22 '18 at 12:40
  • Reminds me of how [$1+1+1+1+...=-\frac12$](https://en.wikipedia.org/wiki/1_%2B_1_%2B_1_%2B_1_%2B_%E2%8B%AF). The "diverging" sum of positive ones can be regularized to obtain a value that is negative – Tobias Kienzler May 22 '18 at 17:28
11

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$):

enter image description here

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$:

enter image description here

Instead of converging to a single value, the output of the function "orbits" around one of the stable points.

Alecto Irene Perez
  • 1,216
  • 1
  • 7
  • 19
  • Wow. Beautiful pictures. What software did you use to create them? (+1) – stressed out Sep 09 '18 at 06:25
  • I made them in Mathematica! – Alecto Irene Perez Sep 09 '18 at 06:29
  • Thanks for your answer. Would you please elaborate on how one can create an animation in Mathematica? Or did you use another software to make it animate? – stressed out Sep 09 '18 at 06:30
  • 1
    Once you have a plot (or a graphics object), you can rasterize it to an image object. What I did was created a list of plots, one for each frame; I converted that list into a list of image objects, and then I exported the list of images as a GIF (all of that can be done using built-in functions) – Alecto Irene Perez Sep 09 '18 at 06:39
  • Have you used it before? – Alecto Irene Perez Sep 09 '18 at 06:43
  • No, I have used Mathematica to plot functions before, but I have never rasterized a plot to an image object. I think I more or less understood what you've done, but I don't have Mathematica at home to try it. Thanks for your answer. – stressed out Sep 09 '18 at 06:45
  • 1
    This answer here [link](https://mathematica.stackexchange.com/questions/52051/how-to-make-the-animation-rate-lower-in-an-exported-gif) gives an example, as well as how to set the frame rate ("DisplayDuratuons"->1.0/60 is what I used for mine for 60fps) – Alecto Irene Perez Sep 09 '18 at 06:50
  • 1
    The rasterization step isn't strictly necessary, but it's the easiest way to control the resolution / scale of the resulting GIF – Alecto Irene Perez Sep 09 '18 at 06:52
  • Thanks a lot for the useful information. – stressed out Sep 09 '18 at 06:53
9

It is not strange at all. Look at this: $$x^2+1=0$$ This equation consists only of real coefficients (even only of integers) but still solutions are $i$ and $-i$. $$5x=3$$ A the coefficients are natural numbers, but the solution isn't, the solution is rational $3/5$ There are even identities in maths, where you have real numbers on the one side and complex on the other.

For example Euler's identity:$$e^{πi}=-1$$ So it's completely ok to have equation with real coefficients and complex solutions. Also, remember that real numbers are also complex numbers.

EDIT: I misunderstood your question a bit. You meant that we have only $x$ on the LHS and real number on RHS. Can you prove that number on the RHS is real ? How can you be convinced that number on the RHS even exists?

EDIT: I was wrong about the fact that you need to prove that number on RHS is real, because, actually as all other commenters pointed out, you need to prove that number on the RHS converges. And to do so you need use definition of continued fraction.

Mutantoe
  • 708
  • 7
  • 15
Юрій Ярош
  • 1,965
  • 10
  • 19
  • I guess you are right about proving that only real numbers are on RHS. Im not sure if i can prove that. My thought was that because we only use division and subtraction, and those do not produce complex numbers from real numbers, that then the whole side would be real. – Mitchell Browne May 22 '18 at 08:38
  • @MitchellBrowne Even more than that, you can't be sure that this number even exists among complex numbers. For example: there are no numbers which are equal to some divergent series (for example to harmonic series). – Юрій Ярош May 22 '18 at 08:40
  • @MitchellBrowne The problem is mostly in the fact that you can't be sure that this infinte continued fraction converges to some number. I checked it in the calculator a bit, and it seems that it diverges, it jumps from negative numbers to positive. Continued fraction consisting of real numbers can't be complex, but it can be that this infinte continued fraction doesn't produce finite number. – Юрій Ярош May 22 '18 at 08:50
7

A standard complex number is $z=a+bi$

Its complex conjugate $\bar{z}=a-bi$

Note for these two; $$z+\bar{z}=2a\in\Bbb R$$ $$z\bar{z}=(a+bi)(a-bi)=a^2+b^2\in\Bbb R$$

Thus if we form an equation using: $$(x-z)(x-\bar{z})=0$$

Then we get: $$x^2-(z+\bar{z})x+z\bar{z}=0$$ For which we have already established the coefficients are real.

So it is entirely plausible for complex numbers to be the solution to equations seen only with real numbers.

As Szeto's answer suggests, the presence of complex numbers as the solution, with no known way of getting them in the infinite fraction, tells us it is extremely likely that this continued fraction is divergent.

Rhys Hughes
  • 12,582
  • 2
  • 11
  • 36
4

As Szeto and others remarked, you have a continued fraction. The most general form is $$a_0 + \frac{b_1}{a_1 + \frac{b_2}{a_2 + \frac{b_3}{a_3 + ...}}} .$$

where $a_i, b_i \in \mathbb{Z}$. Usually one only considers the case that all $b_i = 1$ ("regular continued fractions"). Here we have $a_i = 1$ and $b_i = -2$.

Consider the sequence $x_n = [a_0;(b_1,a_1), ..., (b_n,a_n)]$ obtained by stopping the iteration of quotients with $a_{n-1} + \frac{b_n}{a_n}$. This sequence may converge or not. If your example would converge, then your computation would produce the correct result which is absurd since all $x_n$ are real. This proves that the sequence diverges.

Paul Frost
  • 57,157
  • 11
  • 28
  • 97
  • A similar phenomenon occurs when you use Newton's method to find zeros of real-valued function. For example, the function $f(x) = 1 -a/x^2$ has $\pm \sqrt a$ as zeros. Define an iteration $x_{n+1} = (x_n/2)(3-x_n^2/a)$. If $a > 0$, then the sequence converges to a zero. If $a < 0$ then it must obviously diverge. – Paul Frost May 22 '18 at 10:19
0

Let $x=f(x)$ where $f(x)=1-2/f(x)$. Then $\Im(x)=0$ since there are no imaginary parts. But $$x=f(x)\implies x^2-x+2=0\implies\Im(x)\neq 0.$$ Contradiction. Therefore $x$ does not exist.

gone
  • 9,831
  • 5
  • 40
  • 73