# How is $\log(x) \leq x-1$ for all $x>0$?

sorry if this is a very obvious question, but I'm writing a proof for the Kulback-Leibler inequality and the first step is to state $$\log(x) \leq x-1$$ for all $$x>0$$.

I get it for $$x>1$$, but in my notes this isn't stated and when I looked on this site for answers all I could see were proofs showing this was the case for all $$x>0$$.

As far as I'm aware this demonstrably isn't the case for $$0 so I'm wondering what I'm missing here.

• Hint: Look at the proof for $x > 1$; repeat it exactly for $0 < x < 1$ (in other words, apply the mean value theorem on the interval $[a, 1]$ where $c$ is any number between $0$ and $1$; apply it to the function $(x-1) - \ln x$. – John Hughes Apr 15 at 16:48
• Consider $f(x) = x - 1 - \log(x)$. Show that $f \ge 0$ by showing the minimum of $f$ occurs at $x = 1$. – Tom Chen Apr 15 at 16:48

Define a function $$g$$ on $$(0,\infty)$$ by $$g(x)= log\ x-x+1$$. Now you check that this function attains the local maximum at $$x=1$$. Therefore $$g(x) \leq g(1)$$ for every $$x \in (0,\infty)$$. Hence $$\log x \leq x-1$$ for all $$x \in(0,\infty)$$.
• But if $x=0.3$ then $\log(x)=-0.523$ which is greater than $0.3-1=-0.7$? – Mark Durkan Apr 15 at 17:04
• @Mark Durkan , By $log$, he means logarithm with natural base. $ln(0.3) = -1.204<-0.7$ – Martund Apr 15 at 17:12