Prove that there exists a sequence $\{x_{n}\}$ such that for every $n\,\quad f_{n}$ has a global maximum 
For every positive integer $n$ consider function $f_{n}(x)=n^{\sin x}+n^{\cos x},\ x \in \mathbb{R}$.
Prove that there exists a sequence $\{x_{n}\}$ such that for every $n,\  f_{n}$ has a global maximum at $x_{n}$ and $x_{n}\to 0$ as $n \to\infty$.

$(f_n(x))'=n^{\sin(x)}\cos(x)\ln(n)-n^{\cos(x)}\sin(x)\ln(n)$ it doesn't seems very nice.
I am stuck (inexperience I think..).
Any hints would be very appreciated.
Thanks.
 A: First, write
$$f'_n(x)=\ln n\left(\cos xn^{\sin x}-\sin xn^{\cos x}\right)$$
I'll discard the case $n=1$, since $f_1$ is constant. So $f'_n$ vanishes only if
$$\tan x=n^{\sin x-\cos x}$$
or
$$g(x)=\frac{\ln\tan x}{\sin x-\cos x}=\ln n$$
It can be easily checked that
$$\lim_{x\to0^+} g(x)=\infty$$
and
$$\lim_{x\to{\pi/4}^-} g(x)=\sqrt2$$
So there exists a zero of $f'_n$ at least for $n>e^{\sqrt 2}$, that is, for $n\geq 5$.
We will prove that $g$ is decreasing in $(0,\pi/4)$. We differentiate the function $h(x)=\ln g(x)$ to get
$$h'(x)=\frac{\cos x+\sin x}{\cos x-\sin x}-\frac{2}{\sin 2x(\ln\cos x-\ln\sin x)}$$
Since $\cos x$ and $\sin x$ are in the interval $(0,1)$, and there the derivative of $\ln$ is greater than $1$, we have
$$\ln\cos x-\ln\sin x>\cos x-\sin x$$
Thus,
$$\frac{\cos x+\sin x}{\cos x-\sin x}<\frac2{\cos x-\sin x}<\frac{2}{\sin 2x(\ln\cos x-\ln\sin x)}$$
and $h'(x)<0$. So $h$ is decreasing. Hence, $g$ is decreasing. This means that we can consider the function $u=g^{-1}$, defined in $(\sqrt 2,\infty)$, and it is also decreasing.
The sequence $x_n$ that we are looking for is given by
$$x_n=u(\ln n)$$
and
$$\lim x_n=u(\lim\ln n)=0$$
Remark: I know that there are left things to prove. Mainly:


*

*The cases $n=2,3,4$.

*The zeroes of $f'_n$ are actually maxima of $f_n$. The monotony of $g$ (the hard part of the problem, I think) should help.

A: Let $g_n(x)=n^{\sin-\cos x}$. The extrema of $n^{\cos x}+n^{\sin x}$ are the solutions of $g_n(x)=\tan x$, $0\le x\le2\,\pi$. We have
\begin{align}
g_n(0)&=n^{-1}>\tan 0,\\g_n(\pi/4)&=1=\tan\pi/4,\\g_n(\pi/6)&=n^{(1-\sqrt3)/2}<3^{-1/2}=\tan\pi/6 \quad\text{if }n\ge5.
\end{align}
Moreover $g_n$ is convex. Then
$$
g_n(x)\le\frac1n+\frac\pi6(n^{(1-\sqrt3)/2}-n^{-1}).
$$
This implies that the graph of $g_n$ cuts the graph of $\tan x$ at some $x_n\in(0,\pi/6)$. Since $\tan x>x$ it follows that
$$
0<x_n\le\frac{1}{n+\dfrac6\pi\,n^{(3-\sqrt3)/2}}.
$$
Below is the graph of $g_8(x)$, $\tan x$ and $x$

All is left is to show that $x_n$ is in fact a maximum.
