3
$\begingroup$

I've been studying trigonometric functions lately and there's one problem I didn't manage to solve. It states that f is a function defined as following: $$ f : \mathbb R_+\to \mathbb R $$ $$ x \mapsto x\cos x $$ I'm supposed to find the smallest extremum of that function, therefore I calculated the derivative which is: $$ f'(x) = \cos x - x\sin x $$ So, in order to find the extremum, we know that we should solve for x the equation f'(x)=0 the thing that I was unable to do.
In an attempt to simplify that equation, I obtained $ \cos x= \frac{x}{\sqrt{x^2+1}} $ which just got the things more complicated.
Using a graph calculator, I found out that the point I'm looking for had the coordinates (0.8603, 0.6522) but I still didn't know which path is to be taken in order to get to that result.

Can you please help me? And it would be awesome if you give me a general method of solving these kinds of equations.

$\endgroup$
  • $\begingroup$ What does it mean the smallest extremum? The stationary point closest to the origin, or the leftmost stationary point on the real line? $\endgroup$ – Jack D'Aurizio Jan 17 '17 at 22:40
  • $\begingroup$ Closest to the origin $\endgroup$ – Carw Lucas Jan 17 '17 at 22:43
  • $\begingroup$ I thought this might be helpful to take a look at: en.wikipedia.org/wiki/Root-finding_algorithm $\endgroup$ – Math-fun Jan 18 '17 at 9:39
2
$\begingroup$

As already mentioned, the problem is equivalent to finding the value of $\cos(x)$ when $x$ is the smallest positive solution of $x=\cot x$. Such critical abscissa belongs to the interval $\left(0,\frac{\pi}{2}\right)$ where $\cot(x)-x$ is a convex function. By approximating $\cot(x)$ with $\frac{1}{x}-\frac{x}{3}$ (the first two terms of the Laurent expansion at the origin), we have that such abscissa has to lie quite close to $\frac{1}{2}\sqrt{3}$, and we may refine such approximation through Newton's method:

$$ x_0 = \frac{\sqrt{3}}{2},\qquad x_{n+1} = x_n+\frac{\cot(x_n)-x_n}{1+\frac{1}{\sin^2(x_n)}}. $$ With very few iterations we get $x\approx 0.860333589$, then $$ x\cos(x)\approx \color{red}{0.561096338}.$$

$\endgroup$
  • 1
    $\begingroup$ Amazing is $x\approx \frac 67$. $\endgroup$ – Claude Leibovici Jan 18 '17 at 9:46
2
$\begingroup$

This equation does not have a closed form solution (as far as I know).

You need to solve it iteratively for example with fix point iteration or Newtons method.

Fix point iteration (you need to check the conditions for that, or just try it and see if the iteration gives a reasonable approximation to the root of the equation) can be performed by rewriting:

$$x=\cot(x).$$

The iteration works like this: $x^{[k+1]}=\cot(x^{[k]})$. So $x = \cot(\cot(\cot(\cot(\cot(...\cot(x_0))))))$, where $x_0$ is an initial starting value.

$\endgroup$
2
$\begingroup$

For such equations with the unknown appearing both inside and outside of a transcendental function, there is usually no closed-form expression of the solution and you must resort to numerical methods to get the values of the roots.

A first step is to discuss the number of solutions and to isolate them.

When the equation is written as $x=\cot x$, by graphing it is quite obvious that there is exactly one solution per interval $(k\pi,(k+1)\pi)$. This is easily confirmed by the fact that the derivative of $\cot x$ is everywhere negative, hence the function is strictly decreasing from $\infty$ to $-\infty$ between two vertical asymptotes.

enter image description here

The larger $x$, the closer the roots get to $k\pi$. If we write $x=k\pi+\delta$, we have $\cot x\approx1/\delta$ and

$$x_k\approx\frac{k\pi+\sqrt{k^2\pi^2+4}}2,$$ which is a good starting approximation.

Do not use the Newton method on the form $x=\cot(x)$, as it is not guaranteed at all that the iterates will remain in the starting interval (for instance, $x_0=1$ will converge to $6.28318530718$ !). Actually, it very rarely converges for this equation.

Regula falsi is more reliable in this respect.

$\endgroup$
  • $\begingroup$ @OscarLanzi: when applied blindly, Newton miserably fails. Answers that just say "use Newton" are insufficient. $\endgroup$ – Yves Daoust Jan 18 '17 at 11:50
  • $\begingroup$ You can guarantee that Newton's method will work with a positive initial value smaller than the solution. The concavity of the difference function guarantees convergence. For instance, $\cot(x)>(1/x)−(2/π)$ when 0<x<π/20<x<π/2, and an analytic solution for the positive root of $x=1/(x)−(2/π)$ works as an initial guess. $\endgroup$ – Oscar Lanzi Jan 19 '17 at 3:33
1
$\begingroup$

To solve $$\cos x - x \sin x = 0$$ note that you must have $\cos x = x \sin x$ and so $x = \cot x$ (provided $\sin x \ne 0$ which one can easily check does not give a solution). This is a transcendental equation and as such does not have an analytic solution that you can express as a function of arithmetic operations and roots/powers...

The best you can do is to plot the resulting function close to your root and check a couple of points around it (or apply Bisection Algorithm, e.g. to find the root more precisely).

Wolfram Alpha gives the numbers more precisely

$\endgroup$
1
$\begingroup$

This is too long for a comment.

As said in answers, numerical methods are required and Newton method is probably the simplest.

What is interesting is that, focusing on the first root, the function is extremely well approximated (for the range $0\leq x \leq 1$) using Pade approximants built around $x=0$. For example $$\cos(x)-x \sin(x)\approx \frac{1-\frac{49 }{36}x^2}{1+\frac{5 }{36}x^2}\tag 1$$ $$\cos(x)-x \sin(x)\approx\frac{1-\frac{10049 }{6972}x^2+\frac{7291 }{59760}x^4}{1+\frac{409 }{6972}x^2+\frac{697 }{418320}x^4}\tag 2$$

Using $(1)$, the solution is $x=\frac67 \approx 0.857143$ (leading to $x\cos(x)\approx 0.561086$) ; using $(2)$ (which is a quadratic in $x^2$) the solution is $x\approx 0.860334$ (leading to $x\cos(x)\approx 0.561096$) very close to Jack D'Aurizio's results.

On another hand, even simpler, using (see here) $$\cos(x) \simeq\frac{\pi ^2-4x^2}{\pi ^2+x^2}\qquad (-\frac \pi 2 \leq x\leq\frac \pi 2)$$ the problem becomes simple since $$\frac {d(x\cos(x)}{dx}\approx -\frac{4 x^4+13 \pi ^2 x^2-\pi ^4}{\left(x^2+\pi ^2\right)^2}$$ from which $x\approx 0.861414$ (leading to $x\cos(x)\approx 0.560236$).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.