Solving for $\cos(\frac{\pi}{x}) = \frac{x - 2}{x + 2}$

90 Views Asked by At

As the question says, I was wondering how you'd go about solving the equation

\begin{align*} \cos(\frac{\pi}{x}) = \frac{x - 2}{x + 2} \end{align*}

for $x$. I've tried various methods and I'm feeling kind of dumb, cause I'm not sure where I'm messing up and I'm sure it's something obvious!

For starters, I set up a triangle like this:

https://i.stack.imgur.com/sODTm.png

since $\cos(x) = \frac{adjacent}{hypotenuse}$. Then I solved for the missing angle and tried using Law of Sines, but that just resulted in me getting

\begin{align*} \frac{1}{x + 2} = \frac{1}{x + 2} \end{align*}

which was a major facepalm moment for me, because of course. Then I tried setting

\begin{align*} -1 \le \frac{n-2}{n+2} \le 1 \end{align*}

since $cos(x)$ is between -1 and 1. That resulted in me getting two answers,

\begin{align*} 0 \le x, 0 \le 4 \end{align*}

Then I tried to solve

\begin{align*} 0 \le \frac{\pi}{x} \le \pi \end{align*}

and

\begin{align*} \pi \le \frac{\pi}{x} \le 2\pi \end{align*}

using the same logic as the above. Then, I tried just using algebra:

\begin{align*} \cos(\frac{\pi}{x}) = \frac{x - 2}{x + 2} \\ (x + 2)\cos(\frac{\pi}{x}) = (x - 2) \\ x\cos(\frac{\pi}{x}) + 2\cos(\frac{\pi}{x}) = (x - 2) \\ x\cos(\frac{\pi}{x}) - x = -2 - 2\cos(\frac{\pi}{x}) \\ x ( \cos(\frac{\pi}{x}) - 1) = -2(1 - \cos(\frac{\pi}{x}))\\ -\frac{x}{2} = \frac {1 - \cos(\frac{\pi}{x}) }{ \cos(\frac{\pi}{x}) - 1 }\\ -\frac{x}{2} = \frac {-\cos(\frac{\pi}{x}) + 1 }{ \cos(\frac{\pi}{x}) - 1 }\\ -\frac{x}{2} = \frac {(-1)(\cos(\frac{\pi}{x}) - 1) }{ \cos(\frac{\pi}{x}) - 1 }\\ -\frac{x}{2} = -1\\ -x = -2\\ x = 2 \end{align*}

But that solution, I realized, was identifiable by inspection (I facepalmed again).

Looking at the graph on Desmos, I saw a bunch of solutions (including the inspection solution of $x = 2$).

https://i.stack.imgur.com/eAZUS.png

How would I find out those solutions? I can't think of any way to do it and I'm feeling a bit silly, haha. Any help would be appreciated! Apologies about the images, I don't have enough reputation to post them!

1

There are 1 best solutions below

0
On BEST ANSWER

If you let $x=\frac 1 y$, you need to approximate the zeros of function $$f(y)=\cos(\pi y)+\frac{2y- 1 }{2y+ 1 }$$ for which $$f'(y)=-\pi \sin (\pi y)+\frac{4}{(2 y+1)^2}$$ You see that $f'(y)$ will cancel closer and closer to integer values of $y$; then the roots will be between two consecutive integers.

Using one single iteration of Householder method with $y_0=\left(n+\frac{1}{2}\right)$, the approximation for the $n^{\text{th}}$ root is $$y_{(n)}=\left(n+\frac{1}{2}\right)+\Delta_n$$ $$\Delta_n=\frac{\Big[6 n \left(\pi ^2 (n+1)^3+1\right) \Big]-(-1)^n\Big[12 \pi n (n+1) \Big]} {-\Big[6 \left(3 \pi ^2 (n+1)^2+1\right) \Big]+(-1)^n\Big[\pi ^3 (5 n^2+12n+6) (n+1)^2+6 \pi (2 n+3) \Big] }$$ This does not count for the trivial $y=0$.

A few numbers

$$\left( \begin{array}{ccc} n & \text{approximation} & \text{solution} \\ 0 & 0.50000 & 0.50000 \\ 1 & 1.34846 & 1.34823 \\ 2 & 2.73907 & 2.74312 \\ 3 & 3.24360 & 3.23835 \\ 4 & 4.78986 & 4.80128 \\ 5 & 5.20381 & 5.19157 \\ 6 & 6.81370 & 6.83180 \\ 7 & 7.18308 & 7.16442 \\ 8 & 8.82768 & 8.85145 \\ 9 & 9.17039 & 9.14622 \\ 10 & 10.8369 & 10.8655 \\ 20 & 20.8575 & 20.9023 \\ 30 & 30.8652 & 30.9195 \\ 40 & 40.8692 & 40.9299 \\ 50 & 50.8717 & 50.9371 \\ 60 & 60.8733 & 60.9425 \\ 70 & 70.8745 & 70.9467 \\ 80 & 80.8754 & 80.9501 \\ 90 & 90.8762 & 90.9529 \\ 100 & 100.877 & 100.955 \end{array} \right)$$

This is not fantastic but it could be improved using a few more terms.

For sure, with these estimates, a few iterations of Newton method will polish the solution to the desired accuracy. For example, for $n=100$, they will be $$\left( \begin{array}{cc} k & y_k \\ 0 & 100.877 \\ 1 & 100.931 \\ 2 & 100.951 \\ 3 & 100.955 \end{array} \right)$$