Clarification on variance and expected value problem Suppose that X is a random variable where:
$P(X = 1)$ = 1/2 
$P(X = 2) = $1/4 
$P(X = 4)$ = 1/4 
Suppose Y is another random variable that takes values from the set $$Y = {{1, 2, 4}}$$
but
the probabilities that it takes each value are unknown and some of them could be zero. 
What is the largest value that $E(Y)$ and $var(Y)$ can take?
I know that the largest $E(Y) = 4$
I also know that the answer for $var(Y)$ is $2.25$
I just don't know the necessary steps to get to the answer. 
 A: Hints
How can you maximize $\mathbb{E}[Y]$? Note that it is given by
\begin{equation}
\mathbb{E}[Y] = \mathbb{P}(Y = 1) \cdot 1 + \mathbb{P}(Y = 2) \cdot 2 + \mathbb{P}(Y = 4) \cdot 4.
\end{equation}
The variance is given by
\begin{equation}
\operatorname{Var}(Y) = \mathbb{E}[Y^2] - \mathbb{E}[Y]^2.
\end{equation}
So, what you want to do, is maximize $\mathbb{E}[Y^2]  - \mathbb{E}[Y]^2$ which means that you want to try to make $\mathbb{E}[Y^2]$ large and at the same time make $\mathbb{E}[Y]$ small. Remember that 
\begin{equation}
\mathbb{E}[Y^2] = \mathbb{P}(Y = 1) \cdot 1^2 + \mathbb{P}(Y = 2) \cdot 2^2 + \mathbb{P}(Y = 4) \cdot 4^2.
\end{equation}
A: The expectation is maximized when the probability that the random variable $Y$ attains its largest value is maximized. Since there are no constraints, this is achieved when $Y=4$ with probability $1$ and $Y=1,2$ with probability $0$. Formally, in this case $$E[Y]=1\cdot P(Y=1)+2\cdot P(Y=2)+4\cdot P(Y=4)=0+4\cdot1=4$$

The variance, as a means of dispersion, is maximized when the possible values of $Y$ are distributed as far away from the mean as possible, or in other words when the values of $Y$ are as less concentrated as possible. So, put as much weight on $1$ and $4$ at the same time, which can be done by choosing $$P(Y=1)=P(Y=4)=1/2$$ and $P(Y=2)=0$. In this case $$E[Y]=\frac12\cdot1+\frac12\cdot4=2.5$$ with $E[Y]^2=2.5^2=6.25$ and $$E[Y^2]=\frac12\cdot1^2+\frac12\cdot4^2=8.5$$ So $$Var(Y)=E[Y^2]-E[Y]^2=8.5-6.25=2.25$$ 
