Problem: Prove $|\log(1-x)+x|\leqslant cx^2$(c is a constant) holds for $|x|<\frac{1}{2}$.
My proof: $\log(x-1)=-x-O(x^2)$ then $\log(x-1)+x=-x-O(x^2)+x\implies \log(x-1)+x=O(x^2)\implies|\log(x-1)+x|=O(x^2)\implies |\log(x-1)+x|\leqslant cx^2$
However the author points out that the latter identity only holds for $|x|⩽\frac{1}{2}$. This later point did not show in my derivation.
Question:
What am I doing wrong?
Thanks in advance!
Kavi Rama Murthy has explained why the OP's work is invalid. I am presenting an explicit way to extract such a constant $c$.
By Taylor's Theorem, we have $$\ln(1-x)=-x-\frac{1}{2}\,x^2-\frac{1}{3\,\big(1-\xi(x)\big)^3}\,x^3\text{ for all }x<1\,,$$ where $\xi(x)$ is a number between $0$ and $x$. That is, $$-\ln(1-x)-x\leq \frac{1}{2}\,x^2+\frac{1}{3\,\left(1-\frac{1}{2}\right)^3}\,\left(x^2\cdot\frac{1}{2}\right)=\frac{11}{6}\,x^2\text{ if }0\leq x<\frac{1}{2}$$ and $$-\ln(1-x)-x\leq \frac{1}{2}x^2\text{ if }x<0\,.$$ That is, $$\big|\ln(1-x)+x\big|\leq \frac{11}{6}\,x^2\text{ for all }x\in\left[-\frac12,+\frac12\right]\,.$$
In fact, let $f:\mathbb{R}_{<1}\to\mathbb{R}$ be the function defined by $$f(x):=\left\{\begin{array}{ll} \frac{-x-\ln(1-x)}{x^2}\,,&\text{if }x\in(-\infty,0)\cup(0,1)\,,\\ \frac{1}{2}\,,&\text{if }x=0\,. \end{array}\right.$$ Then, $f$ is an increasing positive function. Therefore, the best constant $c$ in this problem is $$f\left(\dfrac12\right)=4\,\ln(2)-2\approx 0.77259\,.$$