# Expected value of bernoulli random variable.

1. Dec 9, 2015

### kidsasd987

"Let X be a Bernoulli random variable. That is, P(X = 1) = p and P(X = 0) = 1 − p. Then E(X) = 1 × p + 0 × (1 − p) = p. Why does this definition make sense? By the law of large numbers, in n independent Bernoulli trials where n is very large, the fraction of 1’s is very close to p, and the fraction of 0’s is very close to 1 − p. So, the average of the outcomes of n independent Bernoulli trials is very close to 1 × p + 0 × (1 − p)."

I don't understand why it gives the average of 1 × p + 0 × (1 − p).
So, we are given with total n number of independent trials. Then, lets say we have k number of success, and n-k number of failures.

then, 1*p*k will be our success fraction, and (1-p)(n-k)*0 will be the failure fraction. If we find the average for n trials, it must be pk/n.

how do we have 1 × p + 0 × (1 − p) as our average

2. Dec 9, 2015

### Buzz Bloom

Hi kidsasd:

This is where you went astray. Your success fraction is the number of successes divided by the number of trials, that is, k/n = pn/n = p.

Regards,
Buzz

3. Dec 9, 2015

### kidsasd987

Thanks. But I guess n number of independant trials has to consist of number of success k and failure (n-k). Since each trial is independent, thus we cannot have success only.

for example, if I toss a fair coin i'd observe two possible outcomes. Head and tail. If I toss a coin n times, it would not give all head or all tail. thats what I thuoght, and why I introduced k. Please correct me where I got this wrong.

4. Dec 9, 2015

### Buzz Bloom

Hi kidsasd:

You said:
Do you agree that the "success fraction" is the number of successes divided by the number of trials? If so, then what is the number of successes, and what is the number of trials?

Regards,
Buzz

5. Dec 9, 2015

### kidsasd987

isn't success fraction, 1*P(X=1)*k?
where number of trials=n, and number of success=k.

avg={1*P(X=1)*k+P(X=0)*(n-k)*0}/n
Oh now I see where I got it wrong.

so if n is a small number then there is a greater possibility of deviating the fraction but such trend is minimized as we set n to a large number.

Thanks!

6. Dec 9, 2015

### Buzz Bloom

Hi kidsasd:

Glad to have been of help.

Regards,
Buzz