# Maximum Value Question

Let $a>0$. Show that the maximum value of $f(x):=\frac{1}{1+|x|}+\frac{1}{1+|x-a|}$ is $\frac{2+a}{1+a}$

I am wondering if I am headed in the right direction with the following process. I first adress the issue of the absolute values by rewriting the function:

$$f(x)=:\frac{1}{1+\sqrt{x^{2}}} +\frac{1}{1+\sqrt{(x-a)^{2}}}$$

I then take the derivative of $f(x)$, which yields:

$$f'(x)=\frac{a-x}{(1+\sqrt{(a-x)^{2}})^{2}\sqrt{(a-x)^{2}}}+\frac{x}{\sqrt{x^{2}}(1+\sqrt{x^{2}})^{2}}$$

The derivative I've taken from Wolfram Alpha for the moment. I am a bit confused about my next step, though I have an idea. Would I input $\frac{2+a}{1+a}$ into the first derivative, which should give me back zero? This would show that there is a maximum or minimum at that point. The next step being to check the value of the second derivative to show that it is indeed a maximum? I suppose this still wont show that $\frac{2+a}{1+a}$ is the global maximum.

-
Just plugging the point into the first derivative will tell you whether it is a critical point or not. It would not tell you if it is a maximum or a minimum, because you can have critical points that are neither. Checking the second derivative would only (possibly) tell you that the point is a local maximum or a local minimum, it would not tell you that it is a global extreme. – Arturo Magidin Nov 6 '11 at 23:49
Get a common denominator for $f'$ and then determine all the critical points. For rational expressions, this is usualy not that hard , it is just the points where the numerator or denominator are zero. Once you have a finite list of critical points, you may examine the sign of $f'$ in each interval between the CP's and then argue that you have a global max at one particular point. – user3180 Nov 6 '11 at 23:57
@Malthus: Since your edit has now rendered Henry's answer incorrect, it would be polite to let him know via a comment. It would be even better if you note in your original post that you made a mistake in your original statement, and what the original question said, so that other readers of the website don't downvote Henry's answer believing that it is in error. – Arturo Magidin Nov 7 '11 at 4:17
My apologies it was "+" between! I had mis-written the question in my rough work. – Malthus Nov 7 '11 at 4:18
The "cases" method used in the answer by @Henry is the right one for attacking the modified problem. Replacing $|w|$ by $\sqrt{w^2}$ is technically correct, but, as you noticed, creates a bit of a mess. – André Nicolas Nov 7 '11 at 6:23

This was a response to the question $f(x):=\frac{1}{1+|x|}-\frac{1}{1+|x-a|}$

Perhaps I am misunderstanding something, but doesn't the graph look something like this?

If $x \le 0$ then $f(x)=\frac{1}{1+|x|}-\frac{1}{1+|x-a|}=\frac{1}{1-x}-\frac{1}{1+a-x} =\frac{a}{(1-x)(1+a-x)}$ which is an positive increasing function for that $x$.

If $0 \le x \le a$ then $f(x)=\frac{1}{1+|x|}-\frac{1}{1+|x-a|}=\frac{1}{1+x}-\frac{1}{1+a-x} =\frac{a-2x}{(1+x)(1+a-x)}$ which is a decreasing function for that $x$, positive for $x\lt a/2$ and negative for $a/2 \lt x$.

If $a \le x$ then $f(x)=\frac{1}{1+|x|}-\frac{1}{1+|x-a|}=\frac{1}{1+x}-\frac{1}{1+x-a} =\frac{-a}{(1+x)(1+x-a)}$ which is a negative but increasing function for that $x$.

So the maximum must occur when $x=0$ and takes the value $f(0)=\frac{a}{1+a}$.

With the change in the question this becomes

and the maximum occurs when $x=0$ or $x=a$ and takes the value $f(0)=\frac{1}{1}+\frac{1}{1+a} = \frac{2+a}{1+a}$.

-
It appears there was a sign error in the original post; you may want to edit your answer to note that you are commenting on the originally posted question. – Arturo Magidin Nov 7 '11 at 4:18
Very sorry but I had made a mistake when writing the question down in my rough work. See above for the fix - it's addition between the two rationals rather than subtraction. I am going over your suggestion with the correction, thank you very much for your help. – Malthus Nov 7 '11 at 4:27

First, note that the limits as $x\to\infty$ and as $x\to-\infty$ of $f(x)$ are $0$. That tells you that the function does have a global maximum and a global minimum, since the function is necessarily bounded (as it is continuous and defined everywhere).

Once you know that the function does have global extremes, you also know that the global extremes are necessarily local extremes as well. So you can use the usual methods to find the points where the local extremes may be located, namely, the critical points.

The critical points are the points in the domain where the derivative does not exist or is equal to $0$.

Since you have the derivative, you should then determine what are the points where the derivative does not exist (if any), and the points where the derivative is $0$ (if any).

Once you have this list of points, you can simply plug all of them into the original function: the largest value you get will be the global maximum, the smallest value you get will be the global minimum; this will also tell you where they are located.

So, your next step (after filling in the gap at the beginning of establishing that the function does have global extremes) is to determine the critical points.

-
You only can conclude that $f$ has at least one of a global maximum and a global minimum. Henry's graph shows that in fact there is no global minimum. – Christian Blatter Nov 7 '11 at 11:16
@ChristianBlatter: Good point; with the new question, this is the case indeed. – Arturo Magidin Nov 7 '11 at 14:20