Find the maximum value of the $f(x) = \sqrt {8x - x^2} - \sqrt {14x - x^2 - 48}$.

The domain of the function is $6\le x \le 8$. With derivative you obtain max and min in $(6,8)$ but then you must calculate the function on the boudaries. In this case $x=6,4$ is a local point where $f'(x)=0$ but it is not the max because $f(6)>f(6,4)$.

$f(6)=\sqrt 12 = 2\sqrt3$ and $2+3=5$.

The function in $x=6$ is defined but its slope is infinite (tangent line in $x=6$ is vertical and you can think the angular coefficient as infinite).


Way better Solution

Let's consider the two circles $$(x-4)^2+y^2 = 16$$ $$(x-7)^2 + y^2 = 1$$

We need to find the maximum $y$ displacement possible for a given $x$ between these two, which would occur at $x = 6$ as obvious from drawing these circles

From the geometry, you can also deduce the range of x for which you will get a real output. As one can see, only for $6 \le x \le 8$ does the function actually return a value of $y$, as the smaller circle only extends that much