Find the mean and variance for the probability density function $f \left(x\right) = \begin{cases} \dfrac{1}{24}, & - 12 \leq x \leq 12 \\ & \\ 0, & \text{ otherwise} \end{cases}$
By definition, mean $= E \left(X\right) = \int \limits_{- \infty}^{\infty} x \; f \left(x\right) \; dx$
$\begin{aligned}
\text{Here, } E \left(X\right) & = \int \limits_{- 12}^{12} \dfrac{x}{24} \; dx\\\\
& = \dfrac{1}{24} \times \left[\dfrac{x^2}{2}\right]_{- 12}^{12} \\\\
& = \dfrac{1}{48} \left[\left(12\right)^2 - \left(-12\right)^2\right] \\\\
& = 0
\end{aligned}$
By definition, mean $= E \left(X^2\right) = \int \limits_{- \infty}^{\infty} x^2 \; f \left(x\right) \; dx$
$\begin{aligned}
\text{Here, } E \left(X^2\right) & = \int \limits_{- 12}^{12} \dfrac{x^2}{24} \; dx \\\\
& = \dfrac{1}{24} \times \left[\dfrac{x^3}{3}\right]_{- 12}^{12} \\\\
& = \dfrac{1}{72} \times \left[\left(12\right)^3 - \left(- 12\right)^3\right] \\\\
& = \dfrac{3456}{72} = 48
\end{aligned}$
$\begin{aligned}
\text{Now, variance } & = E \left(X^2\right) - \left[E \left(X\right)\right]^2 \\\\
& = 48 - \left(0\right)^2 = 48
\end{aligned}$