Local maxima of $xf(x)$ Suppose $f: \mathbb{R} \to \mathbb{R}$ has a finite number $n$ of local maxima. Can we say anything about the number of local maxima of the function $xf(x)$? Is this number necessarily finite? Is it related to $n$? If the answer is negative, are there assumptions we can make on $f$ under which the answer is positive (e.g., $f$ is concave)?
 A: For $f$ continuos and differentiable the necessary condition for the existence of local maximum is
$$(xf(x))'=f(x)+xf'(x)=0\implies \begin{cases}x=0 \quad f(0)=0\\x\neq0 \quad f'(x)=-\frac{f(x)}{x}\end{cases}$$
It doesn't seem a very conclusive relation.
As simply examples with different behaviour we can consider


*

*$f(x)=-x^2$ one local max $\to xf(x)=-x^3$ no local max

*$f(x)=-x^3$ no local max $\to xf(x)=-x^4$ one local max

*$f(x)=x^3-2x^2-x+1$ one local max $\to xf(x)=x^4-2x^3-x^2+x$ one local max

*$f(x)=\sin x$ $\infty$ local max $\to xf(x)=x\sin x$ $\infty$ local max

A: It seems like you can't say anything without further assumptions on $f$. You can construct strictly decreasing functions $f : \mathbb{R} \to \mathbb{R}$ such that $xf(x)$ has as many local max as you want (even infinitely many maybe?). Note that by the second derivative test, when f is twice continuously differentiable it suffices to have
$$f'(x_0) = -\frac{f(x_0)}{x_0}$$
and
$$x_0f''(x_0) + 2f'(x_0) < 0$$
in order to have a local max of $xf(x)$ at $x=x_0$.
My idea is to start with some strictly decreasing continuous function, say $f_0(x) = 1000 - x$ then modify it by "twisting" its graph at some point $x_1$: that is modifying $f_0$ on an arbitrarily small interval around $x_1$ by making the slope $-f(x_1)/x_1$ while keeping the value at $x_1$ fixed. That way, you can create a local max of $xf_0$ while keeping $f_0$ strictly decreasing. To see this, first fix an interval size (we'll do $1/2$  here for the sake of clarity). We'll construct a new function $f_1$ by modifying $f_0$ on the interval of our fixed size $1/2$ around $x_1=1$, namely $[1-1/4, 1+1/4]$. It will suffice to modify $f_0$ piecewise linearly.
At $x_1=1$, we have $-f_0(1)/1 = -999$, so the slope of $f_1(x)$ at $x=1$ should be $-999$. So for some $\epsilon > 0$ to be determined, we'll let $f_1(x) = 1000-999x$ for $x \in [1-\epsilon,1+\epsilon]$. Now to keep $f_1$ strictly decreasing, we take $\epsilon$ small enough so that $f_0(1-1/4) > f_1(1-\epsilon)$ and $f_0(1+1/4) < f_1(1-\epsilon)$ and finally let
$$
f_1(x) = 
\begin{cases}
f_0(x), \quad \qquad &x \notin [1-1/4,1+1/4], \\
1000-999x &x \in [1-\epsilon,1+\epsilon],
\end{cases}
$$
and interpolate linearly on $[1-1/4,1-\epsilon]$ and $[1+\epsilon,1+1/4]$.
Now $f_1(x)$ still has no local max but clearly $xf_1(x)$ has a local max at $x_1=1$ (we have $(x_1f_1(x_1))' = 0$ and $(x_1f_1(x_1))'' = -1998$).
Since the size of the interval on which we modified $f_0$ could be made arbitrarily small, one can repeat this process as many times as one wants on disjoint intervals and get functions $f_n(x)$ with no local max such that $xf_n(x)$ has $n$ local max, at $x_1, x_2, \ldots, x_n$. To have smooth examples, just approximate $f_n(x)$ by smooth functions; if the approximation is good enough in $C^2$ norm, these smooth functions will also have the desired properties.
Caveat. For this construction to work, you want to do it where $f(x)$ and $x$ have the same sign, because you're trying to make $f' = -f/x$ and $f$ is decreasing (otherwise you'd create a new local max). But for a decreasing linear function, this gives you only a bounded region of $\mathbb{R}$ to work with and this creates difficulties if you want to repeat the process infinitely many times. You can probably make it work with $f_0(x) = e^{-x}$ though. That is, do this process starting with $e^{-x}$ and construct a sequence $f_n(x)$ such that $xf_n(x)$ has $n$ local max, then take a limit and argue that $f_{\infty}$ is strictly decreasing while $xf_{\infty}$ has infinitely many local max.
