1

Consider the function : $f(L) = \sum\limits_{x:L} g(x)$ where L is a list of integers where each element is randomly chosen between $1$ and $20$
$g(x) = 0$ if $x < 10$
$g(x) = 1 $ if $10 <=x <=19$
$g(x) = 2$ if $x =20$

What is the expected value of $f(L)$ for a list of size $5$ ?

As per my understanding I did it like :
$E(f(L)) = \sum\limits_{x:L} E(g(x)))$
$E(g(x)) = 1 * 10/20 + 2 * 1/20$
So it will just be 5 times the above value.

I am not sure if I am solving it correct?

ishita
  • 43
  • 2
    "randomly chosen" here means "uniformly randomly chosen" (i.e., each number is chosen with the same probability)? – John Hughes Jan 19 '21 at 14:16
  • I'm not sure this is correct. Your solution assumes that the list may have repetitions. In my opinion the problem is ambiguously written. – Crostul Jan 19 '21 at 14:17
  • Yes each element is picked uniformly randomly. what's the difference between the two ? – ishita Jan 19 '21 at 14:17
  • @Crostul Although I agree that you have identified an ambiguity in the problem, it seems to me that this ambiguity is irrelevant, assuming that I am interpreting this article correctly. – user2661923 Jan 19 '21 at 14:34
  • I have actually two parts to this same question. 1) Each element is picked uniformly randomly 2) Each element is generated by choosing the maximum of two independent uniformly randomly generated numbers. Not sure what's the difference between the two. Any links or reference to read up on this? – ishita Jan 19 '21 at 14:37

1 Answers1

1
  1. Each element is generated by choosing the maximum of two independent uniformly randomly generated numbers.

The chance of one of the numbers being $20$ is

$$p_2 = 1 - (19/20)^2.$$

The chance of both of the numbers being less than 10 is

$$p_0 = (9/20)^2.$$

Set

$$p_1 = 1 - (p_0 + p_2).$$

Then, the expected value of each number is

$$S = (1 \times p_1) + (2 \times p_2).$$

If there will be $n$ numbers (e.g. $n = 5$), then the expectation will be

$$S \times n.$$

Again, assuming that I am interpreting correctly the Linearity of Expectation article referenced in my comment, then it is irrelevant whether each pair of numbers is drawn with or without replacement. Here, I am interpreting [drawing without replacement] to signify that if the first drawing is $(19,20)$, which results in a score of $2$, then no subsequent drawing can contain either of the numbers $19$ or $20$.

user2661923
  • 35,619
  • 3
  • 17
  • 39
  • Thanks that makes sense. So is my solution to the problem for the part where the numbers are picked uniformly randomly correct? Any views on that? – ishita Jan 19 '21 at 14:55
  • @ishita Although I could be mistaken, both in my reaction to your query's analysis and my answer, I believe that your query's analysis is accurate, and I also believe that the Linearity of Expectation means that (with respect to your original query) it is irrelevant whether the sampling is done with or without replacement. – user2661923 Jan 19 '21 at 14:57