use Schwarz inequality to get $\int_x^{+\infty }f(t) dt \leq \frac{1}{1+x^2}$ $f(x)\ge 0,\forall x\in \Bbb R$. If
$$\int_{-\infty}^{+\infty}f(x) dx =1, \int_{-\infty}^{+\infty}xf(x) dx =0,\int_{-\infty}^{+\infty}x^2f(x) dx =1. $$
Show that , for every $x\gt0$,
$$\int_x^{+\infty }f(t) dt \leq \frac{1}{1+x^2}$$

I have a method: proof by contradiction
If $a\gt0$ such that $\int_a^{+\infty }f(t) dt \gt \frac{1}{1+a^2}$, then
$$ \int_{a}^{+\infty}xf(x) dx \gt \dfrac{a}{1+a^2},\int_{a}^{+\infty}x^2f(x) dx \gt\frac{a^2}{1+a^2}. $$
so
$$\int_{-\infty}^a f(x) dx \lt -\dfrac{a^2}{1+a^2}, \int_{-\infty}^a xf(x) dx \lt -\dfrac{a}{1+a^2},\int_{-\infty}^a x^2f(x) dx \lt\frac{1}{1+a^2}. $$
$$ \int_{-\infty}^a (ax+1)^2f(x) dx \lt a^2 \frac{1}{1+a^2}-2a\frac{a}{1+a^2}+\frac{a^2}{1+a^2}=0. $$
I heard that the inequality is related to probability theory，and it can't be improved, how to cite a function to get this?  Are there any other methods, use Schwarz inequality?
 A: What does this have to do with probability?
It is true that this falls under the realm of probability theory, because if $X$ is a real valued random variable with density $f(x)$ i.e. $P(X \in (a,b)) = \int_a^b f(x)dx$ for all $a<b$, then :

*

*$\int_{-\infty}^{\infty} f(x)dx = 1$ and $f(x) \geq 0$ assert that $f$ is a well-defined density and $X$ a well defined random variable.


*$\int_{-\infty}^\infty xf(x)dx = 0$ is equivalent to $E[X] = 0$.


*$\int_{-\infty}^{\infty} x^2f(x)dx = 1$ is equivalent to $E[X^2] = 1$,which when combined with the previous statement , gives $Var(X) = E[X^2] - E[X]^2 = 1-0=1$.


*$\int_{x}^{\infty} f(t)dt = P(X \geq x)$ for $x>0$, which we write as $P(X - E[X] \geq x)$ for reasons becoming clear later.


*$\frac{1}{1+x^2} = \frac{Var(X)}{Var(X)+x^2}$.
Thus, the inequality in probabilistic terms, is $P(X - E[X] \geq x) \leq \frac{Var(X)}{Var(X) + x^2}$ for every $x >0$.  This is called the Cantelli inequality. It is tight, by using the random variable $X$ given by a Bernoulli random variable with any parameter $p$, and taking its density.
A proof without using the Cauchy-Schwarz inequality
I will translate the probabilistic proof into a proof without such  terminology. Fix $f$ and $x >0$. We have , for any $u \geq 0$ :
$$
\int_{x}^\infty f(t)dt \leq \int_x^\infty f(t)dt + \int_{-\infty}^{-x} f(t)dt \\= \int_{x+u}^\infty f(t-u)dt + \int_{-\infty}^{-x-u} f(t-u)dt
$$
and now we introduce $x+u$ into both integrals. By domination , since $\frac{t^2}{(x+u)^2} \geq 1$ for every $|t| \geq x+u$:
$$
\int_{x+u}^\infty f(t-u)dt \leq \frac{1}{(x+u)^2} \int_{x+u}^{\infty} t^2f(t-u)dt \\
\int_{\infty}^{-x-u} f(t-u)dt \leq \frac{1}{(x+u)^2} \int_{-\infty}^{-x-u} t^2f(t-u)dt
$$
and adding them gives:
$$
\int_{x+u}^\infty f(t-u)dt + \int_{-\infty}^{-x-u} f(t-u)dt\\ \leq \frac{1}{(x+u)^2} \int_{x+u}^{\infty} t^2f(t-u)dt + \frac{1}{(x+u)^2} \int_{-\infty}^{-x-u} t^2f(t-u)dt \\
\leq \frac 1{(x+u)^2} \int_{-\infty}^{\infty} t^2f(t-u)dt =\int_{-\infty}^{\infty} (t+u)^2f(t)dt
 $$
which upon expansion and simplification becomes $$
\int_x^\infty f(t)dt \leq \frac{1 + u^2}{(x+u)^2}
$$
for every $u \geq 0$. So the best bound is when the right hand side is minimized i.e. the $u \geq 0$ for which $\frac{1+u^2}{(x+u)^2}$ is minimal. This can be done e.g. using differentiation : differentiating w.r.t $u$ gives $\frac{2(xu-1)}{(x+u)^3}$, which is zero when $u=\frac 1x$. One can check the second derivative is positive at this point. At $u = \frac 1x$ we have $\frac{1 + u^2}{(x+u)^2} = \frac{1}{1+x^2}$ , as desired.
A proof using the Cauchy Schwarz inequality
The Cauchy-Schwarz (-Буняковский) inequality, in the context of integrals, states that :

If $f,g$ are square-integrable functions on $(a,b)$ for any $a<b$ possibly infinite, then $fg$ is integrable on $(a,b)$ and $$
\left|\int_{a}^{b} f(x)g(x)dx \right| \leq \sqrt{\int_{a}^b f(x)^2dx} \sqrt{\int_{a}^{b} g(x)^2dx}
$$

To use this correctly, we must play around a little with the start, use Cauchy-Schwarz, and then correct the changes.
So let's start with $f$ as in the question and $x>0$. Our intuition for the change of variable in the next step is derived from the previous proof : recall the minimizer $\frac 1x$.
We write :
$$
\int_{x}^\infty f(t)dt = \int_{x+\frac 1x} f\left(t - \frac 1x\right)dt \\
\leq \int_{x+\frac 1x}^\infty f\left(t-\frac 1x\right)\frac{t}{x + \frac 1x} dt 
$$
where the inequality follows because $\frac{t}{x+\frac 1x} \geq 1$ whenever $t \geq x + \frac 1x$, so a domination of integrand occurs.
Finally, for the Cauchy Schwarz split :
$$
\int_{x+\frac 1x}^\infty f\left(t-\frac 1x\right)\frac{t}{x + \frac 1x} dt  = \int_{x+\frac 1x}^{\infty} \left[t\sqrt{f\left(t-\frac 1x\right)}\right]\left[\frac{\sqrt{f(t-\frac 1x)}}{(x+\frac 1x)}\right] dt
$$
applying it (on the second line : the first line is just what we know from before) :
$$
\int_{x}^\infty f(t)dt \leq \int_{x+\frac 1x}^\infty f\left(t-\frac 1x\right)\frac{t}{x + \frac 1x} dt \\ \leq \sqrt{\int_{x+\frac 1x}^{\infty} t^2f\left(t-\frac 1x\right)dt}\sqrt{ \int_{x+\frac 1x}^{\infty} \frac{f\left(t - \frac 1x\right)}{(x+\frac 1x)^2}dt}\\ = \frac 1{x+\frac 1x} \sqrt{\int_{x}^\infty (t +1/x)^2 f(t)dt} \sqrt{\int_x^\infty f(t)dt}
$$
take the $\sqrt{\int_x^\infty f(t)dt}$ to the other side and square both sides to get :
$$
\int_x^\infty f(t)dt \leq \frac{\int_{x}^{\infty} (t+\frac 1x)^2f(t) dt}{(x+\frac 1x)^2} \leq \frac{\int_{-\infty}^{\infty} (t+\frac 1x)^2 f(t)dt}{(x+\frac 1x)^2}
 \\
= \frac 1{(x+\frac 1x)^2} \left(1 + \frac 1{x^2}\right) = \frac 1{1+x^2}$$
after simplification, as desired.
