I would like to find the maximum value of : $f(x) = x\cos(x)$ on $[0, \pi/2]$. The huge problem I have is that $x$ is increasing on this domain and $\cos(x)$ is decreasing.
I tried to find the derivative which is : $-\sin(x)x + \cos(x)$ yet finding its sign is as difficult as the original problem.
So is there a shortcut I am missing here ?
Thank you !
As you noted, you must solve
$$ f^\prime(x)=\cos(x)-x\sin(x)=0 $$
on the interval $[0,\pi/2]$.
I suggest expressing $\cos(x)-x\sin(x)=0$ as $1-x\tan(x)=0$ and solving
$$ g(x)=1-x\tan(x)=0 $$
by Newton's method. A sketch of the graph of $f(x) = x\cos(x)$ indicates a solution slightly larger than $\dfrac{\pi}{4}$ so a good choice for an initial guess for the solution would be $x_0=\dfrac{\pi}{4}$
Newton's method gives the recursion \begin{eqnarray} x_{n+1}&=&x_n-\frac{g(x_n)}{g^\prime(x_n)}\\ &=&x_n+\frac{1-x_n\tan(x_n)}{\tan(x_n)+x_n\sec^2(x_n)} \end{eqnarray}
This gives
$$ x_1=\frac{\pi}{4}+\frac{1-\pi/4}{1+\pi/2}\approx0.869 $$
which is already close the the solution which is closer to $0.86$.
One more iteration should give a reasonable approximation.