TITLE: Tedious Inequality from Spanish Olympiad
QUESTION [5 upvotes]: Let $n\geq 2$ an integer. Find the least value of $\gamma$ such that for any positive real numbers $x_1,x_2,...,x_n$ with $x_1+x_2+...+x_n=1$ and any real $y_1+y_2+...+y_n=1$ and $0\leq y_1,y_2,...,y_n\leq \frac{1}{2}$ the following inequality holds:
$$x_1x_2...x_n\leq \gamma \left(x_1y_1+x_2y_2+...+x_ny_n\right)$$
The official solution is near to inconprehensible, however one student got a relatively easy solution which is not shown. 
I tried many things but I couldn't get any further. Any help is preciated.
Edit: Since there is some confusion $\gamma$ depens on $n$. So that for every $n$ $\gamma$ is diferent.

REPLY [3 votes]: Fix $n$. Let's call $\gamma$ good if it satisfies the desired inequalities, i.e., if for all $x_1,\ldots,x_n\geq 0$ with $\sum x_i=1$ and for all $0\leq y_1,\ldots,y_n\leq 1/2$ with $\sum y_i=1$, we have
$$x_1\cdots x_n\leq\gamma(x_1y_1+\cdots+x_ny_n)$$
Suppose $x_1\leq x_2\leq\cdots\leq x_n$, and that $0\leq y_1,\ldots,y_n\leq 1/2$ satisfy $\sum y_i=1$.
We can think of the sum $\sum x_iy_i$ as a "weighted average" of the $x_i$. Since $x_i\leq x_j$ for $i\leq j$, if we pass some of the weight of $x_j$ to $x_i$ this "weighted average" will decrease.
More precisely, let $p=1/2-y_1$. Then
\begin{align*}
x_1\frac{1}{2}+x_2\frac{1}{2}&=x_1(y_1+p)+x_2(\sum_{i=2}^ny_i-p)\\
&=\sum_{i=1}^nx_iy_i+p(x_1-x_2)\leq\sum_{i=1}^n x_iy_i
\end{align*}
Therefore, $\gamma$ is good if and only if for all $0\leq x_1\leq x_2\leq\cdots\leq x_n$ with $\sum x_i=1$,
$$x_1\cdots x_n\leq\frac{\gamma}{2}(x_1+x_2)$$
Moreover, it is easy enough (by considering permutations of the $x_i$) to see that the condition $x_1\leq x_2\leq\cdots\leq x_n$ is not necessary.
We now need to simplify the product $x_1\cdots x_n$. We need the following lemma:

Lemma: Suppose $0\leq y<z\leq 1$, and $k\in\mathbb{N}$. Then there exists $w\in[y,z]$ with $y+kz=w^{k+1}$ and $yz^k\leq w^{k+1}$.
Proof: Consider the function:
  $$f(\epsilon)=(y+\epsilon)(z-\frac{\epsilon}{k})^k.$$
  Then
  $$f'(\epsilon)=-\left(z-\frac{\epsilon}{k}\right)^{k-1}(y+\epsilon)+\left(z-\frac{\epsilon}{k}\right)^k$$
  So $f'(\epsilon_0)=0$ if and only if $y+\epsilon_0=z-\frac{\epsilon_0}{k}$, or equivalently $\epsilon_0=\frac{k}{k+1}(z-y)$, which is positive. If $k=1$ then this is a (global) maximum for $f$, obviously. If $k\geq 2$,
  $$f''(\epsilon)=\frac{k-1}{k}\left(z-\frac{\epsilon}{k}\right)^{k-2}(y+\epsilon)-2\left(z-\frac{\epsilon}{k}\right)^{k-1}$$
  and so $f''(\frac{k}{k+1}(z-y))<0$. Again, this point is a (global) maximum for $f$. Therefore, $w=y+\epsilon_0$ has the desired properties.

Applying the lemma inductively on the product $x_3\cdots x_n$ (from right to left), we can find some $z\in[0,1]$ with $(n-2)z=x_3+\cdots+x_n$ and $x_3\cdots x_n\leq z^{n-2}$. Also, applying the lemma on the product $x_1x_2$ we find $y$ with $x_1+x_2=2y$ and $x_1x_2\leq y^2$.
Therefore, $\gamma$ is good if and only if for every $0\leq y,z\leq 1$ with $2y+(n-2)z=1$ (in particular, $0\leq y\leq 1/2$), we have
$$y^2z^{(n-2)}\leq\gamma y.$$
If $n=2$ then the minimum good $\gamma$ is $1/2$, so let's assume $n\geq 3$.
Since are considering $z=\frac{1-2y}{n-2}$, and , we simply have to maximize the function $g(y)=y\left(\frac{1-2y}{n-2}\right)^{n-2}$ in the interval $[0,1/2]$. 
Note that $g(0)=g(1/2)=0$ and that $g$ is positive on $[0,1/2]$. Thus if the equation $g'(y)=0$ has only one solution, this will necessarily be the maximum of $g$ on $[0,1/2]$
So let's calculate
$$g'(y)=\left(\frac{1-2y}{n-2}\right)^{n-2}-2y\left(\frac{1-2y}{n-2}\right)^{n-3}$$
The unique solution to $g'(y)=0$ is $y_0=\frac{1}{2(n-1)}$, which is in $[0,1/2]$ just as we wanted, on which we obtain
$$g(y_0)=\frac{1}{2(n-1)}\left(\frac{1-2\frac{1}{2(n-1)}}{n-2}\right)^{n-2}=\frac{1}{2}\left(\frac{1}{n-1}\right)^{n-1}$$
Therefore the minimum good $\gamma$ is $\frac{1}{2}\left(\frac{1}{n-1}\right)^{n-1}$.

EDIT: This was my first "solution" where I misinterpreted the problem and thought that $\gamma$ was supposed to work for all $n$, and not that $\gamma$ depended on $n$. Anyway the ideas are interesting and I thought it is good to leave it here:
First, note that it suffices to solve this for $n=2$.
Indeed, suppose $\gamma$ satisfies the inequality$\phantom{}^{(1)}$ for $n$, and take $n+1$ numbers $x_1,\ldots,x_n,x_{n+1}$ and $y_1,\ldots,y_n,y_{n+1}$ satisfying the hypotheses of the problem. We can assume all $x_i\neq 0$. Take $c=\frac{1}{x_1+\cdots+x_{n-1}+x_nx_{n+1}}$. Then
$$c^nx_1\cdots x_nx_{n+1}=(cx_1)\cdots (cx_{n-1})(cx_nx_{n+1})\leq\gamma(cx_1y_1+\cdots+cx_{n-1}y_{n-1}+cx_nx_{n+1}(y_n+y_{n+1})),$$
Divide this inequality by $c$, use the fact that $c^{n-1}\geq 1$ and that $$x_nx_{n+1}(y_n+y_{n+1})\leq x_ny_n+y_{n+1}x_{n+1}$$
and conclude that
$$x_1\cdots x_nx_{n+1}\leq\gamma(x_1y_1+\cdots+x_{n+1}y_{n+1}).$$
So by induction, any $\gamma$ which makes the desired kind of inequality valid for $n=2$ will also work for all $n\geq 2$.
Now, for $n=2$, the only numbers $0\leq y_1,y_2\leq 1/2$ satisfying $y_1+y_2=1$ are $y_1=y_2=1/2$, and if $x_1,x_2\geq 0$ and $x_1+x_2=1$ then $x_2=1-x_1$. Thus we simply have to maximize the function
$$f(x)=\frac{x(1-x)}{\frac{1}{2}x+\frac{1}{2}(1-x)}=2x(1-x)$$
The maximum is at $x=1/2$ (between the two roots $0$ and $1$), on which $f(1/2)=2\frac{1}{2}^2=\frac{1}{2}$, so $\gamma=\frac{1}{2}$ is the desired number.

(1) When I say that $\gamma$ "satisfies the inequality for $n$", I mean that $\gamma$ is a number such that for all $x_1,\ldots,x_n\geq 0$ with $\sum x_i=1$ and for all $0\leq y_1,\ldots,y_n\leq 1/2$ with $\sum y_1=$, we have $x_1\cdots x_n\leq\gamma(x_1y_1+\cdots+x_ny_n)$.