# Fixed-point iteration for $x=\tan(x)$

I've been trying to find an accurate $g(x)$ in order to find a solution for $x=\tan(x)$ in the interval $[4,5]$. However, no matter what, all of them end up converging to zero which is not the answer. So far, I've tried:

$$g(x)=\tan(x)$$ $$g(x)=\tan^{-1}(x)$$ $$g(x)=\sin^{-1}(x\cos(x))$$ $$g(x)=\sqrt{x\tan(x)}$$

I thought maybe I was having trouble with the interval since I was working with angles, but even if I just use $[\pi/45,\pi/36]$, the functions still converge to 0. Can anybody help me out? I need to solve this problem using fixed-point iteration.

• Maybe you should start with a point in $[4, 5]$, rather than in $[\pi/45, \pi/36]$? Sep 3 '14 at 5:49
• Let $f(x)=\arctan x+\pi$. Try $x=f(x)$ with starting point say in the middle. Sep 3 '14 at 5:58

The $\arctan$ function is more nicely behaved than $\tan$. Let $$g(x)=\arctan x+\pi.$$ Be sure your calculator is in radian mode, and start with $x_0$ not too far from $4.5$. Use the iteration $x_{n+1}=g(x_n)$. Convergence should be acceptably quick.

Added: The reason we get nice behaviour with our choice of $g(x)$ is that near the root, the derivative of $\arctan x$ has rather small absolute value. By way of contrast, the derivative of $\tan x$ near the root is much larger than $1$. That means that with the choice $g(x)=\tan x$, the root is a repelling fixed point.

• Could you share the motivation for $+ \pi$ part? Oct 22 '20 at 5:53
X=tan X
1/X = 1/tan X ⇒ (1/x)-(1/tan X) =0
F(X)= 1/x- 1/tan X =0
From fixed point iteration
X=g(X)=f(X)
g(X) = 1/X - (1/tan X) -x
By 10-4precision
p1= g(4)=4.61369
p2=g(4.61369)=4.495964
p3=g(4.495964)=4.49341
p4=g(4.49341)=4.49340