# the uniform distribution

#### Nas

Does anyone have a clue on how to do this?

A random variable x with a probability density function
f(x):=| 1/(b-a)
| 0

a≤x≥b
x<a or x>b
is said to be uniforly distributed over the interval (a,b)

a) Find the mean of x
b) Find the variance of x

#### Random Variable

EDIT: $$\displaystyle \mu = \frac{1}{2} \int^{b}_{a} x \ dx = \frac{1}{b-a} \frac{x^{2}}{2}|^{b}_{a} = \frac{1}{b-a} \frac{b^{2}-a^{2}}{2} = \frac{b+a}{2}$$

Last edited:

#### Nas

thank you for the help.

In order to calculate the variance, do I use the formula where the variance is equal to the integral of (x-mean)^2*f(x)dx?

#### Random Variable

EDIT: $$\displaystyle \sigma^{2} = \frac{1}{b-a} \int^{b}_{a} (x-\mu)^{2} \ dx = \frac{1}{b-a} \int^{b}_{a} \Big(x-\frac{b+a}{2}\Big)^{2} \ dx$$

$$\displaystyle = \frac{1}{b-a} \int^{b}_{a} \Big( x^{2} - (b+a) x + \frac{(b+a)^{2}}{4} \Big) \ dx$$

$$\displaystyle = \frac{1} {b-a} \Big( \frac{x^{3}}{3} - (b+a) \ \frac{x^{2}}{2} + \frac{(b+a)^{2}}{4} \ x \Big)\Big|^{b}_{a}$$

$$\displaystyle = \frac{1}{b-a} \Big(\frac{b^{3}}{3} - (b+a) \frac{b^{2}}{2} + \frac{(b+a)^{2}}{4} b - \frac{a^{3}}{3} + (b+a) \frac{a^{2}}{2} - \frac{(b+a)^{2}}{4} a \Big)$$

$$\displaystyle = \frac{1}{b-a} \Big(\frac{b^{3}-a^{3}}{3} + \frac{b+a}{2} (a^{2}-b^{2}) + \frac{(b+a)^{2}}{4} \ (b-a) \Big)$$

$$\displaystyle = \frac{b^{2}+ab+a^{2}}{3} - \frac{(b+a)^{2}}{2} + \frac{(b+a)^{2}}{4}$$

$$\displaystyle = \frac{4b^{2}+4ab+4a^{2}-6b^{2}-12ab-6a^{2} + 3b^{2}+6ab + 3a^{2}}{12}$$

$$\displaystyle = \frac{b^{2}-2ab+a^{2}}{12} = \frac{(b-a)^{2}}{12}$$

Last edited:

#### drumist

The mean should be:

$$\displaystyle \mu = E[X]= \int_{-\infty}^{\infty} x \, f(x) \, dx = \frac{1}{b-a} \int_a^b x \, dx = \frac{1}{b-a} \cdot \frac{b^2-a^2}{2} = \frac{a+b}{2}$$

Random Variable

#### Random Variable

The mean should be:

$$\displaystyle \mu = E[X]= \int_{-\infty}^{\infty} x \, f(x) \, dx = \frac{1}{b-a} \int_a^b x \, dx = \frac{1}{b-a} \cdot \frac{b^2-a^2}{2} = \frac{a+b}{2}$$
(Doh)

I fixed both of my previous posts.

Last edited:

#### mr fantastic

MHF Hall of Fame
thank you for the help.

In order to calculate the variance, do I use the formula where the variance is equal to the integral of (x-mean)^2*f(x)dx?
Easier to calculate E(X^2). Then $$\displaystyle Var(X) = E(X^2) - (E(X))^2$$.