# Are the following statements true or false (differentiability and continuity)?

A "yes" or "no" is enough, reasons aren't required but I'd like to know them anyway to understand it better.

1) The mapping $g:\mathbb{R}\rightarrow\mathbb{R}$, with $g(x)=\frac{1}{2}\cos^{2}(x)$ if $x\leq0$ and $g(x)=\frac{1}{2}(x-1)$ if $x\geq0$ is continuous.

2) The mapping $h:\mathbb{R} \setminus \left\{0\right\} \rightarrow \mathbb{R}, h(x) = \left | \cos\left(\frac{1}{x}\right)\right|$ is differentiable.

I have problems with this task (no homework) because I'm supposed to say if the mapping / function is differentiable and continuous while there is no position given where I need to check that...

1) I say yes. We can never get to a discontinuity position in $cos$, not even if $x$ is smaller or equal to zero. Also for the second condition we can never get a discontinuity position. (But that's really a reason? Actually, in order to show the continuity, I would have checked the limit for both negative and positive sides, if equal, then continuous...But I don't know how this could be applied here)

2) I say yes. The discontinuity position $0$ has been excluded by the domain and thus there aren't any other discontinuity positions left.

Additonally, I have derivated the function $h$:

$$h'(x)=\frac{1}{x^{2}}\sin\left(\frac{1}{x}\right)$$

Because the derivative of the function exists, it is also differentiable. But again, there was no position given in the task, so I got my doubts if it works like that.

I got an additional question: If you have derivated a function and the derivation is a constant, is the function differentiable then?

Please tell me if my answers (yes/no) are correct and if possible, please also tell me if my reasonings are.

• For part 1, what is the value of $g(0)$? For part 2, your derivative would be correct if the function did't have absolute values on it. Needs more thought. – John Hughes Jul 29 '16 at 12:59
• For 2, the given function has cusps at $x=\frac{1}{\frac{\pi}{2} + \pi n}$. – MathematicsStudent1122 Jul 29 '16 at 13:02
• Some advice: if you're given a piecewise defined function and asked to check continuity or differentiability, the only important $x$ values are the "transition" points where the expression defining the function changes. – MathematicsStudent1122 Jul 29 '16 at 13:06

For (1): the function is discontinuous at $0$ because the limit from the left is: $$\frac{1}{2}\cos^2(0)=1/2,$$ while the limit from the right is $$\frac{1}{2}(0-1)=-1/2.$$

Note we can find these left and right limits be substitution because each piece ($(-\infty,0)$ and $(0,\infty)$) of the function is continuous.

(Actually $g$ is not a function because the two formulae do not agree at $x=0$. Probably one of the inequalities should be weak?)

For (2), your expression for the derivative (where it is defined) should be

$$h'(x)=\frac{\cos(1/x)\sin(1/x)}{|\cos(1/x)|x^2}.$$

To see why, note that $$h(x)=\begin{cases}\cos(1/x)& \cos(1/x)\geq0\\ -\cos(1/x) & \cos(1/x)<0\end{cases}$$

If $\cos(1/x)>0$ then your expression is correct. If $\cos(1/x)<0$, then $h(x)=-\cos(1/x)$ so:

$$h'(x)=-\frac{\sin(1/x)}{x^2}.$$

Thus $$h(x)=\begin{cases}\frac{\sin(1/x)}{x^2}& \cos(1/x)>0\\ -\frac{\sin(1/x)}{x^2}& \cos(1/x)<0\end{cases}$$

which is equivalent to the earlier expression.

The function $h$ is not differentiable at each point where $\cos(1/x)=0$. For example, it is not differentiable at $$\frac{1}{\frac{\pi}{2}}=\frac{2}{\pi}.$$ It is similar to why $|x|$ is not differentiable at $0$.

• Actually, 1 doesn't even define a function, since it specifies $g(0)$ as being two different values, although I suspect that OP wrote a $\le$ where it should have been a $<$ (or something like that) in one of hte two cases. – John Hughes Jul 29 '16 at 13:00
• John I have typed the task correctly. Double checked it. – cnmesr Jul 29 '16 at 13:04
• I don't understand how you get this derivation, is it because of the modulus? What's wrong with my derivation? Ok yes it's the stupid modulus, need to learn it myself then. – cnmesr Jul 29 '16 at 13:13
• Well, where did the absolute value go in your derivation? – smcc Jul 29 '16 at 13:14
• Is it true that for 2) the function is not continuous at 1 / (2/$\pi$)? – cnmesr Jul 29 '16 at 13:20