Calculate the probability that a particle in a one-dimensional box of length $a$ is found between 0 and $a / 2$.
The probability that the particle will be found between 0 and $a / 2$ is
$$
\operatorname{Prob}(0 \leq x \leq a / 2)=\int_0^{a / 2} \psi^*(x) \psi(x) d x=\frac{2}{a} \int_0^{a / 2} \sin ^2 \frac{n \pi x}{a} d x
$$
If we let $n \pi x / a$ be $z$, then we find

$$
\begin{aligned}
\operatorname{Prob}(0 \leq x \leq a / 2) & =\frac{2}{n \pi} \int_0^{n \pi / 2} \sin ^2 z d z=\frac{2}{n \pi}\left|\frac{z}{2}-\frac{\sin 2 z}{4}\right|_0^{n \pi / 2} \\
& =\frac{2}{n \pi}\left(\frac{n \pi}{4}-\frac{\sin n \pi}{4}\right)=\frac{1}{2} \quad \text { (for all } n \text { ) }
\end{aligned}
$$
Thus, the probability that the particle lies in one-half of the interval $0 \leq x \leq a$ is $\frac{1}{2}$.