How prove this similar Hilbert inequality

Question: let $a_{i},(i=1,2,\cdots,n)$ be real number,show that $$\sum_{i,j=1}^{n}\dfrac{a_{i}a_{j}}{\max{(i,j)}}\le 4\sum_{i=1}^{n}a^2_{i}\tag{1}$$

Hilbert's Inequality:

For any real numbers $a_1,a_2\cdots,a_n$ the following inequality holds: $$\sum_{i=1}^n\sum_{j=1}^n\frac{a_ia_j}{i+j}\leq\pi\sum_{i=1}^na_i^2$$.

Proof: I was reading a proof of this inequality where first they applied Cauchy Schwarz to get $$(\sum_{i=1}^n\sum_{j=1}^n\frac{a_ia_j}{i+j})^2\leq(\sum_{i=1}^n\sum_{j=1}^n\frac{\sqrt{i}a_i^2}{\sqrt{j}(i+j)})(\sum_{i=1}^n\sum_{j=1}^n\frac{\sqrt{j}a_j^2}{\sqrt{i}(i+j)})$$.

Then they stated that it suffices to prove $$\sum_{n=1}^{\infty}\frac{\sqrt{m}}{(m+n)\sqrt{n}}\leq\pi$$ for any positive integer $m$. and $$\displaystyle\sum_{n=1}^\infty\,\frac{\sqrt{m}}{(m+n)\sqrt{n}}<\int_0^\infty\,\frac{\sqrt{m}}{(m+x)\sqrt{x}}\,\text{d}x=\Bigg.\Bigg(2\arctan\left(\sqrt{\frac{x}{m}}\right)\Bigg)\Bigg|_{x=0}^{x=\infty}=\pi$$

But for $(1)$ I think use integral to solve it,can you help?

• I don't understand your question. Is your problem finding a primitive function for the integral? – Steven Van Geluwe Apr 29 '18 at 15:25

The approach for the proof of your version is exactly the same, the constant $4$ is optimal and it comes from $$\int_{0}^{+\infty}\frac{dz}{\max(1,z)\sqrt{z}}=4.$$
A different proof: It's not hard to show that it's sufficient to prove the continuous version $$\int_0^\infty\int_0^\infty\frac{f(x)f(y)}{\max(x,y)}dxdy\le 4||f||_2^2$$for $f\in L^2((0,\infty))$. Assume $f\ge0$.
Note first that if $\lambda>0$ then $$\left(\int_0^\infty(f(r^2\lambda^2))^2r\,dr\right)^{1/2}=\frac1{\sqrt 2\lambda}||f||_2\quad(*).$$
Take the integral above, apply a slight change of variables, convert to polar coordinates, apply Cauchy-Schwarz and (*) on each ray: \begin{aligned}\int_0^\infty\int_0^\infty\frac{f(x)f(y)}{\max(x,y)}dxdy &=4\int_0^\infty\int_0^\infty\frac{xy}{\max(x^2,y^2)}f(x^2)f(y^2)dxdy \\&=4\int_0^{\pi/4}\int_0^\infty\frac{\cos(\theta)\sin(\theta)}{\max(\cos^2(\theta),\sin^2(\theta))}f(r^2\cos^2(\theta))f(r^2\sin^2(\theta))r\,drd\theta \\&\le 2||f||_2^2\int_0^{\pi/2}\frac{d\theta}{\max(\cos^2(\theta),\sin^2(\theta))} \\&=4||f||_2^2\int_0^{\pi/4}\frac{d\theta}{\cos^2(\theta)} \\&=4||f||_2^2.\end{aligned}