Given $x_2 \geq x_1 \geq 0$, solve the following optimization problem in $p_1$ and $p_2$.
$$\max p_1p_2$$
subject to:
$$p_1 x_1 + p_2 (x_2 – x_1) = 1 $$
$$0\leq p_2 \leq p_1$$
Maximize $p_1p_2$ subject to constraints
non-convex-optimizationoptimizationquadratic programming
Related Solutions
With the help of the slack variables $\epsilon_i$ and calling
$$ L(p,\mu,\epsilon,\lambda)= p_1 p_2 p_3 p_4 p_5+\mu _5 \left(p_1-p_2-\epsilon _5^2\right)+\mu _4 \left(p_2-p_3-\epsilon _4^2\right)+\mu _3 \left(p_3-p_4-\epsilon _3^2\right)+\mu _2 \left(p_4-p_5-\epsilon _2^2\right)+\mu _1 \left(p_5-\epsilon _1^2\right)+\lambda \left(p_1 x_1+p_2 \left(x_2-x_1\right)+p_3 \left(x_3-x_2\right)+p_4 \left(x_4-x_3\right)+p_5 \left(x_5-x_4\right)-1\right) $$
and solving the sationary conditions
$$ \nabla L = 0 $$
we obtain a set of solutions jointly with a set of conditions $\epsilon_i^2\ge 0$ to qualify those solutions. To be feasible the solution requires that $\epsilon_i^2\ge 0$ Also when $\epsilon_i^2 = 0$ it means that the corresponding restriction is active.
Due to the length of the symbolic response, we leave a script in MATHEMATICA that summarizes the results. There are sixteen non trivial solutions in res0 with structure $\{p_i,\epsilon_i^2,p_1p_2p_3p_4p_5\}$
n = 5;
X = Table[Subscript[x, k], {k, 1, n}];
P = Table[Subscript[p, k], {k, 1, n}];
EE = Table[Subscript[epsilon, k], {k, 1, n}];
M = Table[Subscript[mu, k], {k, 1, n}];
vars = Join[Join[Join[P, M], EE], {lambda}]
prod = Product[P[[k]], {k, 1, n}]
L = prod
L += lambda (Sum[P[[k]] (X[[k]] - X[[k - 1]]), {k, 2, n}] + P[[1]] X[[1]] - 1)
L += Sum[M[[k]] (P[[n - k + 1]] - P[[n - k + 2]] + EE[[k]]^2), {k, 2, n}] + M[[1]] (P[[n]] - EE[[1]]^2)
grad = Grad[L, vars]
equs = Thread[grad == 0];
E2 = EE^2;
results = Join[Join[P, E2], {prod}];
sols = Quiet[Solve[equs, vars]];
results0 = results /. sols // FullSimplify;
For[i = 1; res = {}, i <= Length[results0], i++,
If[NumberQ[results0[[i]][[2 n + 1]]] == False, AppendTo[res,results0[[i]]]]
]
res0 = Union[res];
res0 // MatrixForm
Results for $n = 3$
$$ \left[ \begin{array}{ccccccc} p_1&p_2&p_3&\epsilon_1^2&\epsilon_2^2&\epsilon_3^2&p_1p_2p_3\\ \frac{1}{3 x_1} & \frac{1}{3 \left(x_2-x_1\right)} & \frac{1}{3 \left(x_3-x_2\right)} & \frac{1}{3 \left(x_3-x_2\right)} & \frac{1}{3 x_2-3 x_3}+\frac{1}{3 \left(x_2-x_1\right)} & \frac{1}{3} \left(\frac{1}{x_1-x_2}+\frac{1}{x_1}\right) & \frac{1}{27 \left(x_1^2-x_1 x_2\right) \left(x_2-x_3\right)} \\ \frac{1}{3 x_1} & \frac{2}{3 \left(x_3-x_1\right)} & \frac{2}{3 \left(x_3-x_1\right)} & \frac{2}{3 \left(x_3-x_1\right)} & 0 & \frac{1}{3} \left(\frac{2}{x_1-x_3}+\frac{1}{x_1}\right) & \frac{4}{27 x_1 \left(x_1-x_3\right){}^2} \\ \frac{2}{3 x_2} & \frac{2}{3 x_2} & \frac{1}{3 \left(x_3-x_2\right)} & \frac{1}{3 \left(x_3-x_2\right)} & \frac{1}{3 x_2-3 x_3}+\frac{2}{3 x_2} & 0 & \frac{4}{27 x_2^2 \left(x_3-x_2\right)} \\ \frac{1}{x_3} & \frac{1}{x_3} & \frac{1}{x_3} & \frac{1}{x_3} & 0 & 0 & \frac{1}{x_3^3} \\ \end{array} \right] $$
Results for $n = 4$
$$ \left[ \begin{array}{ccccccccc} p_1 & p_2 & p_3 & p_4 & \epsilon_1^2&\epsilon_2^2&\epsilon_3^2&\epsilon_4^2&p_1p_2p_3p_4\\ \frac{1}{4 x_1} & \frac{1}{4 \left(x_2-x_1\right)} & \frac{1}{4 \left(x_3-x_2\right)} & \frac{1}{4 \left(x_4-x_3\right)} & \frac{1}{4 \left(x_4-x_3\right)} & \frac{1}{4 x_3-4 x_4}+\frac{1}{4 \left(x_3-x_2\right)} & \frac{1}{4 x_2-4 x_3}+\frac{1}{4 \left(x_2-x_1\right)} & \frac{1}{4} \left(\frac{1}{x_1-x_2}+\frac{1}{x_1}\right) & -\frac{1}{256 \left(x_1^2-x_1 x_2\right) \left(x_2-x_3\right) \left(x_3-x_4\right)} \\ \frac{1}{4 x_1} & \frac{1}{4 \left(x_2-x_1\right)} & \frac{1}{2 \left(x_4-x_2\right)} & \frac{1}{2 \left(x_4-x_2\right)} & \frac{1}{2 \left(x_4-x_2\right)} & 0 & \frac{1}{2 x_2-2 x_4}+\frac{1}{4 \left(x_2-x_1\right)} & \frac{1}{4} \left(\frac{1}{x_1-x_2}+\frac{1}{x_1}\right) & -\frac{1}{64 x_1 \left(x_1-x_2\right) \left(x_2-x_4\right){}^2} \\ \frac{1}{4 x_1} & \frac{1}{2 \left(x_3-x_1\right)} & \frac{1}{2 \left(x_3-x_1\right)} & \frac{1}{4 \left(x_4-x_3\right)} & \frac{1}{4 \left(x_4-x_3\right)} & \frac{1}{4 x_3-4 x_4}+\frac{1}{2 \left(x_3-x_1\right)} & 0 & \frac{1}{4} \left(\frac{2}{x_1-x_3}+\frac{1}{x_1}\right) & \frac{1}{64 x_1 \left(x_1-x_3\right){}^2 \left(x_4-x_3\right)} \\ \frac{1}{4 x_1} & \frac{3}{4 \left(x_4-x_1\right)} & \frac{3}{4 \left(x_4-x_1\right)} & \frac{3}{4 \left(x_4-x_1\right)} & \frac{3}{4 \left(x_4-x_1\right)} & 0 & 0 & \frac{1}{4} \left(\frac{3}{x_1-x_4}+\frac{1}{x_1}\right) & \frac{27}{256 x_1 \left(x_4-x_1\right){}^3} \\ \frac{1}{2 x_2} & \frac{1}{2 x_2} & \frac{1}{4 \left(x_3-x_2\right)} & \frac{1}{4 \left(x_4-x_3\right)} & \frac{1}{4 \left(x_4-x_3\right)} & \frac{1}{4 x_3-4 x_4}+\frac{1}{4 \left(x_3-x_2\right)} & \frac{1}{4 x_2-4 x_3}+\frac{1}{2 x_2} & 0 & \frac{1}{64 x_2^2 \left(x_2-x_3\right) \left(x_3-x_4\right)} \\ \frac{1}{2 x_2} & \frac{1}{2 x_2} & \frac{1}{2 \left(x_4-x_2\right)} & \frac{1}{2 \left(x_4-x_2\right)} & \frac{1}{2 \left(x_4-x_2\right)} & 0 & \frac{1}{2} \left(\frac{1}{x_2-x_4}+\frac{1}{x_2}\right) & 0 & \frac{1}{16 x_2^2 \left(x_2-x_4\right){}^2} \\ \frac{3}{4 x_3} & \frac{3}{4 x_3} & \frac{3}{4 x_3} & \frac{1}{4 \left(x_4-x_3\right)} & \frac{1}{4 \left(x_4-x_3\right)} & \frac{1}{4 x_3-4 x_4}+\frac{3}{4 x_3} & 0 & 0 & \frac{27}{256 x_3^3 \left(x_4-x_3\right)} \\ \frac{1}{x_4} & \frac{1}{x_4} & \frac{1}{x_4} & \frac{1}{x_4} & \frac{1}{x_4} & 0 & 0 & 0 & \frac{1}{x_4^4} \\\end{array} \right] $$
and for $n = 5$
$$ \left[ \begin{array}{ccccccccccc} p_1&p_2&p_3&p_4&p_5&\epsilon_1^2&\epsilon_2^2&\epsilon_3^2&\epsilon_4^2&\epsilon_5^2&p_1p_2p_3p_4p_5\\ \frac{1}{5 x_1} & -\frac{1}{5 \left(x_1-x_2\right)} & -\frac{1}{5 \left(x_2-x_3\right)} & -\frac{1}{5 \left(x_3-x_4\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & \frac{x_3-2 x_4+x_5}{5 \left(x_3-x_4\right) \left(x_4-x_5\right)} & \frac{x_2-2 x_3+x_4}{5 \left(x_2-x_3\right) \left(x_3-x_4\right)} & \frac{x_1-2 x_2+x_3}{5 \left(x_1-x_2\right) \left(x_2-x_3\right)} & \frac{2 x_1-x_2}{5 x_1 \left(x_1-x_2\right)} & \frac{1}{3125 x_1 \left(x_1-x_2\right) \left(x_2-x_3\right) \left(x_3-x_4\right) \left(x_4-x_5\right)} \\ \frac{1}{5 x_1} & -\frac{1}{5 \left(x_1-x_2\right)} & -\frac{1}{5 \left(x_2-x_3\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & 0 & \frac{2 x_2-3 x_3+x_5}{5 \left(x_2-x_3\right) \left(x_3-x_5\right)} & \frac{x_1-2 x_2+x_3}{5 \left(x_1-x_2\right) \left(x_2-x_3\right)} & \frac{2 x_1-x_2}{5 x_1 \left(x_1-x_2\right)} & \frac{4}{3125 x_1 \left(x_1-x_2\right) \left(x_2-x_3\right) \left(x_3-x_5\right){}^2} \\ \frac{1}{5 x_1} & -\frac{1}{5 \left(x_1-x_2\right)} & -\frac{2}{5 \left(x_2-x_4\right)} & -\frac{2}{5 \left(x_2-x_4\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & \frac{x_2-3 x_4+2 x_5}{5 \left(x_2-x_4\right) \left(x_4-x_5\right)} & 0 & \frac{2 x_1-3 x_2+x_4}{5 \left(x_1-x_2\right) \left(x_2-x_4\right)} & \frac{2 x_1-x_2}{5 x_1 \left(x_1-x_2\right)} & \frac{4}{3125 x_1 \left(x_1-x_2\right) \left(x_2-x_4\right){}^2 \left(x_4-x_5\right)} \\ \frac{1}{5 x_1} & -\frac{1}{5 \left(x_1-x_2\right)} & -\frac{3}{5 \left(x_2-x_5\right)} & -\frac{3}{5 \left(x_2-x_5\right)} & -\frac{3}{5 \left(x_2-x_5\right)} & -\frac{3}{5 \left(x_2-x_5\right)} & 0 & 0 & \frac{3 x_1-4 x_2+x_5}{5 \left(x_1-x_2\right) \left(x_2-x_5\right)} & \frac{2 x_1-x_2}{5 x_1 \left(x_1-x_2\right)} & \frac{27}{3125 x_1 \left(x_1-x_2\right) \left(x_2-x_5\right){}^3} \\ \frac{1}{5 x_1} & -\frac{2}{5 \left(x_1-x_3\right)} & -\frac{2}{5 \left(x_1-x_3\right)} & -\frac{1}{5 \left(x_3-x_4\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & \frac{x_3-2 x_4+x_5}{5 \left(x_3-x_4\right) \left(x_4-x_5\right)} & \frac{x_1-3 x_3+2 x_4}{5 \left(x_1-x_3\right) \left(x_3-x_4\right)} & 0 & \frac{3 x_1-x_3}{5 x_1 \left(x_1-x_3\right)} & \frac{4}{3125 x_1 \left(x_1-x_3\right){}^2 \left(x_3-x_4\right) \left(x_4-x_5\right)} \\ \frac{1}{5 x_1} & -\frac{2}{5 \left(x_1-x_3\right)} & -\frac{2}{5 \left(x_1-x_3\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & 0 & \frac{2 \left(x_1-2 x_3+x_5\right)}{5 \left(x_1-x_3\right) \left(x_3-x_5\right)} & 0 & \frac{3 x_1-x_3}{5 x_1 \left(x_1-x_3\right)} & \frac{16}{3125 x_1 \left(x_1-x_3\right){}^2 \left(x_3-x_5\right){}^2} \\ \frac{1}{5 x_1} & -\frac{3}{5 \left(x_1-x_4\right)} & -\frac{3}{5 \left(x_1-x_4\right)} & -\frac{3}{5 \left(x_1-x_4\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & \frac{x_1-4 x_4+3 x_5}{5 \left(x_1-x_4\right) \left(x_4-x_5\right)} & 0 & 0 & \frac{4 x_1-x_4}{5 x_1 \left(x_1-x_4\right)} & \frac{27}{3125 x_1 \left(x_1-x_4\right){}^3 \left(x_4-x_5\right)} \\ \frac{1}{5 x_1} & -\frac{4}{5 \left(x_1-x_5\right)} & -\frac{4}{5 \left(x_1-x_5\right)} & -\frac{4}{5 \left(x_1-x_5\right)} & -\frac{4}{5 \left(x_1-x_5\right)} & -\frac{4}{5 \left(x_1-x_5\right)} & 0 & 0 & 0 & \frac{5 x_1-x_5}{5 x_1 \left(x_1-x_5\right)} & \frac{256}{3125 x_1 \left(x_1-x_5\right){}^4} \\ \frac{2}{5 x_2} & \frac{2}{5 x_2} & -\frac{1}{5 \left(x_2-x_3\right)} & -\frac{1}{5 \left(x_3-x_4\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & \frac{x_3-2 x_4+x_5}{5 \left(x_3-x_4\right) \left(x_4-x_5\right)} & \frac{x_2-2 x_3+x_4}{5 \left(x_2-x_3\right) \left(x_3-x_4\right)} & \frac{3 x_2-2 x_3}{5 x_2 \left(x_2-x_3\right)} & 0 & -\frac{4}{3125 x_2^2 \left(x_2-x_3\right) \left(x_3-x_4\right) \left(x_4-x_5\right)} \\ \frac{2}{5 x_2} & \frac{2}{5 x_2} & -\frac{1}{5 \left(x_2-x_3\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & 0 & \frac{2 x_2-3 x_3+x_5}{5 \left(x_2-x_3\right) \left(x_3-x_5\right)} & \frac{3 x_2-2 x_3}{5 x_2 \left(x_2-x_3\right)} & 0 & -\frac{16}{3125 x_2^2 \left(x_2-x_3\right) \left(x_3-x_5\right){}^2} \\ \frac{2}{5 x_2} & \frac{2}{5 x_2} & -\frac{2}{5 \left(x_2-x_4\right)} & -\frac{2}{5 \left(x_2-x_4\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & \frac{x_2-3 x_4+2 x_5}{5 \left(x_2-x_4\right) \left(x_4-x_5\right)} & 0 & \frac{2 \left(2 x_2-x_4\right)}{5 x_2 \left(x_2-x_4\right)} & 0 & -\frac{16}{3125 x_2^2 \left(x_2-x_4\right){}^2 \left(x_4-x_5\right)} \\ \frac{2}{5 x_2} & \frac{2}{5 x_2} & -\frac{3}{5 \left(x_2-x_5\right)} & -\frac{3}{5 \left(x_2-x_5\right)} & -\frac{3}{5 \left(x_2-x_5\right)} & -\frac{3}{5 \left(x_2-x_5\right)} & 0 & 0 & \frac{5 x_2-2 x_5}{5 x_2 \left(x_2-x_5\right)} & 0 & -\frac{108}{3125 x_2^2 \left(x_2-x_5\right){}^3} \\ \frac{3}{5 x_3} & \frac{3}{5 x_3} & \frac{3}{5 x_3} & -\frac{1}{5 \left(x_3-x_4\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & \frac{x_3-2 x_4+x_5}{5 \left(x_3-x_4\right) \left(x_4-x_5\right)} & \frac{4 x_3-3 x_4}{5 x_3 \left(x_3-x_4\right)} & 0 & 0 & \frac{27}{3125 x_3^3 \left(x_3-x_4\right) \left(x_4-x_5\right)} \\ \frac{3}{5 x_3} & \frac{3}{5 x_3} & \frac{3}{5 x_3} & -\frac{2}{5 \left(x_3-x_5\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & -\frac{2}{5 \left(x_3-x_5\right)} & 0 & \frac{5 x_3-3 x_5}{5 x_3 \left(x_3-x_5\right)} & 0 & 0 & \frac{108}{3125 x_3^3 \left(x_3-x_5\right){}^2} \\ \frac{4}{5 x_4} & \frac{4}{5 x_4} & \frac{4}{5 x_4} & \frac{4}{5 x_4} & -\frac{1}{5 \left(x_4-x_5\right)} & -\frac{1}{5 \left(x_4-x_5\right)} & \frac{5 x_4-4 x_5}{5 x_4 \left(x_4-x_5\right)} & 0 & 0 & 0 & -\frac{256}{3125 x_4^4 \left(x_4-x_5\right)} \\ \frac{1}{x_5} & \frac{1}{x_5} & \frac{1}{x_5} & \frac{1}{x_5} & \frac{1}{x_5} & \frac{1}{x_5} & 0 & 0 & 0 & 0 & \frac{1}{x_5^5} \\ \end{array} \right] $$
We want to minimize $x_1+x_2$ and $x_1,x_2 \ge 0$, so we have to get close to origin as much as possible. Consider the problems in $x_1-x_2$ plane, first we have to find the feasible region (I am assuming $a_1,a_2\ge0$):
The blue curve is the boundary of the first inequality $x_1 x_2 \ge a_1$, the feasible region is the region above this curve. The dashed-line orange curves are the second inequality $x_1x_2\ge ya_2$ for different values of $y$, again the area above these curves are the feasible region. This means if $y\le\frac{a_1}{a_2}$, we can ignore the second inequality, otherwise (if $y\ge\frac{a_1}{a_2}$) we can ignore the first inequality. The purple vector shows the direction of movement of curves as we increase $y$. Then we have the third inequality $x_1 \ge y$ which has the boundary of green line, our answer is in the right hand side of green line. And finally we have the forth inequality $x_2 \le y$ with boundary of grey line, our answer is in lower half of this line (below grey line).
With these information at hand, we see that the inequality $x_1\ge y$ must become active at solution point, this means the slackness condition $\lambda_4(y-x_1)=0$ is equivalent to $x_1=y$. Substituting this in the primal, we get three inequalities $x_2 \ge \frac{a_1}{y}$, $y\ge x_2$ and $x_2 \ge a_2$ and the objective is $y+x_2=x_1+x_2$.
Back to primal. Now consider on one hand we have we have $y\ge x_2$ and $x_2 \ge \frac{a_1}{y}$ which means $y \ge \frac{a_1}{y}$ or $y \ge \sqrt{a_1}$. On the other hand we have $y\ge x_2$ and $x_2 \ge a_2$which means $y\ge a_2$. Thus we obtain two main conditions that solves everything: $y \ge \sqrt{a_1}$ and $y\ge a_2$.
Finally if $a_2 \le \sqrt{a_1}$ the solution is $x_1=y=x_2=\sqrt{a_1}$. Otherwise if $\sqrt{a_1} \le a_2$ the solution is $x_1=x_2=y=a_2$. And now we can see the funny part, both $x_1 \ge y$ and $y \ge x_2$ are tight so from start we could have considered the slackness conditions $\lambda_3(y-x_1)=0$ and $\lambda_4(x_2-y)=0$ to be active i.e. $x_1=x_2=y$ to be true and get the solution.
Best Answer
Let $p_2=t$, $x_2-x_1=y\geq 0$ and $x_1=x$, then $$p_1 = {1-ty\over x}$$ so $$p_1p_2 = t{1-ty\over x} = -{y\over x}t^2+{1\over x}t$$
If $y\neq 0$ then this quadratic equation achieves maximum at $t= {1\over 2y}$ and that maximum is $${1\over 4xy}={1\over 4x_1(x_2-x_1)}$$
If $y=0$ we get $$p_1p_2 = {1\over x}t\leq {1\over x}$$
so in this case maximum is $1/x$