Analyzing the continuity and derivability of $\frac{1-\cos(x)}{x}$ at 0

There is a piecewise function $f$ defined as following:

$$f:\left\{\begin{matrix} \frac{1-\cos(x)}{x} \Leftarrow x\neq0\\ 0 \Leftarrow x=0 \end{matrix}\right.$$

I'm asked to first show that $f$ is continuous at $0$, then show that $f$ is derivable at $0$, and finally calculate $f'(0)$.

I know that $g(x)$ is continuous at $x_{0}$ if $\lim_{x\rightarrow x_{0}}g(x)=g(x_{0})$ and derivable at $x_{0}$ if $\lim_{x\rightarrow x_{0}}\frac{g(x)-g(x_{0})}{x-x_{0}}=g'(x_{0})$ exists.

Here's what I have done to demonstrate that $f$ is continuous at $0$:

$$\lim_{x\rightarrow 0}\frac{1-\cos(x)}{x}=\lim_{x\rightarrow 0}-\frac{\cos(x)-\cos(0)}{x-0}=-\lim_{x\rightarrow 0}\frac{\cos(x)-\cos(0)}{x-0}=-\cos'(0)=\sin(0)=0=f(0)$$

Then, I was confused when I saw the following question that asked me to show that $f$ is derivable at $0$, as that property was how I solved the first question.

I think that there should be some another way to demonstrate how $f$ is continuous at $0$ which I don't realize, or it could be that I'm misusing the conditions of continuity and derivability at a point.

Anyways, any help would be appreciated and thank you for your time.

• An easy way to check for continuity is to use the power series definition of the cosine. The first term is 1, so that cancels, and the leading behaviour is given by $\frac{x^2}{x} = x$, which indeed tends to $0$ for $x\rightarrow 0$. – Tom Nov 19 '16 at 10:49
• I agree, that is a much easier way to check the function's continuity. But I should be able to solve it without using series, as we have not talked about it in class yet :-) Thanks for the input. – Glycerius Nov 19 '16 at 10:52

You did well for establishing continuity at $0$.

Every time a function $g$ (defined over an open interval $(a,b)$, for simplicity) is differentiable at a point $x_0\in(a,b)$, the function $$f(x)=\begin{cases} \dfrac{g(x)-g(x_0)}{x-x_0} & \text{if x\in(a,b), x\ne x_0} \\[6px] g'(x_0) & \text{if x=x_0} \end{cases}$$ is continuous at $x_0$, by definition of derivative and of limit. In your case, $g(x)=-\cos x$, $x_0=0$ and $g'(0)=\sin 0=0$.

For differentiability at $x_0$ you can apply the definition: $$f'(x_0)=\lim_{x\to x_0}\frac{f(x)-f(x_0)}{x-x_0}$$ if the limit exists and is finite. In your case, $$\lim_{x\to0}\frac{\dfrac{1-\cos x}{x}-0}{x}= \lim_{x\to0}\frac{1-\cos x}{x^2}= \lim_{x\to0}\frac{1-\cos^2x}{x^2}\frac{1}{1+\cos x}= \frac{1}{2}$$ The first factor in the final limit is $$\left(\frac{\sin x}{x}\right)^2$$

• Thanks for the input. I assume you used l'Hôpital to get $$\lim_{x\to0}\frac{1-\cos x}{x^2}=\frac{1}{2}$$ How would one solve the limit without l'Hôpital? @Tacet defined $x=2y$ to do use. Are there any other solutions? Thanks! – Glycerius Nov 19 '16 at 12:27
• @Glycerius I added the simpler trick I know – egreg Nov 19 '16 at 13:23
• Thanks! What is funny is that I had just found the very same thing and was about to type it. I guess you were faster :-) Have a nice day. – Glycerius Nov 19 '16 at 13:27

You can do it using only basic methods. First let $x = 2y$, then use trigonometric equality:

$$1 - \cos(x) = 1 - \cos(2y) = 1 - (1 - 2 \sin^2(y)) = 2 \sin^2(y)$$

As you should know $\lim_{x\to 0}\frac{\sin x}{x} = 1$, so here you have

$$\frac{2 \sin^2{y}}{2y} = \frac{\sin(y)}{y} \cdot \sin(y) \to 1 \cdot 0 = 0$$

Now you can use definition:

$$\lim_{x \to 0}\frac{f(x)- f(0)}{x} = \lim \frac{(1 - \cos(x))- 0}{x^2} = \lim \frac{2\sin^2(y)}{4y^2} = \frac{1}{2} \cdot 1^2 = \frac{1}{2}$$

However, your solution is quite correct. But if you didn't proved that cosinus is differentiable, then probably you should do it first!

• Defining $x=2y$ was quite clever to get $$\lim_{x\to 0} \frac{(1 - \cos(x))- 0}{x^2} = \lim_{x\to 0} \frac{2\sin^2(y)}{4y^2} = \frac{1}{2} \cdot 1^2 = \frac{1}{2}$$ Thanks! – Glycerius Nov 19 '16 at 12:26

Continuity: Note that

$$\lim \limits_{x \to 0^-} f(x)=\lim \limits_{x \to 0^+} f(x)=\lim \limits_{x \to 0}\frac{1-\cos x}{x}$$

Apply L' rule, $$=\lim \limits_{x \to 0}\frac{\sin x}{1}=0=f(0)$$

So $f$ is continuous at $x=0$.

Differentiability: Note that

$$\lim \limits_{x \to 0^-} \frac{f(x)-f(0)}{x-0}=\lim \limits_{x \to 0^+} \frac{f(x)-f(0)}{x-0}=\lim \limits_{x \to 0}\frac{1-\cos x-0}{x^2}$$

Apply L' rule,

$$=\lim \limits_{x \to 0}\frac{\sin x}{2x}=1/2$$ So, $$f'(0)=1/2$$