One thing, I'm not a mathematician so please be patient. I am still in Algebra II Trig. Leading with that, why does

$$x_0 = \sin 1, \space x_1 = x_0 + \sin x_0, \space x_2 = x_1 + \sin x_1 ...$$ and after a while, $$x = \pi$$

I know this to be true because I have evaluated this on my TI-84 and more deeply evaluated it with this program I made: https://repl.it/@RobertoBean/Pi-Evaluator To $100000$ Iterations (which I believe is enough)

So what's the math behind it? Why does adding $\sin 1$ in this manner produce $\pi$? Why doesn't doing the same thing using $100$ produce $\pi$? For example, $$\sin(1) = 0.841470...,\space \sin(1) + \sin(0.8414...), \sin(1) + \sin(0.841470...) + \sin(1.587095126...),\space ...$$ $$= \pi$$

My question is different from the mentioned because my function is not taking the sin of a sin consecutively, but is this following function: $f(x) = x + \sin x$ and is not $f(x) = \sin x$ and therefore can exhibit different properties I need explained.

• Does it? Where did you find this? Mar 7 '18 at 23:38
• $\sin\left(1\right)+\sin\left(\sin1\right)+\sin\left(\sin\left(\sin1\right)\right)+\sin\left(\sin\left(\sin\left(\sin\left(1\right)\right)\right)\right)+\sin\left(\sin\left(\sin\left(\sin\left(\sin1\right)\right)\right)\right)>pi$ Mar 7 '18 at 23:39
• $x = x + \sin x \iff \sin x = 0$. Mar 7 '18 at 23:53
• You are iteratively evaluating the map $x \mapsto x + \sin(x)$, and discovering that this map has a fixed point (i.e. there is some value of $x$ such that $x = x + \sin(x)$). There are some thorny issues of convergence, but assuming that everything plays nice, you get $$x = x + \sin(x) \implies 0 = \sin(x) \implies x \in \{ \pi k : k\in\mathbb{Z} \}.$$ Mar 7 '18 at 23:54
• One drawback, @quasi, is that your edit masked the fact that the OP is unfamiliar with the notions of sequences and convergence (that would be an important information in answering this question IMO).
– user99914
Mar 8 '18 at 0:43

So the sequence is $$\begin{cases} x_{0} = c & \\ x_{n} = x_{n - 1} + \sin (x_{n - 1} ) & \end{cases}$$

and this is what is going to happen.

The sketch shows that for $0< x_0 < 2\pi$ the recurrence will lead to $\pi$,
for $2\pi< x_0 < 4\pi$ it will lead to $3\pi$, etc.

That means that, among all the solutions $x=n\pi$ to $x=x+\sin(x)$, the actual attractor points are those at $(2n+1)\pi$, while the $2n\pi$ points are unstable.

• Is this why when I run the function with 100 it returns $\approx 97.3893722612$? Mar 8 '18 at 0:57
• @Coderboy: yes \eqalign{ & x_{\,0} = 100\quad \Rightarrow \quad \left\lfloor {{{100} \over {2\pi }}} \right\rfloor = 15,\quad 100\bmod \left( {2\pi } \right) \approx 0.9\quad \Rightarrow \cr & \Rightarrow \quad x_{\,\infty } = 31\;\pi \approx 97.38 \cr} Mar 8 '18 at 1:08
• so that means 100 falls between $30\pi$ and $32\pi$? I'm very intrigued. Mar 8 '18 at 1:09
• exactly, but shall be strictly greater or lower: if you start with precisely $30\pi$ you will remain there (theoretically, numerically the computation error might you drift around or out). Mar 8 '18 at 1:14
• @Coderboy The reason for the fast convergence to $x_\infty=31\pi$ that you observed, is that, when $x\to x_\infty$, $f(x)-x_\infty\sim\frac16(x-x_\infty)^3$. Hence, after a while, the number of correct decimals is (roughly) multiplied by $3$ at each iteration.
– Did
Mar 8 '18 at 6:52

It seems the OP has a hard time understanding the answers referring to fixed point iterations - I do too. Here follows a more intuitive and practical way to visualise what OP's formula is doing is by using the arc length of the arcs on the unit circle.

Your angle measured in radians is equal to the arc length of a segment of that angle - let's call it $ø$.

$sin(ø)$ gives you the y-coordinate (distance from the x-axis) of the end of that arc with it's centre at the origin.

In your next step you are creating a new arc by lengthening your arc by $sin(ø)$ and then you measure the distance from the x-axis for the end of your new arc and you keep repeating this procedure.

The measured distance from the x-axis will always be smaller than the length needed to lengthen your arc to $π$ but it keeps getting closer.

The illustration below explains it graphically and it's also easy to see from this why it converges so quickly:

Edit:

The arc length of the remainder of the half circle not covered by your arc is $π-ø$. By inspection, you can prove that $sin(ø)$ will always be smaller than that arc length (except when $ø=π$), thus, continuously adding $sin(ø)$ and adjusting ø to this new value will never exceed $π$.

Similarly you can see that for any value less than $π$, the result will increase, until you reach pi (which will happen at infinity).

• Yes! We studied this in algebra, I understand this! Mar 8 '18 at 12:51
• So the closer I get to $180^{\circ}$ around a circle (I know that this is $\pi$ Radians), the smaller the value I am adding? This is why it converges on $\pi$? Mar 8 '18 at 12:54
• Yes. I'll amend my answer shortly to clarify
– ChP
Mar 8 '18 at 14:16

You are iterating the function $$f(x)= x+ \sin(x).$$

When you iterate a function and the function has a fixed point which happens to be an attractor, the sequence of iterates approaches that attractor.

In the case of $$f(x) = x+\sin(x)$$ the fixed point is found by $f(x)=x$ which is $$x+\sin(x)=x$$

Thus $\sin(x)=0$ which implies $x=\pi$ is the attractor.

• so because $\sin \pi = 0$, that means that x is $\pi$? Mar 8 '18 at 0:36
• This is not entirely correct. What do you mean by "happens to be an attractor"? How do you know that this map has an attractor? Is the attractor unique? And, most importantly to the original questioner (it seems), why does iterating with $x_0 = 1$ give you $\pi$, while $x_0 = 100$ gives something else? Mar 8 '18 at 0:36
• @Xander Oh yeah that's right. $f(x) = x + \sin x$ converges differently if $x_0 \ne 1$. I'm already learning :) Mar 8 '18 at 0:38
• The x_0=1 is in the basin of attraction of the fixed point $x=\pi$ $x_0=100$ is probably in the basin of attraction of another attractor. The attractors do not have to be unique. For example if you apply Newton's Method to f(x)= sin(x), depending on your initial condition you get different attractors. Mar 8 '18 at 0:41