TITLE: Solving $\frac{1}{\pi}(x \tan x) = \frac{1}{8}$ for $x \in [0,\pi]$
QUESTION [9 upvotes]: How do I solve:
$$ 
\frac{1}{\pi}(x \tan x) = \frac{1}{8}
$$
for $x$ where $x$ is in $[0,\pi]$?
The problem states: 

"Determine if the graph of the curve $y = (1/\pi)(x\tan x)$ crosses
  the line $y = (1/8)$ at some point $x$ in $[0, \pi]$. Justify answer."

I have already plotted this and see that there is 2 intersection points at around ±0.588, my problem is that I cannot solve the function numerically thus unable to prove how i got to the answer.
Any help is appreciated.
 (Large version)

REPLY [6 votes]: Considering the problem of finding the solution of $$\frac{x \tan (x)}{\pi }=\frac{1}{8}$$ you already know that equations which mix polynomial and trigonometric terms do not show analytical solutions (this is already the case for $x=\cos(x)$): then, only numerical methods will be able to find the root.
So, let us consider the function $$f(x)=\frac{x \tan (x)}{\pi }-\frac{1}{8}$$ As Dr. MV answered, the solution is clearly between $0$ and $\frac \pi 4$. So, let us use Newton method which, starting from a "reasonable" guess $x_0$, will update it according to $$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$ In this case $$f'(x)=\frac{\tan (x)}{\pi }+\frac{x \sec ^2(x)}{\pi }$$ Applied to the problem, this will give (after minor simplifications) $$x_{n+1}=\frac{8 x_n^2 \sec (x_n)+\pi  \cos (x_n)}{8 (\sin (x_n)+x_n \sec (x_n))}$$ So, just using what Dr. MV pointed out, let us start iterating using $x_0=\frac \pi 8$. Newton method will then generate the following iterates $$x_1=0.6558131726$$ $$x_2=0.5941110244$$ $$x_3=0.5885043829$$ $$x_4=0.5884623151$$ $$x_5=0.5884623128$$ which is the solution for ten significant figures. 
One thing you could find interesting is that, using the same method and starting point for solving instead $$g(x)=\frac{x \sin (x)}{\pi }-\frac{\cos (x)}{8}$$ would lead to the following iterates $$x_1=0.6299556633$$ $$x_2=0.5894960785$$ $$x_3=0.5884630152$$ $$x_4=0.5884623128$$
Edit
We could have worked the problem to obtain a better starting value $x_0$; this would reduce the number of iterations required by Newton method.
For example, knowing that the solution is quite small, using Taylor expansion around $x=0$ gives $\tan(x)=x+\frac{x^3}{3}+O\left(x^4\right)$. So, for the estimate, solving $$\frac{x(x+\frac{x^3}{3})} \pi=\frac 18$$ which is a quadratic equation is $x^2$; solving it would give as an estimate $$x_0=\frac{1}{2} \sqrt{\sqrt{6 (6+\pi )}-6}\approx 0.592885$$ Something similar would have been obtained approximating $\tan(x)\approx \frac{x}{1-\frac{x^2}{3}}$ (this simplest Padé approximant) which would give a similar extimate $$x_0=\sqrt{\frac{3 \pi }{24+\pi }} \approx 0.589275$$ Using these, Newton method would require just a couple of iterations for ten significant figures.