Skip to main content
2 of 2
added 602 characters in body
Mark White
  • 10.7k
  • 4
  • 34
  • 75

The two are trials dependent, so this is the marginal probability averaged across situations when X = 0 and X = 1.

On the second draw, there's either:

  • 2 red balls and 5 blue balls (2/7), which has a probability of 3/8 of occurring (this is conditioning on X = 1)

  • 3 red balls and 4 blue balls (3/7), which has a probability of 5/8 of occurring (this is conditioning on X = 0)

It is a weighted average of 2/7 and 3/7, with the weights being those probabilities based on the first draw, X:

((2/7) * (3/8) + (3/7) * (5/8)) = 3/8.

Simulation verifying this, in R:

set.seed(1839)
balls <- c(1, 1, 1, 0, 0, 0, 0, 0) # 0 is blue, 1 is red
res <- replicate(500000, sample(balls, size = 2, replace = FALSE))

# this returns a matrix with 500,000 columns
# the second row represents the second draw
# how many of these are 1?
prop.table(table(res[2, ]))

That returns 0.375028, or about 3/8:

       0        1 
0.624972 0.375028 

As a bonus, you can also look at the probability of each specific combination:

library(tidyverse)
res %>% 
  t() %>% 
  as_tibble() %>% 
  set_names(c("draw1", "draw2")) %>% 
  count(draw1, draw2) %>% 
  mutate(pct = n / sum(n) * 100)

Which gives us:

# A tibble: 4 x 4
  draw1 draw2      n   pct
  <dbl> <dbl>  <int> <dbl>
1     0     0 178551  35.7
2     0     1 133971  26.8
3     1     0 133935  26.8
4     1     1  53543  10.7

Rows 2 and 4 represent the two situations where the second draw (Y) can be 1. And 26.8% + 10.7% = 37.5%, or 3/8 probability.

Mark White
  • 10.7k
  • 4
  • 34
  • 75