Average value of a function that equals the max of 2 random numbers

407 Views Asked by At

consider a function $f$ that equals a random number between $1$ and $0$, when all of the numbers are equally likely. The average value of this function is $0.5$. I am trying to find the average value of the function $g=max(f,f)$. this function generates 2 random numbers between $0$ and $1$, and picks the higher one. $f$ has a 50 percent chance to return a number smaller then $0.5$, so the chance that $g$ will return a value smaller then $0.5$ is $0.5*0.5=0.25$, so i know that the average value of $g$ is more than $0.5$, but i dont really know what to do next.

2

There are 2 best solutions below

0
On BEST ANSWER

A common method of working such problems involving the maximum of two random variable is to find the CDF. Here is an outline with most of the steps--roughly following the Comment of @MikeEarnest.

Let $X$ and $Y$ be independently distribute as $\mathsf{Unif}(0,1).$ Then the PDF of $X$ is $f_X(x) = 1,$ for $0 < x < 1,$ and $0$ otherwise. It follows that the CDF of $X$ is $F_X(x) = P(X \le w) = x,$ for $0 < x < 1.$ Similarly, $F_Y(y) = y,$ for $0 <y < 1.$

Now let $W = \max(X,Y).$ It is clear that $W$ has support $(0, 1).$ Also, $W \le w$ means that both $X \le w$ and $Y \le w.$

Now, we seek $F_W(w),$ for $0 < w < 1.$ The CDF of $W$ can be found as follows:

$$F_W(w) = P(W \le w) = P(X \le w,\, Y\le W)\\ = P(X \le w)P(Y \le w) = w^2,$$ for $0 < w < 1.$ The second line of the displayed equation follows from the first by independence. Then by differentiation, $f_W(w) = 2w,$ for $0 < w< 1.$

From there you can find $E(W) = \int_0^1 wf_{{}_W}(w)\,dw = 2/3.$

Notes: (1) The random variable $W \sim \mathsf{Beta(2,1)},$ the beta distribution with shape parameters $2$ and $1.$ You can find details in the Wikipedia article.

(2) The value of $E(W)$ can be approximated by simulation. We use R statistical software to simulate a million realizations of $W.$ Then the sample mean of the million realizations is very nearly $E(W).$

set.seed(822); m = 10^6
x = runif(m); y = runif(m)
w = pmax(x,y);  mean(w)
[1] 0.6669676  # aprx E(W) = 2/3

A histogram of these $W$'s is similar to the one in the Answer by @AlecosPapadopoulis (+1).

1
On

The distribution you are looking for has mean value $2/3$ and a relative frequency graph like the following (be careful: the values on the vertical axis are not the values of the density, but relative frequencies).

enter image description here