# Interquartile range of random continuous variable

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.

• You want $\arctan(3/4)-\arctan(1/4)$. – André Nicolas Jan 2 '16 at 7:56
• @AndréNicolas, why arctan (3/4) - arctan (1/4)? I did the definite integral of [tan x] at arctan (3/4) and arctan(1/4), so I did tan (arctan (3/4))- tan (arctan (1/4)). Please advise. – CCC Jan 2 '16 at 8:00

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$.