# Variance of continuous Random Variable negative?

I am having trouble finding the Variance for this question.

The proportion of salt X left in the salt shakers at the end of the day at a crowded restaurant has a probability density function given by

f(x) { 2x for 0 < x < 1

   0 other wise


There are 80 salt shakers in the restaurant with each one having a capacity of 3 ounces of salt and they are all filled and used independently of each other. Find the expectation and standard deviation of T = the total amount of salt needed to fill the 80 salt shakers at the end of the day?

Here is what I am getting -

E(X) = an integral 0 to 1 (2x^2) , which then equals 2/3.

I then take the opposite of the 2/3 being that is how much left in the salt shaker and get 1/3 which is how much is gone. I then multiply 1/3(3) and see that one ounce needs to be refilled in each salt shaker. Then I multiply 1(80) to account for the 80 salt shakers. So my E(T) = 80

Now to find the Variance wouldn't I just find the integral from 0 to 1 of f(x)(x^2)? and then subtract E(t)^2 from that to fond the Variance? When I do that I am getting a negative number and I know that it isn't right. Any help?

• Note that you are integrating with respect to $x$ but subtracting the squared expectation of $t$. Different variables! Oct 30 '18 at 19:06
• Crap, so if I leave the variance to 1.5 and subtract the expected number of ounces lost which is 1^2. I would get .5. Than would I multiply that .5 by 80 and then take the root? Oct 30 '18 at 19:10
• To simplify your life a little, work through the mean and variance of how much salt is used. The mean of how much is left is just 240-how much is used, and the variance of how much is left = the variance of how much is used. Oct 30 '18 at 19:17
• I am getting 9.5 as my final answer. Is this correct? Oct 30 '18 at 19:33
• When you have found the right answer, you can answer your own question, so it is not left "hanging" Oct 30 '18 at 20:01

This seems like a textbook problem rather than a restaurant management problem, so I will give an outline leading to the answer. Your answer is a good start. Now, I hope you will turn it into a coherent mathematical demonstration with reasons for each step: Use $$E(a + bX)= a + bE(X),\,$$ $$Var(a + bX) = b^2Var(X),\,$$ and for independent random variables $$X_1, X_2,$$ you have $$Var(X_1 + X_2) = Var(X_1)+Var(X_2).$$

The random variable $$X$$ has $$E(X) = 2/3,$$ which you have already found. You can also show that $$Var(X) = 1/18.$$

The salt used in the $$i$$th shaker is $$Y_i = 3(1-X_i),$$ so $$E(Y_i) = E(3 - 3X_i) = 3 - E(3X_i) = 3 - 2 = 1.$$

Now you need to find $$Var(Y_i),$$ based on $$Var(X).$$

Finally, $$T = \sum_{i=1}^{80}Y_i.$$ Use that to find $$E(T)$$ and $$Var(T).$$

Here is a simulation in R statistical software, based on the fact that $$X \sim \mathsf{Beta}(2,1).$$ With a million iterations (days) one can expect results for $$E(T)$$ and $$SD(T)$$ accurate to about three significant digits, perhaps better.

set.seed(1018)
t = replicate(10^6, sum(3*(1-rbeta(80,2,1))))
mean(t);  sd(t);  var(t)
[1] 80.00621  # aprx E(T) = 80
[1] 6.325178
[1] 40.00787
mean(t > 90)
[1] 0.059156  # aprx P(T > 90)


Here is a histogram of the simulated distribution of $$T$$ (in Halloween orange). Because of the Central Limit Theorem, the distribution of $$T$$ is very nearly normal (normal density curve shown in blue). Can you find a normal approximation of $$P(T > 90)?$$

Note: Perhaps you'll want to look at Wikipedia's article on beta distributions.

The answer to the question above was found by finding F(X^2) which = 1/2

1/2 - (2/3)^2 = .05

.05(80) = 4.44 (80 being the amount of salt shaker summed up.)

4.44(3)^2 = 40

root(40) = 6.3

• Because it is difficult to connect these numbers with the correct answers, could you explain what you believe these numbers represent?
– whuber
Oct 30 '18 at 20:45
• Why are you subtracting the square of $1/3$? The mean of $x$ is $2/3$... Oct 30 '18 at 20:45