Minimizing a function which contains the floor function

82 Views Asked by At

I've the function ($A>1$ is a real positive variable; $F= \lfloor A \rfloor$ and $F \ge 1$ because $A>1$):

$$ U = \frac {F + (A - F)^2 } {A} $$

How can I minimize that function? In my old notes about this, the procedure is: (i) choose $F=1$ (why?); (ii) do the derivative $dU/dA$; (iii) replace the right value of A in U.

Thank you in advance.

2

There are 2 best solutions below

4
On BEST ANSWER

We can do this elementary, without calculus. We want to minimize the function $ f: (1,\infty) \to \mathbb{R} $ with

$$ f(x)=\frac{\lfloor x \rfloor+(x-\lfloor x \rfloor)^2}{x} $$

Notice that $ \lfloor x \rfloor \geq 1 $ and using AM-GM:

$$ \begin{aligned} \frac{\lfloor x \rfloor+(x-\lfloor x \rfloor)^2}{x} &= \frac{x^2+\lfloor x \rfloor+\lfloor x \rfloor^2-2x\lfloor x \rfloor}{x}\\ &\geq \frac{2x\sqrt{\lfloor x \rfloor+\lfloor x \rfloor^2}-2x\lfloor x \rfloor}{x}\\ &=2\left(\sqrt{\lfloor x \rfloor+\lfloor x \rfloor^2}-\lfloor x \rfloor\right)\\ &=\frac{2\lfloor x \rfloor}{\sqrt{\lfloor x \rfloor+\lfloor x \rfloor^2}+\lfloor x \rfloor}\\ &=\frac{2}{\sqrt{\frac{1}{\lfloor x \rfloor}+1}+1}\\ &\geq \frac{2}{\sqrt{1+1}+1}\\ &=2(\sqrt{2}-1) \end{aligned} $$

This value is attained when $ \lfloor x \rfloor = 1 $ and $ x^2=\lfloor x \rfloor+\lfloor x \rfloor^2=2 $ which gives $ x=\sqrt{2} $.

1
On

Using the accepted answer's notation

$$f(x)=\frac{\lfloor x \rfloor+(x-\lfloor x \rfloor)^2}{x}$$

If $n$ is a positive integer and $x=n$, note that $f(n) = 1$.

Can we make $f$ smaller with a non-integer value of $x$?

If we restrict the domain of $f$ to $x \in (n, n+1)$. Then

$$\displaystyle f(x)=\frac{n+(x-n)^2}{x}$$

is differentiable. We find

$$f'(x) = \dfrac{x^2-n-n^2}{x^2}$$

and $f'(x) = 0 \implies x = \sqrt{n^2+n}$.

Of course, for this answer to be valid, we need to have $n < \sqrt{n^2+n} < n+ 1$ which is always going to be true for positive integer values of $n$.

So, the minimum value of $f(x)$ when $n < x < n+1$ is

\begin{align} f\left(\sqrt{n^2+n}\right) &= \frac{n+\left(\sqrt{n^2+n}-n \right)^2}{\sqrt{n^2+n}} \\ &= \frac{n+(n^2+n) - 2n\sqrt{n^2+n} + n^2}{\sqrt{n^2+n}} \\ &= \frac{2(n^2+n) - 2n\sqrt{n^2+n}}{\sqrt{n^2+n}} \\ &= 2\sqrt{n^2+n}-2n \\ \end{align}

A quick check shows that the function $x \mapsto 2\sqrt{x^2+x} - 2x$ is strictly increasing on $(0, \infty)$. So the integer value of $n$ that minimizes $f(x)$ occurs when $n=1$; which gives us

$$\text{$x = \sqrt 2$ and $f(x) = 2\sqrt 2 -2$}$$