If \( X \sim U(a,b)\), find (a) E(X) and (b) Var(X)



\begin{align} (a) \;The \; p.d.f \; of \; X \; is \; f(x) &= \frac{1}{a-b} \\ \\ By \; the \; symmetry \; of \; the \; p.d.f \\ between \; a \; and \; b \\ \\ E(X) &= \frac{1}{2}(a+b) \\ \\ (b) \; Var(X) &= E(X^2)-E(X)^2 \\ \\ and \; E(X^2)&= \int x^2 f(x) dx \\ \\ &= \int_{a}^{b} x^2 (\frac{1}{b-a}) dx \\ &= \frac{1}{b-a} \left[\frac{x^3}{3}\right] \\ &= \frac{1}{3(b-a)}(b^3-a^3) \\ &= \frac{1}{3(b-a)}(b-a)(b^2 +ab + a^2) \\ &= \frac{b^2 + ab + a^2}{3} \\ \\ And \; since \; Var(X) &= E(X^2)-E(X)^2 \\ \\ Var(X) &= \frac{b^2 + ab + a^2}{3} - \frac{a^2 + 2ab + b^2}{4} \\ &= \frac{1}{12}[4(b^2 + ab + a^2)] - [3(a^2 + 2ab + b^2)] \\ &= \frac{1}{12}(b^2 - 2ab +a^2) \\ &= \frac{1}{12}(b - a)^2 \\ \\ \therefore \; Var(X) &= \frac{1}{12}(b - a)^2 \\ \end{align}