Let X denote the sum of dots we see in 100 die rolls, and let Y denote the number of heads in 600 coin flips. How can I compute P(X > Y)?

Intuitively, I don’t think there’s a nice way to compute the probability; however, I think that we can say P(X > Y) \approx 1 since E(X) = 350, E(Y) = 300, \text{Var}(X) \approx 292, \text{Var}(Y) = 150, which means that the standard deviations are pretty small.

Is there a better way to approach this problem? My explanation seems pretty hand-wavy, and I’d like to understand a better approach.

**Answer**

Another way is by simulating a million match-offs between X and Y

to approximate P(X > Y) = 0.9907\pm 0.0002. [Simulation in R.]

```
set.seed(825)
d = replicate(10^6, sum(sample(1:6,100,rep=T))-rbinom(1,600,.5))
mean(d > 0)
[1] 0.990736
2*sd(d > 0)/1000
[1] 0.0001916057 # aprx 95% margin of simulation error
```

*Notes* per @AntoniParellada’s Comment:

In R, the function `sample(1:6, 100, rep=T)`

simulates 100 rolls a fair die;

the sum of this simulates X. Also `rbinom`

is R code for simulating

a binomial random variable; here it’s Y. The difference is D = X – Y.

The procedure `replicate`

makes a vector of a million differences `d`

.

Then `(d > 0)`

is a logical vector of a million `TRUE`

s and `FALSE`

s, the `mean`

of which is its proportion of `TRUE`

s–our Answer. Finally, the last statement

gives the margin of error of a 95% confidence interval of the proportion

of `TRUE`

s (using 2 instead of 1.96), as a reality check on the accuracy

of the simulated Answer. [With a million iterations one ordinarily expects

2 or 3 decimal paces of accuracy for probabilities–sometimes more for

probabilities so far from 1/2.]

**Attribution***Source : Link , Question Author : Community , Answer Author : BruceET*