How to solve this equation: $x+2 \tan(x)=\pi/2$

2k Views Asked by At

By drawing graph,or otherwise,find the number of roots of the equation $x+2 \tan(x)= \pi/2$
lying between $0$ and $2\pi$, and find the approximate value of the largest root.

I found 3 roots by drawing a rough graph ,but i am unable to find the value of any roots. I would be glad if anyone could tell me how to find the value of roots. Secondly is there any other way beside drawing a graph to know the number of roots.

2

There are 2 best solutions below

3
On BEST ANSWER

Drawing the graph, you identify that the three roots are located close to $x=0.5$, $x=2.5$ and $x=5.0$.

The solutions of equations such as the one you post do not have solutions which can be expressed using elemental functions (I do not thing that, even using complex functions, there is any analytical solutions). So, only numerical methods for root finding could be used. There are many methods for solving non linear equations provided that a resonable starting value if known.

Since I do not know what you already learnt in this area, I think that the simplest could be inspection. Suppose we note $$f(x)=x+2 \tan (x)-\frac{\pi }{2}$$ $f(5)=-3.33183$ but $f(5.5)=1.93804$ so the root is between $5$ and $5.5$. Let us try at the middle of the range and find that $f(5.25)=0.324551$; so the solution is between $5.00$ and $5.25$. Let us try again at the middle of the range and find that $f(5.125)=-1.01473$; so the solution is between $5.125$ and $5.250$. We already reduced the range significantly; so compute the equation of the line which goes through the two points $(5.125,-1.01473)$ and $(5.250,0.324551)$ and compute the $x$ intercept (I let you doing this part of the work); you will find an approximate solution at $x=5.212$ for which $f(5.212)=-0.0231588$ which is quite small.

The exact solution of the problem is $x=5.21439$.

For sure, there are much more sohisticated and much faster methods for computing the root. If you wish, I could elaborate.

Added later to my answer

One of the simplest and more popular methods for solving nonlinear equations is Newton. Starting from a guess, the iterative scheme for solving $f(x)=0$ is given by $$x_{n+1}=x_n-\frac {f(x_n)}{f'(x_n)}$$ Let us apply this to the function $$f(x)=x+2 \tan (x)-\frac{\pi }{2}$$ $$f'(x)= 2 \sec ^2(x)+1$$ Now, let us start with $x_0=5$ as before. The successive iterates will then be $5.12886$, $5.20172$, $5.21413$, $5.21439$ which is the solution for six significant figures.

There are methods which converge faster such as Halley. For this one, the iterative scheme is $$x_{n+1}=x_n-\frac {f(x_n)}{f'(x_n)} (1+\frac {f(x_n)f''(x_n)}{2f'(x_n)^2})$$ For your equation, we have $$f''(x)=4 \tan (x) \sec ^2(x)$$ Let us start again with $x_0=5$ as before. The successive iterates will then be $5.18283$, $5.21432$,$5.21439$.

1
On

Approximate value - meaning we can use numerical methods.

To my knowledge there is no analytic solution to this equation in the domain mentioned.

We will attempt to find a root of $f(x)=x+2tan(x)-\frac{\pi}{2}$

notice that $f(0) = -\pi$ and that $f(2\pi)=\pi$ and it is continouos and so there is a solution $x_o \in (0,2\pi)$ such that $f(x_0)=0$.

This follows from the intermediate value theorem "if a continuous function $f$ with an interval $[a, b]$ as its domain takes values $f(a)$ and $f(b)$ at each end of the interval, then it also takes any value between $f(a)$ and $f(b)$"

From here I would suggest using a binary search algorithm:

1) pick an initial value for $x \in (l,u)$, for example $x=\frac{l+u}{2}$. where $u=0$ and $l=2\pi$

2) if $f(x)$ is close enough to zero, we are done.

3) if $f(x)f(l) < 0$ then repeat step 1 with $u=x$

4) if $f(x)f(u) < 0$ then repeat step 1 with $l=x$

We are gauranteed convergence with this method, with enough iterations you will come very close to the result you are looking for.

The advantage to this method is that with enough iterations we will always converge to the root. the disadvantage is that it may take quite a few iterations. If you care about convergence speed (which you probably dont) then I would suggest using newton-raphson algorithm http://en.wikipedia.org/wiki/Newton's_method