[Math] Finding root of $\cos(x)$ by Newton-Raphson method

approximationcalculusderivativesnewton raphsonnumerical methods

The exercise asks me that if I want to find the root of $f(x) = \cos(x) = 0$ using Newton-Raphson method, does the initial value matters? I know that Newton-Raphson method is a special case of the fixed point iteration method, therefore, I can use that theorem that says that if the initial guess is inside an interval where $|f'(x)|<1$ then the iteration converges.So if I want the method to converge, I have to pick $x = \{x; x\in \mathbb R, x\ne k\pi, k\in\mathbb Z\}$. Because we must have $|-\sin(x)|<1$.

Am I right?

UPDATE: what's the functon I must use in order to apply the fixed point iteration theorem? Is it $f(x) = \cos(x)$ or $g(x) = x-\frac{\cos(x)}{-\sin(x)}$?

UPDATE 2: in this case, $g'(x) = -\cot²(x) \implies |g'(x)|<1$, so it should converge

Best Answer

Yes, the initial seed matters quite a lot. If you're "close" to one of the roots, you'll converge to that root. Exactly how close is required is complicated, though.

The image below shows the regions of attraction for the cosine function in a neighborhood of the origin in the complex plane. Initial seeds chosen from green region on the left converge to $-\pi/2$ while initial seeds chosen from yellow region on the right converge to $+\pi/2$. As you move closer to the origin, you can converge to points farther away.

enter image description here