# Math Help - bernoulli

1. ## bernoulli

given that f is a bernoulli random variable with parameter p=0.3, what is expectation and variance of f?

2. Originally Posted by alexandrabel90
given that f is a bernoulli random variable with parameter p=0.3, what is expectation and variance of f?
Call that random variable $X$, then you have

$\mathrm{E}(X)=0\cdot\mathrm{P}(X=0)+1\cdot \mathrm{P}(X=1)=p$

And the variance is

$\mathrm{var}(X)=\mathrm{E}(X^2)-\mathrm{E}^2(X)=p-p^2=p(1-p)$

Where the value of $\mathrm{E}(X^2)$ is $p$ as well, because $X^2$ still is the same random variable (in this particular case).

Maybe you are wondering why $\mathrm{var}(X)=\mathrm{E}(X^2)-\mathrm{E}^2(X)$ should be true? That's because

$\mathrm{var}(X)=\mathrm{E}((X-\mathrm{E}(X))^2)=\mathrm{E}(X^2)-2\mathrm{E}^2(X)+\mathrm{E}^2(X)=\ldots$

Don't know why I'm writing this: it's almost certainly to be found in Wikipedia.