$f:\mathbb R\to[0,\infty )$ is continuous such that $g(x)={(f(x))}^2$ is uniformly continuous. Then prove that $f(x)$ is uniformly continuous.
I've tried to use the following method: $$ |(f(x))^2-(f(y))^2|\lt2B \epsilon \ \Rightarrow \ |f(x)-f(y)|\lt {2B\epsilon\over|f(x)+f(y)|} \ \Rightarrow \ |f(x)-f(y)|\lt \epsilon $$ whenever $|x-y|<\delta$. But this method is only effective when $|f(x)|>B>0$. But by definition, $f(x)$ may be zero. Now what will be the easiest method to solve this.
For starters, define $h:[0,\infty) \to [0,\infty)$ as $h(x) = \sqrt x$.
My first claim is that $h$ is uniformly continuous. There are many ways to see this. Intuitively, for a fixed $\varepsilon$, the worst $\delta$ will be at $x=0$. One approach is to split the domain.
First consider $h$ restricted to the domain $[0,1]$. Then it's continuous over a compact domain. Therefore uniformly continuous. Then, consider $h$ restricted to $[1,\infty)$, it has a bounded derivative. Which implies uniformly continuous. Lastly, show that you can can "paste" uniformly continuous functions together to get a uniformly continuous function. Just pick the larger $\delta$.
For my second claim, I need to show that the composition of uniformly continuous functions is continuous. This is just $\varepsilon$-$\delta$. Nothing special.
Now note that I haven't even mentioned $f$ yet. All in need is that $g$ is uniformly continuous, and $h \circ g = f.$ Then by combining my first and second claim, I see that $f$ itself is uniformly continuous.
I'm also pretty sure that you'd have to do almost the same work to finish the argument you proposed in the post. But this way you get two other handy results.