# Newton-Rapshon, finding intersections between cos(x) and sin(x)

Question says to find both intersections between $f(x) = sin(x)$ and $h(x) = cos(x)$ using Newton-Raphson. The interval is [0,5]. To illustrate, here is a chart:

What I've done was:

$f(x) = sin(x) - cos(x)$

and

$f'(x) = cos(x) + sin(x)$

Taking $x_0 = 1$ I'm having the Newton-Raphson not converging, while I was expecting it going to 0.8, it's going way above 3.802915 with 2 iterations.

I'm assuming that my function is not right, but I can't see what I'm doing wrong.

Any tips?

Update:

Iteration table of my attempt:

| n   |  Xn           |  Xn+1      |
| 0   |  1            |  1.965689  |
| 1   |  1.965689     |  2.899324  |
| 2   |  2.899324     |  3.802915  |

• What did you get after one iteration? – André Nicolas Sep 5 '15 at 0:17
• @AndréNicolas First iteration already pointed to 1.965689. That would be n = 0. n = 1 pointed to 2.899324 and 3.802915 to n = 2. – Fabiano Araujo Sep 5 '15 at 0:23
• Do a number of iterations (at least 5) starting at 0 to 2 by ,1 and see what happens. – marty cohen Sep 5 '15 at 0:29
• Then there may be an error in the setup. The iteration is $x_{n+1}=x_n -\frac{f(x_n)}{f'(x_n)}$. We have that $f(1)$ is positive, so if $x_0=1$, $x_1$ will be less than $1$. Is your calculator set to radian mode? If you are in degree mode, of course there will be trouble! – André Nicolas Sep 5 '15 at 0:30
• You're right @AndréNicolas. Calculator was set to degree mode. Ops! – Fabiano Araujo Sep 5 '15 at 0:37