0
$\begingroup$

Sorry, this is a question that I couldn't answer yet.

Let $f(x) = \frac{x}{x+5} $

I would like to find the median for $f(x)$ over the interval [0,5].

One way to find the median is to take the middle value of x over [0,5]. In my case, it would be 2.5. Hence, the median of $f(x)$ would be simply

$\frac{2.5}{7.5}= 0.33333$

Another possible solution would be:

$\frac{\textrm{50 percent of the area}}{\textrm{total area}}= \frac{\int_{0}^{m}\frac{x}{x+5} dx}{\int_{0}^{5} \frac{x}{x+5 }dx}=0.5$

In other words, the median for the function is found with the value m that gives 50% of the area on the interval [0,5]. We can find it iteratively. Using R, I have got:

$\frac{\textrm{50 percent of the area}}{\textrm{total area}}=\frac{0.767132}{1.534264} =0.5$.

The value m that gives 50% of the area is 3.303068. Hence, the median for the function would be:

$ \frac{3.303068}{3.303068+5} =0.397813$

Should both approaches give similar results? If not, which one would be correct?

Cheers!

Tyler

$\endgroup$
3
  • 1
    $\begingroup$ The problem is that in your case $f(x)$ is not a pdf, since $\int_0^5 f(x)\, dx =1.534 \neq 1$ $\endgroup$ Commented Feb 21, 2018 at 17:14
  • $\begingroup$ @callculus: I'm not sure that matters. You can always normalize $f(x)$ if you like. Think about finding the median of some random histogram - the area under the histogram is not likely to be $1$, unless you normalize it to be a frequency histogram. $\endgroup$ Commented Feb 21, 2018 at 17:19
  • $\begingroup$ Sure you can normalize it to get an pdf. But this is the first step you have to do. $\endgroup$ Commented Feb 21, 2018 at 17:26

3 Answers 3

1
$\begingroup$

The second one. However, you can compute it correctly: $$ \int_{0}^x \frac{t}{t+5}\mathrm{d}t=\frac{1}{2}\int_{0}^5 \frac{t}{t+5}\mathrm{d}t. $$ Now $$ \int_{0}^x \frac{t}{t+5}\mathrm{d}t=\int_{0}^x \left(1-\frac{5}{t+5}\right)\mathrm{d}t=x-5\int_0^x \frac{1}{t+5}\mathrm{d}t=x-5\log \frac{x+5}{5} $$ and in particular $$ \int_{0}^5 \frac{t}{t+5}\mathrm{d}t=5-5\log 2. $$ Hence $$ x-5\log \frac{x+5}{5}=\frac{1}{2}(5-5\log 2). $$ Make the substitution $x=5e^y-5$ so that $$ 5e^y-5-5y=\frac{5-5\log 2}{2} \implies e^y-y=\frac{3-\log 2}{2} $$ Set $z=-e^y$. Then the above can be rewritten as $$ -z-\log(-z)=\log\left(\frac{1}{ze^z}\right)=\frac{3-\log 2}{2} \implies ze^z=\mathrm{exp}\left(\frac{\log 2-3}{2}\right). $$ Hence $$ z=W\left(\mathrm{exp}\left(\frac{\log 2-3}{2}\right)\right) $$ so that $$ x=5e^y-5=-5(1+z)=5\left(1+W\left(\mathrm{exp}\left(\frac{\log 2-3}{2}\right)\right)\right). $$

Ps. Here $W$ is the Lambert W function.

$\endgroup$
1
$\begingroup$

Your second approach is correct, but you should be able to find an exact value, I should think. Letting $u=x+5$, we have $$\int_{a}^{b}\frac{x}{x+5}\,dx=\int_{a+5}^{b+5}\frac{u-5}{u}\,du=\left[u-5\ln|u|\right]|_{a+5}^{b+5}.$$ Can you finish?

$\endgroup$
0
$\begingroup$

The median of a function $f(x)$ over an interval $[a,b]$ is only sometimes equivalent to $f(\frac{a+b}{2})$. For example, if $f(x)$ is symmetric about $\frac{a+b}{2}$, then this relationship would be true. The definition of median is, as your second approach says, the value $a<c<b$ such that

$$ \frac{\int_a^c{f(x)dx}}{\int_a^b{f(x)dx}}=.50 $$

This assumes the appropriate restrictions of the function $f(x)$, such as continuity on the interval.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .