The sum of two nonnegative numbers is 36. Find the numbers if the difference of their square roots is a maximum.
$x + y = 36$ and
$S = \sqrt{x} - \sqrt{y}$
I keep coming up with X = 18 which gives me 0 in the 2nd derivative test but it is not a solution when substituted back into the 1st derivative. Is x = 18 therefore not a solution and there is no solution?

Let $x\ge y$. You need to find $x$ such that $$\sqrt x-\sqrt {36-x}$$is maximum. To do that by differentiating we obtain $$\dfrac{1}{2\sqrt x}-\dfrac{1}{2\sqrt {36-x}}=0$$which gives us $x=18$. But still two more candidates can be found on the boundaries where $(x,y)=(36,0)$ or $(x,y)=(0,36)$ therefore $$x=36\\y=0$$is the correct answer where $S=6$ at its maximal value.