# How to solve $\max_{f}\int_{0}^{\infty}f\left(x\right)dx$ subject to $\int_{0}^{\infty}xf\left(x\right)dx=x_{0}$?

How to find $\max_{f}\int_{0}^{\infty}f\left(x\right)dx$ subject to $\int_{0}^{\infty}xf\left(x\right)dx=x_{0}$, where $f$ is a function and $x_{0}$ is a constant?

-
What do you assume on these $f$? Integrability? – Davide Giraudo Feb 29 '12 at 11:27
I am sorry that I forgot to add any restrictions. Yes, $f$ should be integrable. In fact, it should be a probability density function. – amu Feb 29 '12 at 12:13
@amu: If $f$ is a probability density function, then by definition $\int_0^{\infty} f(x) dx \leq 1$, where equality should be easily achievable by some appropriate choice of $f$. – TMM Feb 29 '12 at 12:47

Case 1: No restrictions on $f$

Taking $f(x)$ as a huge Dirac delta function centered at some small $\epsilon > 0$ as $$f(x) = \frac{x_0}{\epsilon}\delta(x - \epsilon)$$ gives you $$\int_{0}^{\infty} x f(x) dx = x_0$$ as required, and $$\int_{0}^{\infty} f(x) dx = \frac{x_0}{\epsilon}.$$ Letting $\epsilon \to 0$ thus gives you that the maximum is unbounded (unless you are given more restrictions on $f$).

Case 2: $f$ is a probability density function

Then, by definition, $$\int_{0}^{\infty} f(x) dx \leq 1,$$ and taking $f(x) = \delta(x - x_0)$ achieves this bound. Note that this $f$ corresponds to a discrete random variable $X$ with $P(X = x_0) = 1$.

For extra insight, note that the question can be nicely formulated in terms of probabilities:

Find $\max_F (1 - F(0))$ subject to $E(X) = x_0$.

Then the solution $X \equiv x_0$ described above becomes even more obvious.

-
But the integral is from $0$ to $\infty$ rather than from $-\infty$ to $\infty$. – amu Feb 29 '12 at 12:17
@amu: The (shifted) Dirac delta function has no mass at any point apart from $0$ (shifted: $\epsilon$), so also integrating from $-\infty$ to $0$ adds $0$ to both integrals. – TMM Feb 29 '12 at 12:45
That's right! Thank you so much! – amu Mar 1 '12 at 12:08
@TMM, Really nice trick with the Dirac Delta. Any chance for assistance here: math.stackexchange.com/questions/1066495/… – Drazick Dec 14 '14 at 7:19

Since $f$ is a probability density function, $$\max_f \int_0^\infty f(x)\mathrm dx \leq \max_f \int_{-\infty}^\infty f(x)\mathrm dx = 1.$$ Since $x_0$ is necessarily a positive number, then for any positive random variable $$\int_0^\infty f(x)\mathrm dx = \int_{-\infty}^\infty f(x)\mathrm dx = 1$$ (since $f(x) = 0$ for $x < 0$) and so $\max_f \int_0^\infty f(x)\mathrm dx = 1$.

Or, did you mean to ask

What is $\max_f \max_{x\in (0,\infty)} f(x)$ over all probability density functions $f(x)$ such that $\int_0^\infty xf(x)\mathrm dx = x_0$ where $x_0$ is a finite positive constant?

in which case TMM's answer shows that $f$ can have arbitrarily large value.

-
I see. Thank you so much! – amu Mar 1 '12 at 12:10