# How to show a function is continuous everywhere?

We have the following function:

$f(x) = \left\{ \begin{array}{l l} x^2 \cos\left(\dfrac{1}{x}\right) & \quad \text{if$x \neq 0$}\\ 0 & \quad \text{if$x=0$} \end{array} \right.$

We want to show it's continuous everywhere. How does one do this? For $x=0$ I know you can use the squeeze theorem, but for all other points in the domain, how can you show that the function is continuous?

• Product and superposition of continuous functions. – Alexander Vigodner Sep 29 '14 at 15:56
• Usually when such a problem is presented one already knows what the user above says. – Git Gud Sep 29 '14 at 15:56
• $$\lim_{x\rightarrow 0+}|x^{2}\cos(\frac{1}{x})|\leq \lim_{x\rightarrow 0+}x^{2}=0$$ – TheOscillator Sep 29 '14 at 15:57
• If $x\neq0$, then your $f$ is a nice smooth function near $x$ and continuous at $x$. Can you elaborate on what the problem actually is? – Joonas Ilmavirta Sep 29 '14 at 16:00

The following are theorems, which you should have seen proved, and should perhaps prove yourself:

1. Constant functions are continuous everywhere.
2. The identity function is continuous everywhere.
3. The cosine function is continuous everywhere.
4. If $f(x)$ and $g(x)$ are continuous at some point $p$, $f(g(x))$ is also continuous at that point.
5. If $f(x)$ and $g(x)$ are continuous at some point $p$, then $f(x)g(x)$ is continuous at that point.
6. If $f(x)$ and $g(x)$ are continuous at some point $p$, and $g(p)\ne 0$, then $\frac{f(x)}{g(x)}$ is continuous at $p$.

Then you put together the parts. For example, $\frac 1x$ is continuous everywhere except perhaps at $x=0$, by point 6, because it is a quotient of a constant function (point 1) and the identity function (point 2). Then by point 4, $\cos \frac 1x$ is continuous everywhere except perhaps at $x=0$, because it is a composition of the cosine function, which is continuous for all $x\ne 0$, and the function $\frac 1x$. You can fill in the rest.

• Wait, is $\dfrac{1}{x}$ continuous or not? I seem to be getting contradictory answers.. – Dolma Sep 29 '14 at 18:37
• @dolma Functions aren't “continuous or not”. A function is continuous at a point $p$ or not. The function $\frac1x$ is continuous at every point $p$ except $p=0$; at $0$ it is not continuous. But you said in your question that you were only interested in showing that $f(x)$ was continuous at points other than $0$, because you had a separate argument, based on the squeeze theorem, to show that $f(x)$ was continuous at $0$. – MJD Sep 29 '14 at 18:42

Hint: For rest of the points use the fact that $fg$ is continious if $f,g$ is continious.

• But then the problem becomes: How can you show that $\cos(1/x)$ and $x^2$ are continuous? – Dolma Sep 29 '14 at 16:00
• @Dolma: You can use the fact that all polynomial functions and trigonometric function are continious. – mesel Sep 29 '14 at 16:03

You see how to handle $x=0.$ For the rest:

• Is $y=x^2$ continuous?
• Aside from $x=0$, is $y=\cos(1/x)$ continuous?
• Given the answers to these two questions, is $y=x^2 \cos(1/x)$ continuous?
• Yes, I can see that $x^2$ and $\cos(1/x)$ (except for $x=0$) are continuous, but I don't know how to "prove" those are continuous either. – Dolma Sep 29 '14 at 16:01