# Math Help - Density Function [a,b] and integration

1. ## Density Function [a,b] and integration

Hello
Here's a question:
Let X have a continuous uniform distribution on the interval [a,b]. Find the density function for this dristribution and then verify that $\mu = \frac{(a + b)}{2}$ and $\sigma^2 = \frac{(b - a)^2}{12}$ .
ok
So here's what I "think" I should do ...

Let f(x) = 1/(b-a) = 1 assuming that a=0 and b=1
For a <= x <= b

I know I need to integrate, but I'm not sure how to set up the problem
$\mu = E(x) = \int xf(x)dx$ where f(x) = 1
then
$\int xdx = \frac{1}{2}x^2$ which equals 1/2 when pluging in [a.b]
Verifying ...
$\mu = \frac {(a+b)}{2}$ you get $\mu = \frac {(0+1)}{2} = \frac {1}{2}$

and then we have $\sigma^2$

$\sigma^2 = E((x-\mu)^2) = \int (x-\mu)^2f(x)dx$
so ...
$\int (x-\frac{1}{2})^2dx = \int x^2-x+\frac{1}{4}dx = \frac{x^3}{3}-\frac{x^2}{2}+\frac{x}{4}$
When you plug in the interval [0,1] you get $\frac{1}{12}$
verifying $\mu^2$ You also get $\frac{1}{12}$

Is this correct? wow, that was long, sorry, I just tried to do it myself without any help at first. Be nice to me, it's my first post and it's also my birthday! WOOHOO
Thanks for all the help

2. Originally Posted by TaoWine
...
Is this correct? wow, that was long, sorry, I just tried to do it myself without any help at first. Be nice to me, it's my first post and it's also my birthday! WOOHOO
Thanks for all the help

HAPPY BIRTHDAY!!

3. Originally Posted by TaoWine
Hello
Here's a question:
Let X have a continuous uniform distribution on the interval [a,b]. Find the density function for this dristribution and then verify that $\mu = \frac{(a + b)}{2}$ and $\sigma^2 = \frac{(b - a)^2}{12}$ .
ok
So here's what I "think" I should do ...

Let f(x) = 1/(b-a) = 1 assuming that a=0 and b=1
For a <= x <= b

I know I need to integrate, but I'm not sure how to set up the problem
$\mu = E(x) = \int xf(x)dx$ where f(x) = 1
then
$\int xdx = \frac{1}{2}x^2$ which equals 1/2 when pluging in [a.b]
Verifying ...
$\mu = \frac {(a+b)}{2}$ you get $\mu = \frac {(0+1)}{2} = \frac {1}{2}$

and then we have $\sigma^2$

$\sigma^2 = E((x-\mu)^2) = \int (x-\mu)^2f(x)dx$
so ...
$\int (x-\frac{1}{2})^2dx = \int x^2-x+\frac{1}{4}dx = \frac{x^3}{3}-\frac{x^2}{2}+\frac{x}{4}$
When you plug in the interval [0,1] you get $\frac{1}{12}$
verifying $\mu^2$ You also get $\frac{1}{12}$

Is this correct? wow, that was long, sorry, I just tried to do it myself without any help at first. Be nice to me, it's my first post and it's also my birthday! WOOHOO
Thanks for all the help
I was looking forward to seeing what Jhevon had to say. Unfortunately, what I saw was at variance with my expectation .

Here is my birthday present to you, TaoWine:

The pdf of X is $f(x) = \frac{1}{b-a}$ for $a \leq x \leq b$ and zero elsewhere.

Then

$\mu = E(X) = \int_{-\infty}^{+\infty} x f(x) \, dx = \int_{a}^{b} \frac{x}{b-a} \, dx = \frac{1}{b-a} \int_{a}^{b} x \, dx$

$= \frac{1}{b-a} \left ( \frac{b^2 - a^2}{2} \right) = \frac{1}{b-a} \left ( \frac{(b - a)(b+a)}{2} \right) = \frac{b+a}{2}$.

By symmetry this expectation is totally expected .

I leave you to find:

1. $E \left( X^2 \right)$.

2. $\sigma^2 = Var (X) = E (X^2) - \left [ E(X) \right]^2$.

4. Originally Posted by mr fantastic
I was looking forward to seeing what Jhevon had to say. Unfortunately, what I saw was at variance with my expectation .
puns intended

i'm not the probability guy, so i don't even try sorry to disappoint you

5. Originally Posted by TaoWine
Hello
Here's a question:
Let X have a continuous uniform distribution on the interval [a,b]. Find the density function for this dristribution
Mr Fantastic has told you what the density function is and finished the question, but you are asked to find it, so you need to observe that:

X has a continuous uniform distribution on the interval [a,b]

Means that the pdf of $X$ is a constant on $[0,1]$ and zero everywhere else. So let the pdf of $X$ be:

$f(x)=\left\{ c\ x \in [a,b] \atop 0\ {\rm{otherwise}} \right.$.

To be a pdf we require that the integral of this over $\mathbb{R}$ be $1$. So:

$
\int_{-\infty}^{\infty}f(x)\;dx= \int_{a}^{b}c\;dx=cb-ca=1
$

Hence:

$c=\frac{1}{b-a}$

RonL

6. Jhevon, thanks for the birthday message

mr fantastic, I can't thank you enough, I was able to get the second answer to that question at 4:00am this morning while I was working.

CaptainBlack, also a big thanks!

You guys Rock! Take care everyone