# If $f$ is continuous from a compact metric space to real numbers, prove $f^2$ is uniformly continuous

let $$(X,d)$$ be a COMPACT metric space. and $$f$$ is continuous function on $$X$$ that maps $$X$$ to real numbers, prove $$f^2$$ (pointwise product) is uniformly continuous.
I know by theorem, that $$f$$ is uniformly continuous on $$X$$.
I know is general this is not true that : if $$f$$ is uniformly continuous, then $$f.f=f^2$$ is uniformly continuous.

But can I say since $$X$$ is compact, so is $$X\times X$$. Hence $$f^2$$ is uniformly continuous on $$X\times X$$. ( and we know if $$f$$ is continuous on $$X$$, so is $$f^2$$ on $$X\times X$$).

Can this be considered as a proof for this question?

• $f^2$ is a function on $X$, not on $X\times X$. – Eric Wofsey Mar 29 at 18:41

It seems you have the right general idea, but you got confused at the end: $$f^2$$ is still just a function on $$X$$, not on $$X\times X$$. It's defined by $$f^2(x)=f(x)^2$$.
But, as you mention, the key point is that on a compact metric space, continuity and uniform continuity are equivalent. So you actually only have to show that $$f^2$$ is continuous, and that is immediate since a product of two continuous functions is continuous. (Or more simply, you are composing $$f$$ with the continuous function $$x\mapsto x^2$$.)