What is the largest possible variance of a random variable on $[0; 1]$? What is the largest possible variance of a random variable on $[0; 1]$?
It is evident that it does not exceed $1$, but I doubt, that $1$ is actually possible. The largest variance, for which I found the example is $\frac{1}{4}$. That is the variance of a random variable $X$, such that $P(X = 1) = P(X = 0) = \frac{1}{2}$, but I doubt that  it is the largest possible one.
Why is it interesting:
Initially I wanted to find the largest possible second moment of $X - Y$, where $X$ and $Y$ are i.i.d. random variables on $[0; 1]$. Then I found:
$$E(X - Y)^2 = E(X^2 - 2XY + Y^2) = EX^2 - 2EXY + EY^2 = 2(EX^2 - EXY + EXY - EXEY + Cov(X, Y)) = 2(EX^2 - {(EX)}^2) = 2VarX$$
And thats where I am now.
This question is partially inspired by: Probability distribution to maximize the expected distance between two points
 A: Another elementary proof: $X^2\leq X$ since $X\in[0,1]$. Therefore
$$
Var(X)=\mathbb E[X^2] - \mathbb E[X]^2\leq \mathbb E[X]-\mathbb E[X]^2 = z-z^2 \leq \frac14.
$$
The last indequality valid since function $f(z)=z-z^2$ reaches its maximal value $\frac14$ at point $z=\frac12$.
To reach equality in the first inequality $\mathbb E[X^2]\leq \mathbb E[X]$ we need $X^2=X$ a.s. This is possible only when $X$ takes values $0$ and $1$. The second indequality $z-z^2\leq \frac14$ is equality if $z=\mathbb E[X]=\frac12$. 
So the upperbound is $\frac14$ and it is achieved by $\mathbb P(X=0)=\mathbb P(X=1)=\frac12$ only.
A: The answer is $1/4$. For any probability distribution on $[0,1]$ the point $p=(EX,EX^2)$ will be a point in the convex hull of the set $S = \{(x,x^2):x\in[0,1]\}$. (This is a segment of a parabola.) The variance is the height of $p$ above the set $S$.  This is clearly maximized when $p$ lies on the straight line connecting $(0,0)$ to $(1,1)$.  By calculus, this is attained at $p=(1/2,1/2)$, which is $1/4$ above the point $(1/2,1/4)\in S$.
That $p$ is in the convex hull of $S$ is a consequence of Caratheodory's theorem: each element $p$ of the convex hull of $S$ is a weighted combination of at most 3 elements of $S$: Let that combination be $p=\sum_{i=1}^3 w_i\cdot(x_i,x_i^2)$, where the $w_i\ge0$ add up to $1$.  Now look at the prob distribution for which $PX=x_i)=w_i$.
Its first 2 moments are the components of $p$.  
In the special case at hand Caratheodory's theorem is trivial.
Every point in the convex hull of $S$ is on a chord of $S$.
If $p$ is already in $S$, it is of the form $p=(x,x^2)$, and the prob law $P(X=x)=1$ does the trick.  Otherwise, the line passing through $(0,0)$
and $p$ cuts $S$ at $q$; the chord in question can be between $(0,0)$ and $q$, and $a$ can be chosen so $P(X=(0,0))=a, P(X=q)=1-a$ does the trick.
More generally, as a comment suggests, this is a fundamental property of a expectation operator.  An expectation $ET(X)$ of a vector valued function is a particular weighted average of the possible values of the function $T(x)$.  A probability law, one can think, amounts to a choice of weights.  In problems like this one, the set of possible values of $ET(X)$ you get as  you vary the probability law of $X$  is the convex hull of the set of values of the function $T(x)$.
A: A more elementary proof:
Variance is shift-invariant, i.e. let $Y = X - 1/2$ and $Var(Y) = Var(X)$.  So we just need to consider $Y$ on $[-1/2, +1/2]$.  The requested result follows from these observations:


*

*$Y^2 \in [0, 1/4] \implies E[Y^2] \in [0, 1/4] \implies E[Y^2] \le 1/4$

*$E[Y]^2 \ge 0$ since it is a square.  


*

*(In fact, $Y \in [-1/2, 1/2] \implies E[Y] \in [-1/2, 1/2] \implies E[Y]^2 \in [0, 1/4]$.)


*$Var(Y) = E[Y^2] - E[Y]^2 \le 1/4 - 0 = 1/4$
This proves the requested upperbound of $1/4$; which the OP has already shown is achievable.  This also shows that achieving this bound requires $E[Y] = 0$ and $E[Y^2]=1/4$ which in turn requires $Y^2 = 1/4$ which in turn requires $Y = \pm 1/2$.  The OP's example is obviously the only such distribution.
