Z
E(X) := xf (x)dx
Z
Var(X) := [x E(X)]2 f (x)dx
2
Z
Var(X) = [x E(X)]f (x)dx
Z
= [x2 2xE(X) + E(X)2 ]f (x)dx
Z Z
2
= x f (x)dx 2E(X) xf (x)dx
Z
2
+E(X) f (x)dx
Z
= x2 f (x)dx 2E(X)E(X) + E(X)2 1
Z
= x2 f (x)dx E(X)2
4
Example
The uniform distribution on the interval [0, 1] has the probability
density function
0 if x < 0 or x > 1
f (x) =
1 if 0 x 1
Solution
Z
E(X) = xf (x)dx
Z 0 Z 1
= x 0dx + x 1dx
0
Z
+ x 0dx
1
1
= 0 + x2 |10 + 0
2
1
=
2
6
Solution, continued
We compute
Z Z 1
2
x f (x)dx = x2 dx
0
1 3 x=1
= x |
3 x=0
1
=
3
Solution, completed
Hence,
Z
Var(X) = x2 f (x)dx E(X)2
1 1
=
3 4
1
=
12
8
Another example
Let X be the random variable with probability density function
ex if x 0
f (x) = .
0 if x > 0
Solution
Integrating by parts with u = x and dv = ex dx, we see that
R x
xe dx = xex ex + C. Thus,
Z
E(X) = xf (x)dx
Z 0
= xex dx
0
Z 0
= lim xex dx
r r
= lim [1 rer + er ]
r
= 1
10
Solution, continued
We compute
Z Z
2 x 2 x
x e dx = x e 2 xex dx
= x2 ex 2xex + 2ex + C
So,
Z Z 0
2
x f (x)dx = x2 ex dx
= lim (2 r2 er + 2rer 2er )
r
= 2
11
12
Solution
First, we must find the probability density function of X.
Differentiating we find that the function
cos(x) if 0 x
2
f (x) =
0 otherwise
13
Solution, continued
Z
E(X) = xf (x)dx
Z
2
= x cos(x)dx
0
x=
= (x sin(x) + cos(x))|x=02
= 1
2
14
Solution, finished
Integrating by parts, we compute
Z 2
Var(X) = x2 cos(x)dx E(X)2
0
x=
= (x2 sin(x) 2 sin(x) + 2x cos(x))|x=02 ( 1)2
2
2 2
= 2( + 1)
4 4
= 3
15