Problem related to quadratic equation If $x$ is a real number then what is the greatest value of
  $$ f(x)=2(a-x)\left(x+\sqrt{x^2+b^2}\right)\;\;? $$ 
I cannot figure out how to convert this into a quadratic equation to find out the greatest value of $f(x).$
From what I've read, the answer is given by $a^2+b^2$.

let $\sqrt{x^2+b^2}+x=y,$ then $\displaystyle \sqrt{x^2+b^2}-x = \frac{b^2}{y}$ and $\displaystyle 2x=y-\frac{b^2}{y}$
$\displaystyle f(x) = (2a-2x)(x+\sqrt{b^2+y^2}) = (2a-y-\frac{b^2}{y})\cdot y = (2ay-y^2+b^2) $
$f(y)= (a^2+b^2)-(y-b)^2\leq (a^2+b^2)$ equality hold when $y=b$
