Excercise 2

Let \(a,b\) be real numbers and let the function \(f:\mathbb{R}\rightarrow \mathbb{R}\) be given by

\(\begin{equation*} f(x)= \left\lbrace \begin{array}{l} a \cos x+b\sin x, x < \pi,\\ x,x \geq \pi. \end{array} \right. \end{equation*}\)

\(i)\) Find all \(a,b\in \mathbb{R}\) such that \(f\) is a continuous function.

\(ii)\) Find the left-hand derivative and the right-hand derivative of \(f\) at the point \(x_{0}=\pi\).

\(iii)\) Find all \(a,b \in \mathbb{R}\) such that \(f\) is differentiable for all \(x\in \mathbb{R}\). In this case, check whether the derivative \(f'\) of \(f\) is a continuous or a differentiable function.

Solution

It is clear that \(f\) is continuous at all points except \(\pi\). So that \(f\) is also continuous in \(\pi\), the following must apply:

\(n:\lim_{x\rightarrow \pi^{-}} f(x) = f(\pi),\)

also

\(\lim_{x\rightarrow \pi^{-}} a\cos x + b \sin x=-a=\pi\)

\(f\) is continuous for any \(b \)and \(a =-\pi.\)

Left-hand derivation: We calculate using the addition theorems

\(\lim_{x\rightarrow \pi^{-}}\dfrac{f(x)-f(\pi)}{x-\pi}\)\(= \lim_{x\rightarrow \pi^{-}}\dfrac{-\pi \cos x+b \sin x-\pi}{x-\pi}\)

\(= \pi \lim_{x\rightarrow \pi^{-}}\dfrac{-1-\cos x}{x-\pi}+b \lim_{x\rightarrow \pi^{-}}\dfrac{\sin x}{x-\pi}\)\(=-\pi \lim_{x\rightarrow \pi^{-}}\dfrac{1 + \cos(x-\pi+\pi)}{x-\pi}+b \lim_{x\rightarrow \pi^{-}}\dfrac{\sin(x-\pi+\pi)}{x-\pi}\)

\(=-\pi \lim_{x\rightarrow \pi^{-}}\dfrac{1 + \cos(x-\pi) \cos \pi- \sin(x-\pi) \sin \pi}{x-\pi}\)\(+b \lim_{x\rightarrow \pi^{-}}\dfrac{\sin(x-\pi)\cos\pi + \sin \pi \cos(x-\pi)}{x -\pi}\)

\(= -\pi \lim_{x\rightarrow \pi^{-}}\frac{1-\cos(x-\pi)}{x-\pi}\)\(+b \lim_{x\rightarrow \pi^{-}}\dfrac{\sin(x-\pi)}{x-\pi}=-b;\)

Where:

\(\lim_{x\rightarrow \pi^{-}}\dfrac{1-\cos(x-\pi)}{x-\pi}\)\(= \lim_{x\rightarrow \pi^{-}} \frac{1-\sum_{n=0}^{\infty}(−1)^{n} \frac{(x-\pi)^ {2n}} {(2n)!}} {x-\pi}\)

\(=-\lim_{x\rightarrow \pi^{-}}\frac{1}{x-\pi}\sum{n=1}{\infty}(−1)^{n}\frac{(x-\pi)^{2n}} {(2n)!}\)\(= -\lim_{x\rightarrow \pi^{-}}\sum{n=1}{\infty}(−1)^{n}\dfrac{ (x-\pi)^{2n-1}}{(2n)!}\)

\(=\sum{n=1}{\infty}(−1)^{n}\frac{0}{(2n)!}=0.\)

Analogously we get

\(\lim_{x\rightarrow \pi^{-}}\frac{sin(x-\pi)}{x-\pi}=1.\)

Right-side derivation:

\(\lim_{x\rightarrow \pi^{+}}\frac{f(x)-f(\pi)}{x-\pi}\)\(= \lim_{x\rightarrow \pi^{-}}\frac{x-\pi}{x-\pi}=1.\)

\(f\) is differentiable if the left-hand and right-hand derivatives are the same, i.e. if \(b = −1\) (and of course if

\(\begin{equation*} f'(x)= \left\lbrace \begin{array}{l}\pi \sin x − \cos x , x < \pi,\\ 1,x \geq \pi.\end{array} \right. \end{equation*}\)

\(f'\) is also continuous in this case because

\(\lim_{x\rightarrow \pi^{-}} f'(x) = 1 = f'(\pi).\)

Left-sided derivative (of \(f'\)):

\(\lim_{x\rightarrow \pi^{-}}\frac{f'(x)-f'(\pi)}{x-\pi}\)\(= \lim_{x\rightarrow \pi^{-}}\frac{\pi \sin x-\cos x - 1}{x-\pi}\)\(= \pi \lim_{x\rightarrow \pi^{-}}\frac{\sin x}{x-\pi}-\lim_{x\rightarrow \pi^{-}}\frac{\cos x + 1}{x-\pi}\)

\(= \pi \lim_{x\rightarrow \pi^{-}}\frac{\sin(x-\pi+\pi)}{x-\pi}\)\(+\lim_{x\rightarrow \pi^{-}}\dfrac{\cos(x-\pi+\pi) + 1}{x-\pi}\)

\(= -\pi \lim_{x\rightarrow \pi^{-}}\)\(\frac{\sin(x-\pi)}{x-\pi}+\lim_{x\rightarrow \pi^{-}}\frac{-\cos(x-\pi) + 1}{x-\pi}=-\pi.\)

Right-side derivation:

\(\lim_{x\rightarrow \pi^{+}}\dfrac{f'(x)-f'(\pi)}{x-\pi}= \lim_{x\rightarrow \pi^{-}}\dfrac{1-1}{x-\pi}= 0.\)

\(0 \neq -\pi\), therefore\( f' \)is not differentiable