# Finding upper bound using Cauchy-Schwarz inequality.

I am learning about the Cauchy-Schwarz inequality and I cam across this question:

Consider the function $$f(x) = \frac{(x+k)^2}{x^2 +1}$$ where $$k>0$$ and $$x$$ is a real number. Show that $$f(x)\leq k^2 +1$$ for all $$x$$ and $$k>0$$ using the Cauchy-Schwarz inequality.

I have tried to use the integral definition of the inequality but that got me no where. I am not very versed with using mathematical induction yet either, but I can understand proofs that use it. I proved this at first by using calculus and then showing that the maximum was less than $$k^2 + 1$$, but I want to know how to use C-S inequality to solve this problem.

$$(1,x)\cdot(k,1)=x+k,\hbox{ thus}$$ $$(x+k)^2= ((1,x)\cdot(k,1))^2\le (1,x)^2\cdot (1,k)^2=(1+x^2)\cdot (1+k^2)$$ P.S. inequality is in vector form with dot product $$|(\mathbf{u}\cdot \mathbf{v})|\le |\mathbf{u}|\cdot|\mathbf{v}|$$.