[Math] Interquartile range of random continuous variable

probability

If the continuous variable X has a probability density function

$$
f(x) = \begin{cases} \sec^2 x, & 0<x<\dfrac\pi4, \\[8pt] 0, & \text{otherwise,} \end{cases}
$$

find the interquartile range of X.

This question was also previously posted before, however, according to the Mathematics Stackexchange rules, I cannot pose a question in someone else's answer, so that's why I am asking it again here, sorry for the duplication.

What I have done so far is that I have calculated that the top bound should be $arctan \frac14$ and upper bound should be $arctan \frac34$, but integrating $sec^2$, I would get tan x and if I calculate the integral, it will end up being $0.75-0.25=0.5$, which is wrong as the answer given is $0.399$.

Can anyone suggest where I went wrong? And apologies for any wrong tags or title.

Best Answer

Let $X$ be a random variable, with cumulative distribution function $F(x)$. "The" third quartile $q_3$ has the property that $F(q_3)=3/4$. The first quartile $q_1$ has the property that $F(q_1)=1/4$. The interquartile range is $q_3-q_1$.

In our case, for $x$ between $0$ and $\pi/4$ we have $F(x)=\int_0^x \sec^2 t \,dt=\tan x$.

So $q_3$ has the property that $\tan(q_3)=3/4$, and $q_3$ is in $(0,\pi/4)$. Thus $$q_3=\arctan(3/4).$$ Similarly, $q_1=\arctan(1/4)$ and $q_3-q_1=\arctan(3/4)-\arctan(1/4)$. The Google calculator says this is about $0.3985$.

Related Question