Distribution function given expectation and maximal variance I'm working on the following problem I got in a hw but I'm stuck. It just asks to find the distribution function of a random variable $X$ on a discrete probability spaces that takes values in $[A,B]$ and for which $Var(X) = \left(\frac{B-A}{2}\right)^{2}.$
I got that this equality gives the expected values $E(X) = \frac{A+B}{2}$ and $E(X^{2}) = \frac{A^{2}+B^{2}}{2}$, but I can't see why this gives a unique distribution (as the statement of the problem suggests).
I also found the distribution function $p(x) = 0$ for $x \in (A,B)$ and $p(A)=\frac{1}{2}$, $p(B)=\frac{1}{2}$ that works for example, but I don't see how this is the only one. Can anyone shed some light please?
Thanks a lot!

Let $m=\frac12(A+B)$ and $h=\frac12(B-A)$. The OP indicates in a comment how to prove that any random variable $X$ with values in $[A,B]$ and such that $\mathrm{Var}(X)=h^2$ is such that $\mathbb E(X)=m$ and $\mathbb E((X-m)^2)=h^2$. 
Starting from this point, note that $|X(\omega)-m|\leqslant h$ for every $\omega$ since $A\leqslant X(\omega)\leqslant B$, hence $(X-m)^2\leqslant h^2$ everywhere. Together with the equality $\mathbb E((X-m)^2)=h^2$, this proves that $(X-m)^2=h^2$ almost surely, that is, $X\in\{A,B\}$ almost surely. Now, use once again the fact that $\mathbb E(X)=m$ to deduce that $\mathbb P(X=A)=\mathbb P(X=B)=\frac12$.
Edit: Let us recall why $Y\geqslant0$ almost everywhere and $\mathbb E(Y)=0$ imply that $Y=0$ almost everywhere. 
Fix $\varepsilon\gt0$, then $Y\geqslant0$ almost everywhere hence $Y\geqslant\varepsilon\mathbf 1_{Y\geqslant\varepsilon}$ almost everywhere. This implies that $0=\mathbb E(Y)\geqslant\varepsilon\,\mathbb P(Y\geqslant\varepsilon)$, that is, $\mathbb P(Y\geqslant\varepsilon)=0$. Now, $[Y\ne0]=[Y\gt0]$ is the countable union over every positive integer $n$ of the events $[Y\geqslant1/n]$ hence $\mathbb P(Y\ne0)=0$. QED.
