# What are the mean and standard deviation of the probability density function given by p(x)=kabs(x-9)  for  x in [0,18], with k being a constant such that the cumulative density is equal to 1?

Feb 9, 2016

"Mean, mu = 9
sigma^2 = 81/2; sigma = sqrt(81/2) = 9sqrt2/2

#### Explanation:

First Normalize the distribution to 1, by integrating (compute the area) over [0, 18]
$F \left(x\right) = {\int}_{0}^{18} k | x - 9 | \mathrm{dx} = 1$
Now you can easily see the integral the area of the two triangles on [0, 18]. Thus the integral is equal to:
F(0leq x leq 18) = 1 = k/2(9xx9 + 9xx9) = 81k; k = 1/81
so the Probability distribution function:
$f \left(x\right) = \frac{1}{81} | x - 9 |$, with this in mind we can proceed to calculate the mean and standard deviation - $\mu , \sigma$.

$\text{Mean, } \mu = {\int}_{x o}^{x 1} x f \left(x\right) \mathrm{dx}$
$\mu = \frac{1}{81} {\int}_{0}^{18} | x - 9 | \mathrm{dx} = {\int}_{0}^{9} x \left(- x + 9\right) \mathrm{dx} + {\int}_{9}^{18} x \left(x - 9\right) \mathrm{dx}$ Now you can integrate this by brute force or note that the mean is half way through the range [0, 18] $\implies \mu = 9$ Why? Symmetry

$\text{Sigma^2, } {\sigma}^{=} {\int}_{x o}^{x 1} {\left(x - \mu\right)}^{2} f \left(x\right) \mathrm{dx}$
${\sigma}^{2} = \frac{1}{81} {\int}_{0}^{18} {\left(x - \mu\right)}^{2} | x - 9 | \mathrm{dx}$
${\sigma}^{2} = {\int}_{0}^{9} {\left(x - 9\right)}^{2} \left(- x + 9\right) \mathrm{dx} + {\int}_{9}^{18} {\left(x - 9\right)}^{2} \left(x - 9\right) \mathrm{dx}$
sigma^2 = 81/2; sigma = sqrt(81/2) = 9sqrt2/2