38.8. MOMENT GENERATING FUNCTIONS 789

Then M′ (t) = npet (q+ pet)n−1 . Then let t = 0 and you get M′ (0) = np which is E (X).Also

M′′ (t) = npet (q+ pet)n−2 (q+npet)so E

(X2)= np(q+np) .

Recall the following definition.

Definition 38.8.3 The variance of X is defined as E((X−E (X))2

). The mean is defined

as E (X).

This is a measure of how spread out the distribution is.

Example 38.8.4 Find the variance of X if X is a binomial random variable.

Note that in general,

E((X−E (X))2

)= E

(X2−2XE (X)+E (X)2

)= E

(X2)−2E (X)E (X)+E (X)2

= E(X2)−E (X)2

Thus the variance of X for X a binomial random variable is np(q+np)− (np)2 = npq.

Example 38.8.5 Let X be normally distributed with parameters µ,σ2. Find the mean andvariance. In fact, show that the mean is µ and the variance is σ2. Determine the momentgenerating function.

This will be done by using a moment generating function as above. For X normallydistributed,

M (t)≡ E(etX)= ∫ ∞

−∞

1√2πσ

e−(x−µ)2

2σ2 etxdx

=1√

2πσ

∫∞

−∞

exp(− 1

2σ2

((x−(µ + tσ2))2−

(t2

σ4 +2tσ2

µ)))

dx

after simplification and completing the square. Thus this equals

exp(

12

t2σ

2 +µt)

1√2πσ

∫∞

−∞

exp(− 1

2σ2

((x−(µ + tσ2))2

))dx

Change the variable in that integral on the right. Let

1√2σ

(x−(µ + tσ2))= u

so 1√2σ

dx = du. Then the expression becomes

exp(

12

t2σ

2 +µt)

1√2πσ

∫∞

−∞

exp(−u2)dx

√2σ

= exp(

12

t2σ

2 +µt)= M (t) (38.2)

38.8. MOMENT GENERATING FUNCTIONS 789Then M(t) = npet (q+ pe!)" |. Then let t = 0 and you get M’ (0) = np which is E (X).AlsoM" (t) =npe (q+ pel)" (q+npe')so E (X*) =np(q+np).Recall the following definition.Definition 38.8.3. The variance of X is defined as E ((x —E(X ))”) . The mean is definedas E (X).This is a measure of how spread out the distribution is.Example 38.8.4 Find the variance of X if X is a binomial random variable.Note that in general,E((X-E(X))’) = (x? —2XE (x) +£(x)”)EE (X?) —2E (X) E(X)+E(X)*E (xX?) —E(X)?Thus the variance of X for X a binomial random variable is np (q+np) — (np)? = npg.Example 38.8.5 Let X be normally distributed with parameters 1,07. Find the mean andvariance. In fact, show that the mean is [ and the variance is o”. Determine the momentgenerating function.This will be done by using a moment generating function as above. For X normallydistributed,_ (xn)?e 2 e*dxwet [a1= ag |e (-x ((- (u +t0?))”— (Po* + 210*x) ) dxafter simplification and completing the square. Thus this equalsexp (570+ ur) as | (-s ((x- (u +10°))”)) dxChange the variable in that integral on the right. Let(x— (u+to’)) =u1J/20so Jig = du. Then the expression becomes1 1 °exp (570° + ur) aa! exp (—u’) dx/2o= exp (570+ ur) =M(t) (38.2)