I feel really dumb even asking such a basic question but here goes:

If I have a random variable X that can take values 0 and 1, with P(X=1)=p and P(X=0)=1−p, then if I draw n samples out of it, I’ll get a binomial distribution.

The mean of the distribution is

μ=np=E(X)

The variance of the distribution is

σ2=np(1−p)

Here is where my trouble begins:

Variance is defined by σ2=E(X2)−E(X)2. Because the square of the two possible X outcomes don’t change anything (02=0 and 12=1), that means E(X2)=E(X), so that means

σ2=E(X2)−E(X)2=E(X)−E(X)2=np−n2p2=np(1−np)≠np(1−p)

Where does the extra n go? As you can probably tell I am not very good at stats so please don’t use complicated terminology :s

**Answer**

A random variable X taking values 0 and 1 with probabilities P(X=1)=p and P(X=0)=1−p is called a Bernoulli random variable with parameter p. This random variable has

E(X)=0⋅(1−p)+1⋅p=pE(X2)=02⋅(1−p)+12⋅p=pVar(X)=E(X2)−(E(X))2=p−p2=p(1−p)

Suppose you have a random sample X1,X2,⋯,Xn of size n from Bernoulli(p), and define a new random variable Y=X1+X2+⋯+Xn, then the distribution of Y is called Binomial, whose parameters are n and p.

The mean and variance of the Binomial random variable Y is given by

E(Y)=E(X1+X2+⋯+Xn)=p+p+⋯+p⏟n=npVar(Y)=Var(X1+X2+⋯+Xn)=Var(X1)+Var(X2)+⋯+Var(Xn) (as Xi‘s are independent)=p(1−p)+p(1−p)+⋯+p(1−p)⏟n (as Xi‘s are identically distributed)=np(1−p)

**Attribution***Source : Link , Question Author : dain , Answer Author : L.V.Rao*