# Discrete distribution with the minimum variance

Consider a discrete random variable $X \in \{x_1, x_2, \ldots, x_n\}$, where $n < +\infty$ and $x_1 < x_2 < \ldots < x_n$.

Let pose $p_i = \text{Pr}(X = x_i)$, with $\sum_{i=1}^N p_i = 1$.

Suppose that the expected value of $X$, $\mu_X \in [x_1, x_n]$, is known.

I want to solve the following problem:

$$\left\{\begin{array}{l}\min_{p_1, p_2, \ldots, p_n} \mathbb{E}\left[(X - \mathbb{E}[X])^2\right]\\ \text{s.t.}\\ \mathbb{E}[X] = \mu_X\\ p_i \geq 0\\ \sum_{i=1}^np_i = 1 \end{array} \right.$$ where $$\mathbb{E}[X] = \sum_{i=1}^n p_ix_i$$

Is there some general results on this type of problem?

In terms of the vector $p=[p_1\quad p_2\quad \cdots\quad p_n]^T$ the problem is $$\min_{p}p^Tb-\frac{1}{2}p^TQp\\ \mbox{sub. to}\\\ p^Ta=\mu_X,\ p^T1=1,\ p\ge 0\\$$ where $a=[x_1,\ x_2,\cdots,\ x_n]^T,\ b=[x_1^2,\ x_2^2,\cdots,\ x_n^2]^T,\ Q=2aa^T$ This is a standard nonlinear optimization problem that can be solved using Lagrange's multiplier method. Taking the third constraint to be active, we write down the Lagrangian as $$L(p,\lambda_1,\ \lambda_2)=p^Tb-\frac{1}{2}p^TQp+\lambda_1(p^Ta-\mu_X)+\lambda_2(p^T1-1)$$The first order necessary condition gives $$\nabla_p L=0\Rightarrow b-Qp+\lambda_1a+\lambda_21=0$$ Since $Q$ is a rank $1$ matrix there can be infinitely many solutions of this equation. Now the hessian is $-Q$ and the tangent space is $$T=\{y:a^Ty=0,\ y^T1=0\}$$ Then, $\forall\ y\in T$, $$-y^TQy=-2y^Taa^Ty=0$$ So nothing can be said about the existence of a minimizer or a maximizer. For that higher order tests are necessary.