Proving $\int_0^1\frac{\vert f(x)\rvert^2}{x^2}\,\mathrm dx\le4\int_0^1{\vert f'(x)\rvert^2}\,\mathrm dx$ when $f\in\mathcal C^1([0,1])$ and $f(0)=0.$ Let us assume $f \in \mathcal{C}^1([0,1])$ and $f(0)=0.$ Prove that $$\int_{0}^{1} \frac{\vert f(x) \rvert^2}{x^2}dx \le 4 \int_{0}^{1} {\vert f'(x) \rvert^2}dx.$$
By integrating by parts I obtained the following 
$$\int_{0}^{1} \frac{\vert f(x) \rvert^2}{x^2}dx = -\frac{1}{x} \lvert f(x) \rvert^2\Big|_0^1+2\int_{0}^{1} \frac{f(x)|f'(x)|}{x |f(x)|} \le 2\int_{0}^{1} \frac{|f'(x)|}{x } $$
but I'm not sure of the result and its usefulness, it's easy Calculus, but I can't go on. Any suggestions?
 A: Similar to Robert Z's answer, but with a bit of simplification
$$
\begin{align}
\int_0^1\frac{f(x)^2}{x^2}\,\mathrm{d}x
&=\int_0^1\frac2{x^2}\int_0^xf(t)\,f'(t)\,\mathrm{d}t\,\mathrm{d}x\tag{1}\\
&=\int_0^1f(t)\,f'(t)\int_t^1\frac2{x^2}\,\mathrm{d}x\,\mathrm{d}t\tag{2}\\
&=2\int_0^1f(t)\,f'(t)\left(\frac1t-1\right)\mathrm{d}t\tag{3}\\
&\le2\int_0^1|f(t)|\,|f'(t)|\,\frac1t\,\mathrm{d}t\tag{4}\\
&\le2\left[\int_0^1\frac{f(t)^2}{t^2}\,\mathrm{d}t\int_0^1f'(t)^2\,\mathrm{d}t\right]^{1/2}\tag{5}
\end{align}
$$
Explanation:
$(1)$: $f(x)^2=f(x)^2-f(0)^2=2\int_0^xf(t)\,f'(t)\,\mathrm{d}t$
$(2)$: change order of integration
$(3)$: integrate in $x$
$(4)$: $0\le\frac1t-1\le\frac1t$ on $[0,1]$
$(5)$: Cauchy-Schwarz
Divide $(5)$ by $\left(\int_0^1\frac{f(x)^2}{x^2}\,\mathrm{d}x\right)^{1/2}$ and square to get
$$
\int_0^1\frac{f(x)^2}{x^2}\,\mathrm{d}x\le4\int_0^1f'(t)^2\,\mathrm{d}t\tag{6}
$$

Variational Approach and Proof of Sharpness
Maximize
$$
\int_0^1\frac{f(x)^2}{x^2}\,\mathrm{d}x\tag{7}
$$
under the constraint that
$$
\int_0^1f'(x)^2\,\mathrm{d}x=1\tag{8}
$$
That is, find the $f$ so that
$$
0=\int_0^1\frac{f(x)\,\delta f(x)}{x^2}\,\mathrm{d}x\tag{9}
$$
for every $\delta f(x)$ so that
$$
\begin{align}
0
&=\int_0^1f'(x)\,\delta f'(x)\,\mathrm{d}x\\
&=-\int_0^1f''(x)\,\delta f(x)\,\mathrm{d}x\tag{10}
\end{align}
$$
which requires that there is a $\lambda$ so that $f''(x)=\lambda\frac{f(x)}{x^2}$ which is satisfied by $x^\alpha$. Plugging in $f(x)=\frac{\sqrt{2\alpha-1}}\alpha x^\alpha$ gives
$$
\begin{align}
\int_0^1f'(x)^2\,\mathrm{d}x
&=\frac{2\alpha-1}{\alpha^2}\int_0^1\alpha^2x^{2\alpha-2}\,\mathrm{d}x\\
&=\frac{2\alpha-1}{\alpha^2}\frac{\alpha^2}{2\alpha-1}\\[6pt]
&=1\tag{11}
\end{align}
$$
and
$$
\begin{align}
\int_0^1\frac{f(x)^2}{x^2}\,\mathrm{d}x
&=\frac{2\alpha-1}{\alpha^2}\int_0^1x^{2\alpha-2}\,\mathrm{d}x\\
&=\frac{2\alpha-1}{\alpha^2}\frac1{2\alpha-1}\\
&=\frac1{\alpha^2}\tag{12}
\end{align}
$$
Thus, the critical functions, $f(x)=\frac{\sqrt{2\alpha-1}}{\alpha}x^\alpha$, have a constant of $\frac1{\alpha^2}$. This seems to indicate that we can't bound $\int_0^1\frac{f(x)^2}{x^2}\,\mathrm{d}x$ by any multiple of $\int_0^1f'(x)^2\,\mathrm{d}x$ until we notice that for the integrals to converge, we need $\alpha\gt\frac12$. This gives the constant of $4$ as in the question. In fact, this shows that $4$ cannot be improved.
A: You have almost done it with your integration by parts attempt, just missing one simple last step. Again as you started was
\begin{align}
I&=\int_0^1\frac{f(x)^2}{x^2}\,dx=\underbrace{-\frac{f(x)^2}{x}\Bigg|_0^1}_{\le 0}+2\int_0^1\frac{f(x)}{x}f'(x)\,dx\le
2\int_0^1\frac{f(x)}{x}f'(x)\,dx\le\\
&\le 2\left(\int_0^1\frac{f(x)^2}{x^2}\,dx\right)^{1/2}\left(\int_0^1 f'(x)^2\,dx\right)^{1/2}=2\sqrt{I}\left(\int_0^1 f'(x)^2\,dx\right)^{1/2}.
\end{align}
Now divide by $\sqrt{I}$ and square all.
A: We have that
$$
\int_0^1 \frac{f^2(x)}{x^2}dx
=\int_0^1\frac{1}{x^2}\left(\int_0^x2f(t)f'(t)dt\right) dx\\ 
=2\int_0^1f(t)f'(t)\left(\int_t^1\frac{dx}{x^2} dx\right) dt\\ 
=2\int_0^1f'(t)\cdot \left(\frac{f(t)}{t}(1-t)\right)dt.
$$
Then by Cauchy-Schwarz inequality, 
$$\left(\int_0^1f'(t)\cdot \left(\frac{f(t)}{t}(1-t)\right)dt\right)^2
\leq \int_0^1(f'(t))^2 dt \cdot \int_0^1
 \frac{f^2(t)}{t^2}(1-t)^2dt\\
\leq \int_0^1(f'(t))^2 dt \cdot \int_0^1
 \frac{f^2(t)}{t^2}dt,$$
where we used also the fact that $0\leq (1-t)^2\leq 1$ for $t\in[0,1]$.
Hence
$$\left(\int_0^1 \frac{f^2(x)}{x^2}dx\right)^2\leq 4\int_0^1(f'(t))^2 dt \cdot \int_0^1
 \frac{f^2(t)}{t^2}dt$$
which implies that
$$\int_0^1 \frac{f^2(x)}{x^2}dx\leq 4\int_0^1(f'(t))^2 dt.$$
P.S. The costant $4$ is optimal: take $f(x)=x^{1/2+1/n}$ then
$$\int_0^1 \frac{f^2(x)}{x^2}dx=\frac{n}{2}
\quad\mbox{and}\quad\int_0^1(f'(x))^2 dx=\frac{(n+2)^2}{8n}.$$
Therefore
$$\lim_{n\to+\infty}\frac{\frac{n}{2}}{\frac{(n+2)^2}{8n}}=4.$$
