# Uniform Distribution: finding the probability between two variables

Q: In a uniform density $\mathcal{U}(a,b)$ with $a=-0.025$ and $b=0.025$, what is the probability that an error will be between 0.010 and 0.015?

A: From the density function, I didn't know how $d$ and $c$ (constants) were related to 0.010 and 0.015, $P(0.010 < X < 0.015)$.

I think that the answer is $\frac{b-a}{d-c}=\frac{.015 - .01}{.025+.025}= 0.1$

Would this be correct?

-
Yes, it is correct. The density function is $\frac{1}{0.025-(-0.025)}$ on our interval, and our probability is $0.015-0.010$ times the density. –  André Nicolas Mar 3 '13 at 20:52
ok thank you for the clarification. Should I remove this post? –  Ben Sewards Mar 3 '13 at 20:56
one more question. what if it was between -.012 and .012? This would add up to 0. how can this be –  Ben Sewards Mar 3 '13 at 20:57
I do not see why any reason to remove the post: you had a legitimate question, and showed your work. –  André Nicolas Mar 3 '13 at 20:57
okay sounds good –  Ben Sewards Mar 3 '13 at 20:59

Suppose that a random variable $X$ has (continuous) uniform distribution on the interval $[a,b]$. Then $X$ has density function $\frac{1}{b-a}$ on our interval, and $0$ elsewhere.
So if $a\le c\lt d\le b$, then $\Pr(c\le X\le d)=\dfrac{d-c}{b-a}$.
For the example in the post, we have $b-a=0.025-(-0.025)=0.05$ and $d-c=0.015-0.010=0.005$, so the probability is indeed $0.1$.
We would have to be a little careful if we were asked to compute, for example, $\Pr(0.01\le X\le 0.035)$. Since the density is $0$ past $0.025$, the probability would be the same as $\Pr(0.01\le X\le 0.025)$. This turns out to be $0.3$.