Maximizing an integral A function $$f:\mathbb{R}\rightarrow [-1,1]$$, has its integral vanish over the interval $x\in[1,3]$.
Find the maximum value of the integral $$\displaystyle\int_{1}^{3}\dfrac{f(x)}{x}\mathrm{d}x$$ 
I tried to throw the Euler-Lagrange equation at this functional but got some non-sensical condition that said $x=\mathrm{constant}$.
My teacher gave a non constructive proof that f is actually a non-continuous function, and proved the upper bound.
My question is:


*

*What does this condition mean?  What should you do in the case the EL equation yields no function?

*Is there any motivation for considering a discontinuous function?

 A: There are three constraints on $f$, $-1 \le f(x) \le 1$ and $\int f = 0$. This combination of constraints makes this slightly different than a classical optimal control setting.
Intuitively, since $x \mapsto {1 \over x}$ is decreasing, we expect $f$ to have value
$+1$ and then transition to $-1$. Since we have the zero average constraint the transition would occur at $t=2$.
Let $f^*$ be $1$ on $[1,2]$ and $-1$ on $(2,3]$ and let $f$ satisfy the constraints. We have $\int_1^2 f+ \int_2^3 f = 0$ and $\int_1^2 f^*+ \int_2^3 f^* = 0$, so
$\int_1^2 (f^*-f) = -\int_2^3 (f^*-f) $, or equivalently $\int_1^2 (1-f) = \int_2^3 (1+f)$.
Since ${1 \over x} \ge {1 \over 2} \ge {1 \over y}$ for $x \in [1,2], y \in [2,3]$, we have
$\int_1^2 {(1-f(x)) \over x}dx \ge \int_1^2 {(1-f(x)) \over 2}dx = \int_2^3 {(1+f(x)) \over 2}dx \ge \int_2^3 {(1+f(x)) \over x}dx$ from which we get
$\int_1^3 {f^*(x) \over x} dx  \ge \int_1^3 {f(x) \over x} dx $.
Alternative: 
Here is a slightly different approach that might offer some more intuition (or just moves the complication somewhere else).
Let $C= \{f:[1,3]\to [-1,1] | f \text{ is measurable}, \int f = 0 \}$, and consider $C \subset L^2[1,3]$. It is straightforward to show that $C$ is convex & compact (in $L^2$) and the function $c(f)= \int_1^3 {f(x) \over x}dx$ is continuous and linear. 
Hence there is a minimiser $f^*$ because of compactness.
Finally, we can show that if $f \in C$, then if the measure of $\{ x \in [1,2]  |f(x) < 1 \}$ is non zero, there is some $f' \in C$
such that $c(f') > c(f)$. Hence the function $1_{[1,2]}-1_{(2,3]}$ (or any ae. equivalent function) is a minimiser.
Another way of doing this would be to note that since $c$ is linear, we can take 
a minimiser $f^*$ to be an extreme point of $C$ and we can show that the extreme points of $C$ are the measurable zero average functions that satisfy $f(x) \in \{-1,+1\}$ for ae. $x$. In particular, you can see a simple form of a 'bang bang' control, and the problem reduces to determining the 'on set' (where $f(x) = 1$).
