Let $F$ be the set of all continuous functions $f : [1, 3] \to [-1, 1]$ such that $\int_{1}^{3} f(x) = 0.$ Then, find $$ \sup \int_{1}^{3} \frac{f(x)}{x} dx,$$ where $f \in F$.
Now, my first thought was to try Cauchy - Schwarz inequality, but it can only be applied when all terms are positive, but $f(x)$ is not always positive. Then, I tried to bound $f(x)$ using range of $f$. So, $ -1 \le f(x) \le 1, \forall x \in [1,3] \implies \frac{-1}{x} \le \frac{f(x)}{x} \le \frac{1}{x}, \forall x \in [1,3]$. We can multiply with $\frac{1}{x}$ since it is defined in the domain $[1,3]$.
Then, we integrate, which we can, since all three of them are integrable on $[1,3]$. Since we need to find an upper bound we can ignore the left inequality and proceed as follows:
$$\int_{1}^{3} \frac{f(x)}{x} dx \le \int_{1}^{3} \frac{1}{x} dx = \ln3.$$ Now, I have no idea how to show it is the least upper bound (I tried using the definition of LUB, assuming another arbitrary upper bound and showing that $\ln3$ is smaller, but it didn't work). Also, I suspect it may not be the LUB at all.
Where am I going wrong?
$g(x) = \int_1^x f(t) \, dt$ satisfies $g(1) = g(3) = 0$, so that integration by parts gives $$ \int_1^3 \frac 1x f(x) \, dx = \int_1^3 \frac 1{x^2} g(x) \, dx \, . $$ Also $|f(x)| \le 1$ implies $|g(x)| \le x-1$ and $|g(x)| \le 3-x$, so that an upper bound is $$ \int_1^3 \frac 1{x^2} |g(x)| \, dx \le \int_1^2 \frac{x-1}{x^2} \, dx + \int_2^3 \frac{3-x}{x^2} \, dx = \ln \left(\frac 43\right) \, . $$
As already said in the comments, you can find continuous functions close to the step function $$ f(x) = \begin{cases} 1 & \text{ for } 1 \le x < 2 \\ -1 & \text{ for } 2 \le x < 3 \end{cases} $$ to show that this is the least upper bound.