0
$\begingroup$

I am trying to find the variance but I don't know how to calculate $E(X^2)$, but I do have a process that will enable me to find $E(X)$. How can I find $E(X^2)$?

In my case I have two 6-sided dice, which when thrown sum to D. Then I throw D 15-sided dice and its sum is S. I want to find the variance of S. I can find the expected value by doing (2*3.5)*8 but I don't know how to get the expected value of the square so I can subtract the two to find the variance.

I know it's around 504 but just trying to understand how to calculate it. I also know $E(X)$ here is 56, so $E(X^2)$ is around 560, but how to get the ~560?

  • 0
    @DilipSarwate This doesn't seem to work for what I am doing. My E(X) system is derived from finding the E(X) of other systems. Do I need to apply the x^2 thing to all the intermediate steps too?2012-06-16
  • 0
    Can you provide some more information like what " multiple dice system" or how you are getting $E[X]$ from intermediary steps?2012-06-16
  • 0
    @SaurabhHota For example if I have D 15-sided dice and I want to know the variance of their sum, S. The expected value of a 15-sided die is 8, so expected value is 8*D. D depends on the expected sum of earlier systems, and so forth, but I only care about S, the final sum.2012-06-16
  • 0
    The variance of the sum of independent random variables is the sum of the variances! Find the variance for one die and multiply it by D.2012-06-16
  • 1
    So you can do this $$E[X^2]=\frac{1}{15}\sum\limits_{i=1}^{15}i^2$$2012-06-16
  • 0
    @Cocopuffs Well what I tried is to find the mean of one 15-sided die, and then do (abs(1-mean)^2+abs(2-mean)^2 + ... + abs(15-mean)^2)/15 to find the variance, multiply by D, but it is incorrect2012-06-16
  • 0
    @SaurabhHota Tried that too, was wrong2012-06-16
  • 0
    @SaurabhHota's solution is correct for one dice, if you have $n$ dice, just multiply by $n$.2012-06-16
  • 0
    Say I roll 2 6-sided dice, and its sum = D. Then I roll D 15-sided dice, its sum = S. I want the variance of S. Expected value of 6-sided die is 3.5, so EV(D) = 2*3.5=7. Expected value of 15-sided die is 8, so EV(S) = 7*8=56. Is this correct so far?2012-06-16
  • 0
    Well, if it does, you should really explain how in the question. For an expected value, though, you can use the following: $\mathbb{E}[X^2] = \mathbb{E}_D\mathbb{E}[X^2|D] = \mathbb{E}[D]\mathbb{E}[X^2]$. This works unless the specifics of the dice rolled (e.g., how many sides) also depends on the previous dice rolls.2012-06-16
  • 0
    All that changes is that the number of dice rolled depends on the sum of previous dice rolled2012-06-16
  • 0
    Yes, that's not a problem. Note that $\mathbb{E}[X^2] = (n+1)(2n+1)/6$ for an $n$-sided dice.2012-06-16
  • 0
    Even with that equation it matches my earlier work, somehow the answer is still wrong. Was the way I calculated E(S) appropriate?2012-06-16
  • 0
    Why do you say this is wrong?2012-06-16
  • 0
    @Cocopuffs It does not match the answer2012-06-16
  • 1
    This question needs to be closed until the OP edits it. It seems unlikely that the question can be answered in its present form. Too much information is missing, and is coming out in dribs and drabs from the OP in response to the queries in the comments. To the OP: carefully describe the experiment being performed (it seems to be a two-stage experiment) and the random variable whose mean-square value you need to find. Telling us how you proceeded to calculate $E[X]$ would also help.2012-06-16
  • 0
    @DilipSarwate I explained that in my comment above2012-06-16
  • 2
    As I said, coming out in dribs and drabs, and even if someone goes through all the comments and gleans the important stuff, you have nonetheless provided an incoherent description at best. If you can't be bothered to take the time to edit and re-write your question, I feel no urge to spend my time answering it either.2012-06-16
  • 1
    To the OP, I have tried to extrapolate the details from these comments. Please let me know if the answer is helpful. If not, please elaborate. I agree with @Dilip that the spirit of this board is that people will help you provided that you are kind and thorough with your thoughts and attempts to solve a problem. It would not hurt you to be more descriptive in your post.2012-06-16
  • 0
    @Justin Okay, I will try to edit the post2012-06-16
  • 0
    Also, please look at my answer below. I think it should help. If it does, please feel free to say so and up-vote/accept, etc. Doing these types of things will help the community be more inclined to help as much as they can.2012-06-16
  • 0
    Can anyone show the algebra involved?2012-06-16

4 Answers 4

3

The comments have clarified this question significantly. To summarize, we roll 2 6-sided dice and sum the results to get a result $D$, then roll a 15 sided dice $D$ times, summing the results to get $X$. The question is, what is the variance of $X$?

The governing equation is:

$\mathbb{V}[X] = \mathbb{E}_D[\mathbb{V}[X|D]] + \mathbb{V}_D[\mathbb{E}[X|D]]$

Now, $\mathbb{V}[X|D] = D\mathbb{V}[X|D=1]$, as we are just summing up the 15-sided dice. So the first term on the r.h.s. above is $\mathbb{E}[D] \mathbb{V}[X|D=1]$. As $\mathbb{E}[X|D] = D\mathbb{E}[X|D=1]$, once again because we are just summing, the second term on the r.h.s. above is $\mathbb{V}[D]\mathbb{E}[X|D=1]^2$.

The expectation and variance of a discrete uniform variate on $\{1, 2, \dots, N\}$ are $(N+1)/2$ and $(N^2-1)/12$ respectively. Plugging in 6 and 15 in all the appropriate places, and remembering that we are rolling two dice to give us $D$, results in $\mathbb{E}[D] = 7$, $\mathbb{V}[X|D=1] = 224/12$, $\mathbb{V}[D] = 35/6$, and $\mathbb{E}[X|D=1]=8$, for a final result of 504.

Writing a little R script to check:

DiceRoll <- function(n) sample(1:n,1)  x <- rep(0,100000) for (j in 1:length(x)) {   n <- DiceRoll(6) + DiceRoll(6)   for (i in 1:n) x[j] <- x[j] + DiceRoll(15) }  var(x) [1] 504.4255 

which looks like a pretty good confirmation that we haven't messed up anywhere.

  • 0
    I appreciate this answer but I do not understand it at all, to be honest. I don't know all those math symbols/jargon all that well and am only really familiar with algebra.2012-06-16
  • 0
    $\mathbb{V}[X]$ is the variance of $X$, $\mathbb{E}[X|D]$ is the expected value of $X$ given the value of $D$, $\mathbb{E}_D[\mathbb{V}[X|D]]$ is the expected value of [the variance of $X$ given $D$], and so forth. For the latter term, to clarify a little more, we calculate the variance of $X$ given that we are rolling $D$ 15-sided dice, then we take the expected value of that, as we don't actually know how many 15-sided dice we are going to roll. Hopefully you can figure out the rest from that - especially with the numbers to help.2012-06-16
  • 0
    I was able to recreate your result, but does the equation change if there are more systems? Say I throw a die and its sum = A, I throw A dice, their sum=B, I throw B dice, and so on. Does the equation just apply to the last step if I know the expected value up until the last step?2012-06-16
  • 0
    No, unfortunately it doesn't. The difficulty is that it isn't sufficient to know the mean and variance of, e.g., the second step in order to calculate the last step, you actually have to know all the probabilities. Sometimes you're just better off simulating, as with the code fragment above, rather than fighting your way through a lot of algebra which you will then just have to program anyway (or perhaps set up in a spreadsheet) because there are too many possible cases to deal with by hand.2012-06-16
  • 0
    But can i use variance and ev of old systems to find those variables for the new system recursively?2012-06-16
1

$\newcommand{\var}{\operatorname{var}} \newcommand{\E}{\mathbb{E}}$ jbowman has already mentioned the law of total variance, but I think the matter can be stated more simply than in that answer.

$$ \var(S) = \var(\E(S\mid D)) + \E(\var(S\mid D)). $$ I.e. the total variance of $S$ is the variance of the conditional expected value plus the expected value of the conditional variance. Below I'll say something about what that means.

You throw two 6-sided dice and get a number $D$ in the set $\{2,3,4,\ldots,12\}$, with respective probabilities $1/36, 2/36, 3/36, 4/36, 5/36, 6/36, 7/36, 6/36, 5/36,4/36,3/36,2/36,1/36$. We have $\E(D)=7$ and $\var(D)=35/6$.

Now suppose you throw a 15-sided die. You get a mean of $8$ and a variance of $56/3$ (if my hasty arithmetic is right).

If you throw $d$ 15-sided dice and sum the outcomes, you have a mean of $8d$ and a variance of $56d/3$.

So the conditional expected value of the sum $S$ given the event that $D=d$ is $8d$ and the conditional variance of the sum $S$ given the event that $D=d$ is $56d/3$. I.e. $$ \E(S\mid D=d) = 8d,\qquad \var(S\mid D=d)=\frac{56d}{3}. $$

Next we have $\E(S\mid D)$ and $\var(S\mid D)$ as random variables in their own right, since they depend on the random variable $D$, and we get: $$ \E(S\mid D) = 8D, \qquad \var(S\mid D)= \frac{56D}{3}. $$

So $$ \E(\var(S\mid D)) = \E\left(\frac{56D}{3}\right) = \frac{56}{3} \E(D) = \frac{56}{3}\cdot 7 = \frac{392}{3}, $$ and $$ \var(E(S\mid D)) = \var(8D) = 8^2\var(D) = 64\cdot \frac{35}{6} = \frac{1120}{3}. $$

Now add: $$ \frac{392}{3} + \frac{1120}{3} = \frac{1512}{3} = 504. $$

Later note: $\var(\E(S\mid D))$ is the part of the variance of $S$ that is "explained" by the variability of $D$. The other term, $\E(\var(S\mid D))$ is the part of the variance of $S$ that comes from the randomness that remains in $S$ after $D$ is determined, so it's the "unexplained" component of the variance of $S$.

  • 1
    What if i have multiple systems? I got the 504 but what if it's deeper?2012-06-16
1

Another problem to point out with the premise of the question is that for an arbitrary random variable $X$ there is literally no relationship whatsoever between $E(X)$ and $E(X^2)$. The easiest way to see this might be to take a variable $X$ that has probability $\frac{1}{2n+1}$ of being each of the numbers $-n, -n+1, \ldots, 0, \ldots, n-1, n$. Then the expected value of $X$ itself, is obviously zero, but $E(X^2) = \frac{1}{2n+1}\sum_{i=-n}^ni^2 = n(n+1)/3$; the value of $E(X)$ (which is always 0) tells us nothing at all about the value of $E(X^2)$ (which varies with $n$ and can be arbitrarily large). It's impossible to compute $E(X^2)$ from $E(X)$, so you have to go through at least some semblance of the computation that other answers here have outlined.

0

Well, the good news is that if you can find $E(X)$ you should be able to find $E(X^2)$.

Given that you have a 2-stage discrete process, perhaps it would help you to visually "chart" out the possibilities for S. You should be able to then see how to calculate

$E(X)=\sum_i x_ip(x_i)$

If I understand the problem correctly, you have to roll N 6-sided dice and then roll $M=\sum_in_i$ 15-sided dice in order to find the moments of the second process.

Steps/hints

-Create your discrete pmf for the first RV

-Use this to create a discrete pmf of the second RV

-Use this pmf to calculate $E(X),E(X^2).$

The "trick" here is to recall (or observe) that the $E(Y)$ can be thought of as a collection of $E(Y|X=x)$-type outcomes that should be relatively easy to compute. While in this case a 15-sided die is slightly more difficult to deal with, it doesn't change the methodology from the below example.

Simplified example

Suppose you flip a coin and then roll 1 die if it comes up heads and 2 dice if it comes up tails. What is $E$(dice roll)?

It should be easy to see that the first process has a simple pmf that is $\frac12$ for heads and tails. Under the event $(Y|X=0)$, for $0$="heads", $E(Y)=\frac16(1+2+\cdots+6)=3.5$ while the event $(Y|X=1)$ yields $E(Y)=\sum_{i=2}^{12}x_ip(x_i)=7.$

Think about what $E(Y)$ is in this simplified case, and think about how this would impact a complete pmf for Y.

Then extrapolate.

  • 0
    Similar to what I said on the other answer, I do not understand this much. I have no idea what a discrete pmf is or how it applies here. The 504 number is the correct answer but I am trying to understand how to find it.2012-06-16
  • 1
    hmm, ok. Well I am somewhat curious as to how you were given this problem without knowing anything about probability mass functions. I would start here: http://en.wikipedia.org/wiki/Probability_mass_function2012-06-16
  • 0
    I understand basic probability and the basic concepts of variance and standard deviation, just not all the jargon and gritty-level mathematical stuff2012-06-16
  • 0
    also, do you understand what P(Y|X) means? It is the probability of "Y" ***given*** that X happened. So, an event like P(Y|X=1) in my above example would be "the probability of Y (the dice roll) ***given*** that X=1 (a tails was flipped on the coin). If I add up all of the individual (Y|X=x) I can get the information I need about Y. In your example, imagine trying to figure out the possible outcomes for the 15-sided dice roll, ***AFTER*** you know the result of the first dice roll.2012-06-16
  • 0
    Yes I know of that (Bayes Rule). I explained earlier how I calculated E(X). Can I just directly modify that to get E(X^2)?2012-06-16
  • 0
    I think you are misunderstanding. This is not a Bayes question, but one of conditional probability (admittedly related to Bayes, but don't think about Bayes here). So if I said, what is the probability of the 15-sided die roll summing to 2, ***given*** that the first die roll was a "3", would you understand how to find it?2012-06-16
  • 0
    Sorry, I just have no idea without listing out all the individual possibilities first. I know how to think in terms of E(X) which I already calculated.2012-06-16
  • 0
    You need to think about putting the calculation of $E(X)$ into the form listed above, namely $\sum_ix_ip(x_i)$, and from there you can manipulate it to find $E(X^2)$. With discrete probabilities (those that can only take on a "finite" number of possibilities), the question often requires that you make a chart or table of the individual possibilities.2012-06-16
  • 0
    Yes, I am trying to manipulate my equation for E(X) to get E(X^2), but without needing to list out every single possibility ("roll a 2 sum, then try rolling 2 15's. roll a 3 sum, then try rolling 3 15's, etc").2012-06-16
  • 0
    I am trying/have tried to go to great lengths to help (and havent even got an up-vote from you). You ***cant*** just take $E(X)$ and "manipulate" it into $E(X^2)$ because $X$ isn't just some number...it is a random variable, which is a function. I'm not sure how else to explain it. You have to manipulate "every X", and that can be done with the summation notation, but if you can't put it in that form, I'm not sure what else I can say.2012-06-16
  • 0
    I guess I am not smart enough to understand what you're trying to tell me. I feel like we're getting off track. I'm just trying to look for an algebraic expression that will give 560 that I can examine and try to understand. (I can't upvote without 15 rep anyway)2012-06-16
  • 0
    I understand what you are asking, but there is no short-cut way to do this. The algebraic expression is $\sum_ix_i^2p(x_i)$ You have to have all of the values of $x_i$ and $p(x_i)$ to do this. Do you understand what these values are/represent?2012-06-16
  • 0
    It would help me much more to literally see the algebraic expression that would yield the 560 value. I just absolutely cannot think in abstract terms first before understanding the concrete.2012-06-16
  • 0
    Well, we are in a catch-22 then, because to see it written out bit-by-bit, you would have to list out each possibility. The $x_i$'s represent the possible outcomes of the Sum of 15-sided dice rolls in your problem, and the $p(x_i)$'s are the probabilities of each of these outcomes.2012-06-16
  • 0
    So after all of that, I can't even get an up-vote from you?2012-06-16
  • 0
    I need more rep to upvote2012-06-16
  • 0
    "Solve for" isn't really the right term if you mean "find" or evaluate". If I have the equation $3x+5=20$, I can _solve for_ $x$. If I know that $x = 1+2+3+4+5$, I can _find_ $x$.2012-06-16