# Solution to $\frac{x}{\tan\left(\frac{\pi}{2}-\frac{\pi}{x}\right)}=\pi$

In the following equation, is it possible to solve for numerical value of $x$.

$$\frac{x}{\tan\left(\frac{\pi}{2}-\frac{\pi}{x}\right)}=\pi$$

• No problem, take your time. We just need to understand the question properly before trying to answer it. Commented Nov 10, 2016 at 20:49
• Now, what do you want? An analytical or a numerical solution? For the former, there is no closed form. However, if you want a numerical solution, you can try to solve it with Newton's method. Commented Nov 10, 2016 at 20:56
• I would like a numerical solution. Commented Nov 10, 2016 at 21:01

Because $\tan\left(\dfrac{\pi}{2}-\alpha\right)=\operatorname{cotan}(\alpha)=\dfrac{1}{\tan(\alpha)}$, the given equation is equivalent to:

$$\tan\left(\dfrac{\pi}{x}\right)=\dfrac{\pi}{x}$$

Setting $a=\dfrac{\pi}{x}$, we have to look for non-zero solutions $a_k \ (k \in \mathbb{Z^*})$ of equation $\tan(a)=a$. There are an infinity of them: see graphics below. As a consequence, the solutions of the initial problem are $x_k=\dfrac{\pi}{a_k}.$

Let us fix $k$; a very efficient way to obtain $a_k$ is to invert relationship

$$\tag{1}\tan(a)=a.$$

One might be tempted to invert (1) by writing plainly into $a=\tan^{-1}(a)$.

In fact, due to the periodicity of tangent function, inversion of (1) is

$$\tag{2}a=f_k(a) \ \ \ \text{where} \ \ \ f_k(a):=\tan^{-1}(a)+k \pi$$

(as can be understood by the graphical representation of $f_k$, which is the $k$th branch in blue on the graphics, resulting from a $k$ times "upper translation" from mother function $\tan^{-1}$).

Solving (2) is easy by using the classical "fixed point" sequence built in this way:

$$\alpha_{p+1}=f_k(\alpha_{p}) \ \ \ p=0,1,2...$$

(with any initial $\alpha_0$). It converges very rapidly to the solution $a=a_k$ of (2) due to a small value of the derivative of $f_k$ in the vicinity of this root $a_k$.

Remarks:

1) Two very interesting references : this (contains very interesting pointers) and this, the latter with a solution using Lagrange inversion formula.

2) I have used notation $\tan^{-1}$ because it is now very widespread (maybe due to hand calculators ?), although notation $\operatorname{atan}$ or $\operatorname{arctan}$ is less misleading . More precisely, $y=\tan(x)$ has $f_k(x)$ as its reciprocal function for its $k$th "branch". Sometimes one meets the concept of a unique multivalued inverse function ; the natural context in which this concept has its full meaning is complex function theory.

• very interesting ! Commented Nov 11, 2016 at 10:42
• Whoa, those are trippy graphs you got going. Good idea for whenever I need wavy looking stuff. Commented Nov 11, 2016 at 12:30
• @Simple Art With the risk of being seasick when glaring too much at them. Commented Nov 11, 2016 at 12:32
• MathJax hint: we have \operatorname{atan} to do not-so-common functions. Commented Nov 11, 2016 at 12:32
• @Simple Art You are right. I modify it my text. Commented Nov 11, 2016 at 12:34

As JeanMarie wrote in his answer, we face the problem of solving of $a$ equation $$\tan(a)=a$$ As said, this kind of equation does not show analytical solutions and numerical methods are required. If you have to do it, to mkae life easier, I would suggest to look for the zero's of $$f(a)=\sin(a)-a\cos(a)$$ which is much better conditioned since the vertical asymptotes are removed. Using Newton for the $k^{th}$ root, starting from a guess $a_0=\frac{(2k+1)\pi }2$, the method will update it according to $$a_{n+1}=a_n-\frac{f(a_n)}{f'(a_n)}$$ In the present case, this would give $$a_{n+1}=a_n-\frac{1}{a_n}+\cot (a_n)$$

Let us see how this would work for $k=10$; the table below reproduces the iterates of Newton method $$\left( \begin{array}{cc} n & x_n \\ 0 & 32.986722862692829004 \\ 1 & 32.956407635437229892 \\ 2 & 32.956389039832967134 \\ 3 & 32.956389039822476725 \end{array} \right)$$ which is quite fast for a very high accuracy of the solution.

We can also approximate the solution using Padé approximants built around $a_0$; to avoid even quadratic equations, we could write $$f(a)=\sin(a)-a\cos(a)\approx \frac {P_1(a)} {Q_m(a)}$$ Where $P_1(a)$ is a first degree polynomial and $Q_m(a)$ is a polynomial of degree $m$. For sure, the solution will be the root of $P_1(a)=0$.

I give you below the result of the simplest approximations $(m=1,2)$ $$a_{(1)}=\frac{ 2 \alpha ^3-3\alpha}{2 \alpha ^2-1}$$ $$a_{(2)}=\frac{6 \alpha ^4-13 \alpha ^2+3}{6 \alpha ^3-7 \alpha }$$ $$a_{(3)}=\frac{24 \alpha ^5-68 \alpha ^3+37 \alpha }{24 \alpha ^4-44 \alpha ^2+9}$$ $$a_{(4)}=\frac{120 \alpha ^6-420 \alpha ^4+361 \alpha ^2-45}{120 \alpha ^5-300 \alpha ^3+141 \alpha }$$ $$a_{(5)}=\frac{720 \alpha ^7-3000 \alpha ^5+3542 \alpha ^3-1031 \alpha }{720 \alpha ^6-2280 \alpha ^4+1742 \alpha ^2-185}$$ using $\alpha=\frac{(2k+1)\pi }2$.

I give below a table of the results for the first twenty solutions.

$$\left( \begin{array}{ccc} k & \text{exact} & a_{(1)} & a_{(2)}\\ 1 & 4.49341 & 4.49529 & 4.49346 \\ 2 & 7.72525 & 7.72562 & 7.72526 \\ 3 & 10.9041 & 10.9043 & 10.9041 \\ 4 & 14.0662 & 14.0663 & 14.0662 \\ 5 & 17.2208 & 17.2208 & 17.2208 \\ 6 & 20.3713 & 20.3713 & 20.3713 \\ 7 & 23.5195 & 23.5195 & 23.5195 \\ 8 & 26.6661 & 26.6661 & 26.6661 \\ 9 & 29.8116 & 29.8116 & 29.8116 \\ 10 & 32.9564 & 32.9564 & 32.9564 \\ 11 & 36.1006 & 36.1006 & 36.1006 \\ 12 & 39.2444 & 39.2444 & 39.2444 \\ 13 & 42.3879 & 42.3879 & 42.3879 \\ 14 & 45.5311 & 45.5311 & 45.5311 \\ 15 & 48.6741 & 48.6741 & 48.6741 \\ 16 & 51.8170 & 51.8170 & 51.8170 \\ 17 & 54.9597 & 54.9597 & 54.9597 \\ 18 & 58.1023 & 58.1023 & 58.1023 \\ 19 & 61.2447 & 61.2447 & 61.2447 \\ 20 & 64.3871 & 64.3871 & 64.3871 \end{array} \right)$$ As you can see, without almost any calculations, we quickly have six exact significant figures.

Edit

Considering the case where $\alpha \to \infty$ and expanding the result obtained from Pade approximants, we have $$a_{(1)}=\alpha -\frac{1}{\alpha }-\frac{1}{2 \alpha ^3}+O\left(\frac{1}{\alpha^5 }\right)$$ $$a_{(2)}=\alpha -\frac{1}{\alpha }-\frac{2}{3 \alpha ^3}-\frac{7}{9 \alpha ^5}+O\left(\frac{1}{\alpha^7 }\right)$$ $$a_{(3)}=\alpha -\frac{1}{\alpha }-\frac{2}{3 \alpha ^3}-\frac{61}{72 \alpha ^5}-\frac{563}{432 \alpha ^7}+O\left(\frac{1}{\alpha^9 }\right)$$ $$a_{(4)}=\alpha -\frac{1}{\alpha }-\frac{2}{3 \alpha ^3}-\frac{13}{15 \alpha ^5}-\frac{83}{60 \alpha ^7}-\frac{61}{25 \alpha ^9}+O\left(\frac{1}{\alpha^{11} }\right)$$ $$a_{(5)}=\alpha -\frac{1}{\alpha }-\frac{2}{3 \alpha ^3}-\frac{13}{15 \alpha ^5}-\frac{2999}{2160 \alpha ^7}-\frac{160129}{64800 \alpha ^9}-\frac{1215311}{259200 \alpha ^{11}}+O\left(\frac{1}{\alpha^{13} }\right)$$So, thinking about the asymptotics, I tried $$a=\alpha+\sum_{i=0}^\infty \frac {A_i}{\alpha^{2i+1}}$$ and a (tedious) expansion work leads to $$a=\alpha -\frac{1}{\alpha }-\frac{2}{3 \alpha ^3}-\frac{13}{15 \alpha ^5}-\frac{146}{105 \alpha ^7}+O\left(\frac{1}{\alpha^9 }\right)$$ Applied to $k=10$, this leads to $a=32.956389039822530434$ to be compared to the result of Newton method. Applied to $k=1$, six significant figures are already obtained.

• Very interesting ! Thank you Claude ! Commented Nov 11, 2016 at 9:24
• @JeanMarie. Thanks ! Among my passions : Taylor series, Pade approximants, high order Newton methods, asymptotes removal !! Commented Nov 11, 2016 at 9:40
• the passage to find the zeros of $f(a)$ is clever: thanks for showing it Commented Nov 11, 2016 at 10:52
• @GCab. I spent most of my (long) life removing vertical asymptotes in order to have a better conditioning of equations. Commented Nov 11, 2016 at 10:56
• @JeanMarie. I noticed this way and I found interesting for approaching this problem as you did. Your answer is much better now. Nice illustration. Commented Nov 11, 2016 at 11:13

One cannot solve this, but with some simple rewriting, we have

$$x=\pi\tan\left(90-\frac{180}x\right)$$

Since $\tan(\theta)$ for any $\theta\in\mathbb Q$, and where we use degrees, we have

$$\tan(\theta)\in\mathbb A$$

That is, it will be an algebraic number.

Now, that means that since $\pi$ is transcendental, $\pi\tan\left(90-\frac{180}x\right)$ must be transcendental.

Thus, $x$ cannot be any rational number. It is also not a multiple of $\pi$, since we are in radians. So the answer is not trivial.

It is also not possible to solve, due to the fact that if $\theta$ is not rational, $\tan(\theta)$ has no closed form, working in radians. For example, noone knows what $\tan(\sqrt2)$ is exactly, so if $x$ is not a rational number... then we cannot solve the equation in closed form.

Looking at a graph, we have an infinite amount of interception points:

Indeed, the behavior of the $\tan$ around $x=0$ is not very good for most numerical methods.

• Why $x$ should be a rational number? Commented Nov 10, 2016 at 21:01
• @AlexSilva I just proved it can't be rational. And since $\tan(\theta)$ has no closed form whenever $\theta\notin\mathbb Q$, when working in degrees, it is not possible to solve. Commented Nov 10, 2016 at 21:02
• This is not the good way to solve this equation. My answer shows that, by transforming in into equation $tan(a)=a$, there is no numerical problem. Commented Nov 10, 2016 at 21:13
• @JeanMarie :( But it is also not possible to solve $\tan(x)=x$ in closed form (not that I solved it either) Commented Nov 10, 2016 at 21:16
• yes, direct editing would be quicker, however I deem it is more "polite" to advise the author. Commented Nov 12, 2016 at 19:36

I started trying out different values for $x$ and seeing how much effect they have on the problem

So after fiddling with that for a wile I found that as the value of $x$ gets closer and closer to infinity. the equation actually gets closer and closer to being true (that is closer to equaling $\pi$). so if $x$ is equal to infinity then the equation must be true (or equal to $\pi$). So $x$ in this equation must be infinity. But that also explains why the equation is impossible to solve because you cant work out the tangent for. $$\left(\frac{\pi}{2}-\frac{\pi}{\infty}\right)$$