Find maximum value of $\int_{1}^3\frac{f(x)}{x}dx$ if $\int_{1}^{3}f(x)dx=0$ and also $-1\leq f(x)\leq 1$ Let $f$ be function such that $$\int_{1}^{3}f(x)dx=0$$ and $$-1\leq f(x)\leq 1$$ Then find the maximum value of $$\int_{1}^{3}\frac{f(x)}{x}dx$$
My Attempt:
I wonder if this approach is correct or not.
Let $$f(x)=\begin{cases} -c, 1\le x\le a \\ 1, a\le x<3 \end{cases}$$
As per the constraint $$c=\frac{3-a}{a-1}$$
Let $$G(a)=\int_{1}^{3}\frac{f(x)}{x}dx=\int_{1}^{a}\frac{-c}{x}dx+\int_{a}^{3}\frac{1}{x}dx=\frac{2}{1-a}\ln a+\ln 3$$
$$G'(a)=\frac{1-a+a\ln a}{a(1-a)^2}$$
After putting $G'(a)=0$ 
I am not able to solve for $a$

This was an exercise in the 2014 Putnam and the trick is to write for a parameter $a>0$,
\begin{split}
\left\lvert\int_1^3 \frac{f(x)}x\,\mathrm dx\right\rvert &= \left\lvert\int_1^3\frac{f(x)}x\,\mathrm dx -\int_1^3\frac{f(x)}a\,\mathrm dx\right\rvert\\
&=\left\lvert\int_1^3 f(x)\left(\frac1x-\frac1a\right)\,\mathrm dx\right\rvert \\
&\le\int_1^3 \lvert f(x)\rvert\left\lvert\frac1x-\frac1a\right\rvert\,\mathrm dx \\
&\le\int_1^3 \left\lvert\frac1x-\frac1a\right\rvert\,\mathrm dx \\
&=\ln\left(\frac{a^2}3\right)+\frac4a-2.
\end{split}
Minimizing the last expression with $a=2$ we get $$\left\lvert\int_1^3 \frac{f(x)}x\,\mathrm dx\right\rvert\le\ln(4)-\ln(3).$$
Equality is achieved for the function suggested by @Student in the comments: $f(x)=1$ on $[1,2]$ and $f(x)=-1$ on $[2,3]$.
