Differentiate $|\sin x|$

275 Views Asked by At

Could you differentiate $|\sin x|$ and give the points where the derivative doesn't exist?

I have only so far tried to analyze it using the graph, from 0 to $\pi$ is $\cos x$. But from $\pi$ to $2\pi$ $\sin x$ will be on the positive side and it'd be given by the derivative of $\cos x$ too. Anyways I am confused and need help. Is there a better way of doing this?

4

There are 4 best solutions below

0
On

You can take the derivative using the chain rule. $\frac{d}{dx}f(g(x)) = f'(g(x))*g'(x)$. $f(x) = |x|$ and $g(x) = \text{sin}(x)$. The derivative of $|x| = \text{sign}(x)$ so $f'(g(x)) = \text{sign}(\text{sin}(x))$ and $g'(x) = \text{cos}(x)$. Therefore the full derivative is $$\text{sign}(\text{sin}(x))*\text{cos}(x)$$Because the $\text{sign}(x)$ makes all negative numbers $-1$ and all positive numbers $1$, $\text{sign}(\text{sin}(x))$ makes a repeating wave of positive and negative numbers. The positive numbers will follow a pattern from $0$ to $\pi$, $2\pi$ to $3\pi$ and etc. The negative numbers will go from $\pi$ to $2\pi$, $3\pi$ to $4\pi$ and etc. When you multiply the $-1$ from the $\text{sign}(x)$ by the corresponding parts of the $\text{cos}(x)$, that will give you the discontinuities.

0
On

We can use the chain rule to solve this problem. Firstly, take $u = \sin(x)$ and $\dfrac{d}{du}\left(|u| \right)$. Therefore, we have $$\frac{d}{dx} (|\sin(x)|) = \frac{\sin(x) \cdot \left(\frac{d}{dx} (\sin(x)) \right)}{|\sin(x)|}$$ We now need to apply the chain rule again, so $$\frac{d}{dx} (\sin(x)) = \frac{d \sin(u)}{dx} \frac{du}{dx}, \quad \textrm{where} \quad u = x $$ Since the derivative of $\sin$ is $\cos$ we have $$\cos(x) \left( \frac{d}{dx}(x) \right) \frac{\sin(x)}{|\sin(x)|}$$ Since $x$ is a constant we finally obtain $$\frac{d}{dx} (|\sin(x)|) = \frac{\cos(x) \sin(x)}{|\sin(x)|}$$ provided that $\sin(x) \neq 0$ since $|\sin(x)|$ is not differentiable when $\sin(x) = 0$.

0
On

We have that by cases

  • for $\sin x > 0$

$$|\sin x| = \sin x \implies \frac d{dx} |\sin x| = \cos x$$

  • for $\sin x < 0$

$$|\sin x| = -\sin x \implies \frac d{dx} |\sin x| = -\cos x$$

therefore for $\sin x \neq 0$

$$\frac d{dx} |\sin x|= \text{sign}(\text{sin}(x))\cdot \cos x= \frac{\sin x}{|\sin x|} \cdot \cos x$$

and as noticed, $|\sin x|$ is not differentiable when $\sin x =0$.

1
On

The current answers that use the Chain Rule are missing a crucial point. It is too long to comment on them, so here is a new answer. The key point is that, in order to apply the Chain Rule, one has to know beforehand that the two functions are differentiable. Precisely,

if $g$ is differentiable at $a$ and $f$ is differentiable at $b=g(a)$, then $f\circ g$ is differentiable at $a$ and $(f\circ g)'(a)=f'(g(a))g'(a)$.

If $f$ or $g$ fails to be differentiable, then we cannot conclude about the differentiability of $f\circ g$. For example, if $g(x)=|x|$ and $f(x)=x^2$, then $g$ is differentiable at $0$ but $f\circ g$ is differentiable at $0$ (what happens is that, in that case, the formula $(f\circ g)'(a)=f'(g(a))g'(a)$ is false, since $g'(a)$ does not exist).

Now, let $h(x)=|\sin(x)|$. We can see it as $h=f\circ g$ with $g(x)=\sin(x)$ and $f(x)=|x|$. It is well-known that $g$ is differentiable on $\mathbb R$ and $g'(x)=\cos(x)$, and $f$ is differentiable on $\mathbb R\setminus\{0\}$ and $f'(x)=1$ if $x>0$, $f'(x)=-1$ if $x<0$ and $f'(0)$ does not exist. It can be summarize as $f'(x)=\frac{x}{|x|}$ for $x\neq 0$. (I prefer not writing $f'(x)=sgn(x)$ as $sgn(0)$ is usually defined to be $0$)

As a consequence, using the Chain Rule, $f\circ g$ is differentiable at any $x$ such that $g(x)\neq 0$, that is $x$ is not a multiple of $\pi$. And the Chain Rule also tells us that $(f\circ g)'(x)=\frac{\sin(x)}{|\sin(x)|}$ for every $x\notin\{k\pi\; |\; k\in \mathbb Z\}$.

As for the non-differentiability of $f\circ g$ at $x=k\pi$, $k\in\mathbb Z$, we need a separate argument. Despite the Chain Rule, $f\circ g$ could still be differentiable. But we have $\frac{h(x)-h(0)}{x}=\frac{|\sin(x)|}{\sin(x)}\frac{\sin(x)}{x}$, so $\lim_{x\to 0^+}\frac{h(x)-h(0)}{x}=1$ while $\lim_{x\to 0^-}\frac{h(x)-h(0)}{x}=-1$, so $h$ is not differentiable at $0$. We can prove by similar computations that $h$ is not differentiable at $x=k\pi$, when $k\in\mathbb Z$.