Range of a function

$\color{blue}\bf{Question}$ : Find the range of the function $f$ given by $f(x)=\sqrt{x}+\sqrt{1-x}$.

Solution: The domain of the given function is closed interval $[0,1]$. Since this function  $f$ is continuous on the  closed interval [0,1] , therefore it attains its bound (the greatest and least value), somewhere in the closed interval.

By Fermat’s theorem,  if a function attains its minimum or maximum at an interior point then the derivative at that point should either vanish or should be non-existant.

Now $f'(x)=\frac{1}{\sqrt{x}}-\frac{1}{\sqrt{1-x}}$.  Equating $f'(x)$ to zero, we get $x=\frac12$.
Thus $f(0)=1,f(1)=1,f(\frac12)=\frac{1}{\sqrt2}$ , and therefore the range of the function is closed interval $[1,\sqrt2]$.