# Homework Help: Tan x = x

1. Nov 10, 2009

### quietrain

1. The problem statement, all variables and given/known data

tan x = x

2. Relevant equations

3. The attempt at a solution

how do i solve this equation without using graphs?

is there a numerical method ?

thanks a lot!

2. Nov 10, 2009

### lanedance

Last edited: Nov 10, 2009
3. Nov 10, 2009

### quietrain

er so how do i go about doing that?

how do i know what to guess?

4. Nov 10, 2009

### lanedance

try it and find out...
draw a graph of y=tanx & y=x and pick an x value close to where they intersect, preferably on the left side of the intersection. Also notice there will actually be infinite solutions... so the value you start with will determine where you end up

Last edited: Nov 10, 2009
5. Nov 10, 2009

### windwitch

You can also assume that the equations are y=tanx and y=x, because that is how you find the intersection of lines right? Then, you can solve the equation graphically. However, you will still require some extent of iteration, however, you will have a general estimation of where to start rather than starting from 1 and going all the way to wherever you need to go.

6. Nov 10, 2009

### quietrain

erm so is this something like newton-raphson method?

all these are approximation methods right?

so theres no one accurate way of solving it numerically?

just another quick question,

for taylor series expansion, what do we actually mean when we say like the taylor series of tanx -x AT 0 ?

what does the "at 0" actually mean ?

so what are we solving for ?

like i need to find out the solution to tanx = x

so if i taylor expand tanx -x =0 ,what will be my value of a(which is the "AT where" thing) ?

and does it then mean the whole value is 0 ?

Last edited: Nov 10, 2009
7. Nov 10, 2009

### quietrain

ok so i went to taylor expand the function tanx-x=0 till the power 2 (3rd polynomial ? )

and i got 2 roots 4.4934026 or 4.300538079.

so why is the 2nd root wrong?

so i assume that "a" is my guess value, the whole equation = 0, and x is my value i am finding.

i don't really understand why those assumptions are such though :(

8. Nov 10, 2009

### lanedance

sorry i think i gave you a very poor steer initially, newton raphson would be a good idea to find the zeroes of this function

the first zero is relatively easy to find at x=0, the others lie oustsdie the range (-3pi/2, 3/pi/2) as the tan function repeats and will require a numerical method

for the taylor series, "at a" means you evaluate all the derivatives at x = 0, and all the power terms will be (x-0)^n. Effectively you are expanding about this point & the error of the approximation will be smallest at that point.

That said Taylor series are rarely used to find the zeros of a function, so I'm not sure why you're using it unless its to show that tan(x) behaves like x close to zero.

if f(x) = tan(x) the taylor series of about x=0 will be
f(x) = tan(x) , f(0) = 0
f'(x) = 1/(cos(x)) ,f'(0) = 1

so the expansion about zero is
f(x) = 0+1.(x-0) + O((x-0)^2)
f(x) = x + O(x^2)
so tan(x) looks like x near zero

the O mean the order of the further terms are x^2 and greater, for x<<1 they will be very small

when you substitute this into your eqaution
tan(x) - x = ( x + O(x^2))-x ~ O(x^2)

beware due to the behaviour of tan, i think this expansion will only be useful in teh raneg (-pi/2,pi/2)

i'm not too sure what you're doing with the quadratic rooots, can you explain further?

9. Nov 11, 2009

### quietrain

i am not too sure too

i was following this website http://www.physics.utah.edu/~p373/docs/maple/maple_1/node2.html

it says that we can solve tanx = x through the newton-raphson method which involves the taylor series expansion.

so i followed their taylor series expansion and i got 2 roots. 1st root is the correct one 4.4934, the 2nd root 4.300 is wrong. but how do i show its wrong? by substituting into the equation tan x = x ?

with regards to what you said about "evaluating all the derivatives at x=0, that means i choose my a = 0 right? thats the maclaurin's series?

so what does it mean when i use the taylor expansion on tan x -x = 0. what is my "a" in here?

10. Nov 11, 2009

### lanedance

ok now i get it, first have a look at the following picture:

then i'll explain

Last edited by a moderator: May 4, 2017
11. Nov 11, 2009

### lanedance

The newton raphson method, works by first choosing a point x0, this will be your best guess close to the zero (probably 4.5 after reading the page), and if the function doesn't change gradient too drastically nearby, the newton raphson method should converge

Evaluate the function and its derivative at the given point, f(x0) and f'(x0)

then use these to fit a line of gradient f'(x0) through the point f(x0). This is essentially a first order taylor approximation, given by
f(x) ~ f(x0) + f'(x0)(x-x0)) + O(x^2),

it is easy to solve for the next point in our iteration x1, which is where the line crosses the x axis

then repeat the process, expanding about the new point x1
f(x) ~ f(x1) + f'(x1)(x-x1)) + O(x^2),

now find x2 and so on, effectively following the path shown in the previous picture

Unless asked there is no need to use a quadratic appoximation, as it complicates things. The 2 roots you got in this case will both be solutions to approximation, with one closer to the crossing you are trying to find...

Last edited: Nov 11, 2009
12. Nov 12, 2009

### quietrain

oh i see

so the gradient of the line in the form Y = MX + C ==> f(x0) - f(x1) = (x0 - x1) f '(x0)

so if i set f(x1) = 0, i will end up with the newton-raphsod equation, which is the 1st order taylor series polynomial.

so is the term f(x1) equals 0 because i define my function tanx -x = 0? which means i am looking at the roots where tan x = x ?

so does it mean if my equation is tanx - x = 5, i must set my f(x1) term as 5? which means i am looking at the roots where tan x = 5+x?

so what the taylor series expansion does is actually like the newton-raphsod method where you throw in your guess (x0) and it points you closer and closer to the actual value of f(x1)? from the equation f(x) ~ f(x0) + f'(x0)(x-x0)) + O(x^2)

13. Nov 14, 2009

### quietrain

anyone? is my last post correct?

14. Nov 14, 2009

### TheoMcCloskey

quietrain - don't confuse the Newton-Raphson (N-R) method and Taylor Series as methods for solving F(x)=0. The Newton-Raphson method IS an iterative method for solving F(x)=0. One can construct the N-R method by employing a linear Taylor Series approximation to F(x).

Having said that, the Newton-Raphson method is of the form:

$$x_{\nu+1} = x_{\nu} -\frac{F(x_{\nu})}{F'(x_{\nu})}$$

Here, F(x) is the expression you are trying to solve for zero. It's important to understand that the expression $F(x^*) = 0$ at the desired root $x = x^*$. Hence, for example, if your are trying to solve the following equation for x, you need to re-write the expression in terms of F(x) = 0.

Example: Solve for x in the following:

$$\tan(x) - x = A$$

Re-write that as: Solve for x such that F(x) = 0.

$$F(x) = \tan(x) - x - A = 0$$

Your iteration scheme would then be as follows:

$$x_{\nu+1} = x_{\nu} - \frac{(\tan(x_{\nu}) - x_{\nu} - A)}{\tan^2(x_{\nu})}$$

Close - more accuratly, we use a first order Taylor Series to construct the N-R method. For example, let the first order Taylor Series approximation for F(x), expanded about $x_0$, be

$$F(x) \approx F(x_0) + F'(x_0) \cdot (x - x_0)$$

Using this approximation, what would "x" be if we assumed F(x) = 0. Re-writting the above:

$$\frac{F(x) - F(x_0)}{F'(x_0)} = x - x_0$$

and since we assumed F(x) = 0, then

$$x = x_0 -\frac{F(x_0)}{F'(x_0)}$$

We use this value of "x" and repeat the process (iterate) until convergence.

Yes! You got it. And yes, your function is [tex]F(x) = tan(x) - x[/itex]

That's one way of looking at it, with F(x) = tan(x)-x. However, its better to consider the search for the zero of a function $F(x)$ so as not to "confuse the masses". See the example above $F(x) = tan(x) - x - A$. This does not necessarily mean that your initial quess to x, ie $x_0$ is equal to A. But you ARE looking for the x such that $\tan(x) = 5+x$. So you may want to graph those two curves ($f_1(x) = \tan(x)$ and $f_2(x) = 5+x$) and find their approximate point of intersection (there will be and infinite number, but maybe your just interested in the first one(?)). The value of "x" at this intersection can be used for an initial estimate (ie, $x_0$).

Again, N-R is the iteration method. The first order Taylor Series is the construction tool to the iteration method. Do not use the Taylor Series approximation to solve for the root - use the N-R method to iterate to the root.

Last edited: Nov 14, 2009
15. Nov 14, 2009

### D H

Staff Emeritus
If rather than until it converges. There is no guarantee that Newton-Raphson will converge. Consider the case g(x)=x1/3. Then g/g'=3x, making the Newton-Raphson iterator for finding a solution for g(x)=0 is xn+1=-2xb.

The function f(x)=tan(x)-x exemplifies the strengths and weaknesses of Newton-Raphson. Neither it nor its derivative well-behaved. Both have an infinite number of poles and zeros. The derivative is zero at the trivial solution, x=0. This makes the convergence of Newton-Raphson particularly bad for this particular zero. For sufficiently small $x_n, x_{n+1} = x_n - f(x_n)/f'(x_n) \approx 2/3\,x_n$. The convergence is linear rather than quadratic.

16. Nov 14, 2009

### quietrain

ah i see...

thank you everyone very much!

17. Sep 1, 2010

### sangita

Hi All,

Can anybody help me to know how can i find the smallest positive root of the equation tanx=x.

I tried by Newtons raphsons method and i got root between [4,4.5] but how to show that it is a least positive root?

18. Sep 1, 2010

### lanedance

you could show it has a root at zero, is increasing afterwards, and has only one stationary point (turning point) in between

19. Sep 1, 2010

### lanedance

that is if you consider
f(x) = x-tanx

oppposite but same method if you wanted to use -f(x)