Why do I get a converging result when pressing cosine multiple times on a calculator? [duplicate]

Solution 1:

Let $\cos^n$ denote the $n$-fold composition of the cosine function with itself, e.g. $$ \cos^3(\theta) = \cos(\cos(\cos(\theta))). $$ Note that this is not usually what this notation means in, for example, introductory calculus texts. However, it is convenient in the current context.

What you are computing (assuming that it exists) is $$ \lim_{n\to\infty} \cos^n(\theta). $$ Again, suppose that this limit exists and is equal to $L$. That is, suppose that there is some $L\in\mathbb{R}$ such that $$ \lim_{n\to\infty} \cos^n(\theta) = L. $$ Taking the cosine of each side of this, and using the continuity of the cosine, we get $$ \cos(L) = \cos( \lim_{n\to\infty} \cos^{n}(\theta) ) = \lim_{n\to\infty} \cos^{n+1}(\theta) = L. $$ Thus $L$, assuming that it exists, is a solution the equation $$ \cos(x) - x = 0. $$ This confirms your suspicion that the number you are getting is a solution to this equation (presuming that such a number exists at all).

At this point, numerical methods are needed to get anything nicer out of this equation (hitting a button on the calculator repeatedly is such a numerical method), but you can prove that there is a solution via the intermediate value theorem: $\cos(0) - 0 = 1 \ge 0$ and $\cos(\pi) - \pi = -\pi < 0$, so there is a solution between $0$ and $\pi$.

What remains is to show that this limit actually exists. Note that the cosine function is a contraction on the interval $[-1,1]$. That is, if $x,y\in [-1,1]$, then there is a constant $|C| < 1$ such that $|\cos(x)-\cos(y)| < C|x-y|$. There are nice theorems that tell us that there must be a unique fixed point (specifically, theory that eventually leads to a theorem alternatively known as the "Contraction Mapping Principle" or the "Banach Fixed Point Theorem").

Note that cosine is a contraction on $[-1,1]$, and that $\cos(\mathbb{R})$ (i.e. the image of $\mathbb{R}$ under the cosine function, i.e. the range of the cosine function) is that interval. Thus, from any starting point, after the first iteration we are in the regime where $\cos$ is contractive, and so we will eventually converge to our fixed point, which was "determined" above (in so much as we can describe it). This pretty much says everything there is to know about the cosine function in this context.


The sine function is similar---it is contractive on the same interval, but it is much easier to find the fixed point: $$ \sin(x) - x = 0 \implies x = 0. $$

The tangent function is not so nice. It is actually a dilation on the symmetric unit interval, hence we can't apply the Banach Fixed Point Theorem as above. There may be a fixed point, but to get at it, we'll have to work backwards, and consider iterative application of the $\arctan$ function.

These kinds of objects are studied as "dynamical systems." In the language of dynamical systems, the fixed points of cosine and sine functions are attractive, in that everything eventually "falls into" those points. The fixed point of the tangent function is repulsive (or repelent), in that things are pushed away from it.

Solution 2:

Here's a picture: enter image description here

The blue line is $y=\cos x$, the green line is $y=x$. The red dashed line shows what happens when you repeatedly apply the cosine on an initial starting value, in this case zero. You can see how it converges to the intersection of the two lines, i.e., the point where $x=\cos x$.

Generating the red dashed line

In the image, start from the point $(0,0)$ and follow the dashed line. Moving vertically from $(x,y)$ to $(x,y')$ corresponds to applying $y'\gets\cos x$. Moving horizontally from $(x,y)$ to $(x',y)$ corresponds to applying $x'\gets y$. Starting from $(x_0,y_0)$, the points then follow this sequence ($V$ and $H$ denote moving vertically and horizontally respectively): \begin{align} (x_0,y_0) &\overset{V}{\to} (x_0,\cos x_0)\\ &\overset{H}{\to} (\cos x_0,\cos x_0)\\ &\overset{V}{\to} (\cos x_0, \cos(\cos x_0))\\ &\overset{H}{\to} (\cos(\cos x_0),\cos(\cos x_0))\\ &\overset{V}{\to} (\cos(\cos x_0),\cos(\cos(\cos x_0)))\\ &\overset{H}{\to} \cdots \end{align}