# If $f(x)=\sqrt{x+a}+\sqrt{b-x}$, find the minimum and maximum values of $f(x)$.

If $f(x)=\sqrt{x+a}+\sqrt{b-x}$, find the minimum and maximum values of $f(x)$.

According to the AM-GM inequality, the minimum value of $f(x)$ occurs when $\sqrt{x+a}=\sqrt{b-x}$ or $x=\frac{b-a}{2}$. However, assigning random values to $a$ and $b$ and plotting the graph reveals that this is actually the maximum value. What is the reason for this anomaly ?

Example : If $f(x)=\sqrt{x+1}+\sqrt{3-x}$, the minimum value should be when $x=1$, when $f(1)=2\sqrt{2}$. However, this is actually the maximum value. And the minimum value can be obtained by simply adding the two terms, ignoring the root and then taking the root of the sum. $$\sqrt{x+1}+\sqrt{3-x} \ge\sqrt{4}$$

My second question is, does this always hold true ? In other words, is the following relation always true ? $$\sqrt{a+b} \le \sqrt{x+a}+\sqrt{b-x}\le \sqrt{2(a+b)}$$

• AM-GM tells you pretty much nothing in this case,how did you apply it? – kingW3 Apr 7 '17 at 16:25
• +kingW3 Oh... I forgot that the minimum value of the sum is obtained at equality only when the product is a constant. – Vishnu V.S Apr 7 '17 at 16:27
• I think it's the reverse: $(x-a)(b-x)$ is maximised when $x-a = b-x$ when the sum of the factors ($(x-a) + (b-x) = b - a$) is a constant. – Shraddheya Shendre Apr 7 '17 at 16:34

As $-a\le x\le b\iff-2a\le2x\le2b\iff-(a+b)\le2x+a-b\le(a+b)$

Assuming $a+b>0,$ WLOG $2x+a-b=(a+b)\cos2y$ where $0\le2y\le\pi$

$\sqrt2f(x)=\sqrt{2x+2a}+\sqrt{2b-2x}$

$=\sqrt{(a+b)\cos2y+b-a+2a}+\sqrt{2b-(a+b)\cos2y+a-b}$

$=\sqrt{2(a+b)}(\cos y+\sin y)=2\sqrt{a+b}\sin\left(\dfrac\pi4+y\right)$

As $0\le y\le\dfrac\pi2,\dfrac1{\sqrt2}\le\sin\left(\dfrac\pi4+y\right)\le1$

Here's the thing... You're going to have a restricted domain because this is a $\sqrt{*}$ based function.

You need $x-a>0$ and $b-x>0$ so $x>a \cap x<b$. So first of all you HAVE to guarantee $a<b$

Assuming $a<b$, then you're going to have a function looking like $\cap$, with a maximum in the middle $x=(b-a)/2$ and minimums at the endpoints $x=a \land x=b$

(Try graphing some of them so you get the idea of how to work it out!)

For the maximum you can easily prove it by using an analytic approach $f(x) = \sqrt{x-a} + \sqrt{b-x}$ $f'(x) = 1/(2*\sqrt{x-a}) - 1/(2*\sqrt{b-x})$

Get the critical point for max/min analysis $f'(x) = 0 = 1/(2*\sqrt{x-a}) - 1/(2*\sqrt{b-x})$ $\Rightarrow 1/(2*\sqrt{x-a}) = 1/(2*\sqrt{b-x})$ $\Rightarrow {x-a} = {b-x}$ $\Rightarrow x=(b-a)/2$

(you can use $f''(x)$ analysis to prove it is a maximum or do it by analyzing a neighborhood, etc)

As far as proving the minimums, you need to do some more proof magic.

I would to this by proving that f is strictly increasing on $[a,(b-a)/2]$ and decreasing on $[(b-a)/2, b]$ and then you're done.