# How many local extrema points does the function $f(x) = \ln(1+\sqrt{|x|}-x)$ have?

I am given the following function:

$$f: D \rightarrow \mathbb{R} \hspace{2cm} f(x) = \ln \bigg (1 + \sqrt{|x|} -x \bigg )$$

where $$D$$ is the maximum domain of the function. I have to find the number of local extrema points of this function. What I did was to first make the function look a little cleaner by getting rid of the absolute value:

$$f(x) = \left\{ \begin{array}{ll} \ln(1 + \sqrt{x} - x) & \quad x \ge 0 \\ \ln(1 + \sqrt{-x}-x) & \quad x < 0 \end{array} \right.$$

I know that we have local extrema points where the derivative of the function is $$0$$ while the derivative approaching that point from right and left has opposite signs.

We can also have a local extremum in a point where the derivative does not exist (an example being the function $$h(x) = |x|$$). So naturally I found the derivative of the function:

$$f'(x) = \left\{ \begin{array}{ll} \ \dfrac{1-2\sqrt{x}}{2\sqrt{x}(1+\sqrt{x}-x)} & \quad x > 0 \\ \\ \dfrac{1-2\sqrt{-x}}{2\sqrt{-x}(1+\sqrt{-x}-x)} & \quad x < 0 \end{array} \right.$$

But I got stuck here. I don't know how to continue. What bothers me is that I do not know the domain $$D$$ and I don't know how can I find it. If I try to find the values of $$x$$ for which

$$f'(x)=0$$

I get $$x_0= \dfrac{1}{4}$$ and $$x_1 = -\dfrac{1}{4}$$, but if I look at the graph of the function: I can see that we don't have a local extremum point at $$x_1 = -\dfrac{1}{4}$$, even thought we do have a local extremum point at $$x_0 = \dfrac{1}{4}$$. By looking at the graph I also see that we have an extremum point at $$x = 0$$. I'm guessing that is because of the denominator of the derivative makes it such that the derivative is not defined at $$x=0$$, so we have an extremum point, but shouldn't we also take into consideration the values of $$x$$ for which the other term in the denominator of the derivative, $$(1+\sqrt{\pm x} - x)$$ is not defined? And how would we handle that? And how would I find that we have a local extremum point at $$x=0$$ analytically, without looking at the graph of the function? Also, isn't that point of the graph that is close to $$y=-35$$ also a local extremum point?

TL;DR: How can I find all the local extremum points of the given function without looking at the graph? The correct answer is $$2$$ (according to my textbook).

For a fraction to be zero, the numerator must be zero (with one caveat, discussed at the end of this paragraph). So you want to solve $$1 - 2 \sqrt{x} = 0 \text{,}$$ restricted to $$x > 0$$ and check each solution to see if it also makes the denominator zero. (If it does also make the denominator zero, take a limit approaching that potential solution to see what is really happening.)
This says $$\sqrt{x} = 1/2$$, so $$x = 1/4$$. Putting that in the denominator, $$2 \sqrt{1/4}(1+\sqrt{1/4} - 1/4) = 5/4$$, so we do not need to take a limit. Notice that for $$0, the denominator of $$f'$$ is positive, so we need only check the sign of the numerator to the left and right of $$1/4$$ in $$(0,1)$$. Let's check the signs of the numerators of $$f'(1/16)$$ and $$f'(1/2)$$ : $$1 - 2/4$$ is positive and $$1 - 2/\sqrt{2}$$ is negative, so we found a local maximum.
Perform a similar procedure on the $$x < 0$$ half and find no local extrema on that half.
But you have missed something. What is $$f'(0)$$ (Is it even defined?) and does $$f'$$ change signs while crossing $$x = 0$$?
• But the problem is that if I perform a similar procedure on the $x < 0$ half like you said, I do get a local extremum point at $-\dfrac{1} {4}$ and I don't know what's wrong. I shouldn't get a minimum or maximum at that value. – user1502 Dec 16 '19 at 21:14
• @user1502 : $x = -1/4$ is not a solution of $-2\sqrt{-x} - 1 = 0$. – Eric Towers Dec 16 '19 at 21:27
• Just one more question: Isn't there also something to consider for a value like $x = \dfrac{3+\sqrt{5}}{2}$ since for that value of $x$ the derivative of $f(x)$ is again not defined (denomiantor = 0, because of the term $1+\sqrt{x}-x$). Wouldn't the function have an extremum at this point also? Just like in the case where $x=0$, the case you told me to look at in the last sentence of your answer. – user1502 Dec 17 '19 at 23:54
• @user1502 : No extremum. No change of sign in the derivative as $x$ crosses that value. In fact, the function isn't even defined to the right of that point. – Eric Towers Dec 18 '19 at 0:02