Find probability of uniform distribution over interval [a, b] I am solving a uniform distribution with no real number value given to the interval. Therefore, I would like to seek comments for idea of problem solving. My question is in below:
Let  $X$  be a random variable with a uniform distribution over $[a,b]$, i. e. $X$ has a pdf given by:
$$
f(x)=
\begin{cases}
\tfrac{1}{b-a}\quad \text{for }a\leq x\leq b,\\
 0 \qquad\qquad\;\, \text{otherwise},
\end{cases}
$$
Let $\mu$ $= E(X)$ and $\sigma$ the standard deviation of $X$
Find:
a. $\quad {\mathrm Pr}( \mu-\sigma \;<\; X \;<\; \mu+\sigma ) \;\;\;\;$
b. $\quad {\mathrm Pr}( \mu-2\sigma \;<\; X \;<\; \mu+2\sigma ) \;\;\;\;$
My understanding of this question are in below:

*

*$\mu$ $= E(X) = \tfrac{a+b}{2}$

*$Var(X) = \tfrac{{(b-a)}^{2}}{12}$

*$\sigma = \tfrac{b-a}{\sqrt{12}}$

*$2\sigma = 2* \tfrac{b-a}{\sqrt{12}}$
My questions are in below:

*

*With no real number value given in interval $[a,b]$, how to calculate $\mu\pm\sigma$ and $\mu\pm2\sigma$?

*Also with no real number value given in interval $[a,b]$, how can we plug it into $f(x)$ to calculate the probability?

 A: The two questions are special cases of $P(\mu-k\sigma\le X\le \mu+k\sigma)$, for $k\in\mathbb R,$ where $X\sim\text{Uniform}(a,b)$.
Note that $[\mu-\sigma\sqrt{3},\mu+\sigma\sqrt{3}]=[a,b],$ so
$$k\gt\sqrt{3}\implies[\mu-k\sigma,\mu+k\sigma]\supset[a,b]\\
k\le\sqrt{3}\implies[\mu-k\sigma,\mu+k\sigma]\subseteq[a,b].$$
Therefore,
$$P(\mu-k\sigma\le X\le \mu+k\sigma)=\begin{cases}
0&\text{if }k<0\\[1ex]
{2k\sigma\over b-a}={k\over\sqrt{3}}&\text{if }0\le k\le\sqrt{3}\\[1ex]
1&\text{if }k\gt\sqrt{3} \end{cases}\tag{1}$$
This result for $k<0$ is self-evident, and the result for $0\le k\le\sqrt{3}$ follows because in that case $[\mu-k\sigma,\mu+k\sigma]\subseteq[a,b]$, and for a uniform distribution the probability of a subinterval of the support is just the length of the subinterval divided by the length of the support. The result for $k>\sqrt{3}$ follows because in that case $[\mu-k\sigma,\mu+k\sigma]\supset[a,b]$.
Note that since (1) happens to be a CDF as a function of $k$ and is equal to $P\left(\left|X-\mu\over\sigma\right|\le k\right)$, we have shown that $\left|X-\mu\over\sigma\right|\sim\text{Uniform}(0,\sqrt{3}).$
A: You correctly wrote your uniform density. Moreover, remember (you can easy calculate it) that
$$F_X(x)=\frac{x-a}{b-a}$$
thus
$$\begin{align}
\mathbb{P}[\mu-\sigma<X<\mu+\sigma]&=F_X(\mu+\sigma)-F_X(\mu-\sigma)\\
&=\frac{\mu+\sigma-a}{b-a}-\frac{\mu-\sigma-a}{b-a}\\
&=\frac{2\sigma}{b-a}\\
&=\frac{1}{\sqrt{3}}
\end{align}$$
... and similarly the second question
