Tom K. answered 05/31/20
Knowledgeable and Friendly Math and Statistics Tutor
The uniform distribution from 0 to θ has density f(x) = 1/θ from 0 to θ, 0 elsewhere.
Then, using I[a,b] for the integral from a to b and E[a,b] for evaluation from a to b,
E(X) = I(-∞,∞) x f(x) dx = I[0,θ] x 1/θ dx = 1/θ 1/2x^2 E[0,θ] = 1/θ (1/2 θ^2 - 0) = 1/2 θ
var(X) = E(x - µ)^2 = E(x^2) - µ^2 = I[0,θ] x^2 1/θ dx - (1/2 θ)^2 = 1/θ 1/3x^3 E[0,θ] - 1/4θ^2 =
1/θ (1/3θ^3 - 0) - 1/4θ^2 =
1/3θ^2 - 1/4θ^2 = 1/12 θ^2