The derivative of $\tanh x$

1.4k Views Asked by At

I'm trying to calculate the derivative of $\displaystyle\tanh h = \frac{e^h-e^{-h}}{e^h+e^{-h}}$. Could someone verify if I got it right or not, if I forgot something etc. Here goes my try:

$$\frac{d}{dh}\left( \frac{e^h - e^{-h}}{e^h + e^{-h}}\right) = \frac{d}{dh}\left( (e^h - e^{-h})\cdot(e^h + e^{-h})^{-1}\right) $$ $$= \frac{d}{dh}\left( e^h -e^{-h}\right)\cdot(e^h + e^{-h})^{-1} + (e^h -e^{-h})\cdot\frac{d}{dh}\left( (e^h + e^{-h})^{-1}\right) $$$$ = (e^h + e^{-h})\cdot(e^h + e^{-h})^{-1} - (e^h-e^{-h})\cdot\frac{e^h-e^{-h}}{(e^h+e^{-h})^2} $$$$= 1-\frac{(e^h-e^{-h})^2}{(e^h+e^{-h})^2} = 1-\frac{(e^{2h}-2 + e^{-2h})}{e^{2h} + 2+e^{-2h}} = 1+\frac{-e^{2h}+2 - e^{-2h}}{e^{2h} + 2+e^{-2h}}$$

Thnx for any help! :)

2

There are 2 best solutions below

0
On BEST ANSWER

When faced with multiplications and divisions in a differentiation, use logarithmic differentiation:

$$\begin{align} \\ \tanh x &= \frac{e^x-e^{-x}}{e^x+e^{-x}} \\ \ln (\tanh x) &= \ln (\frac{e^x-e^{-x}}{e^x+e^{-x}}) \\ \ln (\tanh x) &= \ln ({e^x-e^{-x}}) - \ln ({e^x+e^{-x}}) \\ \frac{\mathrm d}{\mathrm dx} ( \ln (\tanh x) &= \frac{\mathrm d}{\mathrm dx} \ln ({e^x-e^{-x}}) - \frac{\mathrm d}{\mathrm dx} \ln ({e^x+e^{-x}}) \\ \frac{\mathrm d ( \ln (\tanh x)}{\mathrm d( \tanh x)} \frac{\mathrm d ( \tanh x)}{\mathrm d( x)} &= \frac{\mathrm d}{\mathrm dx} \ln ({e^x-e^{-x}}) - \frac{\mathrm d}{\mathrm dx} \ln ({e^x+e^{-x}}) \\ \frac{1}{\tanh x} \frac{\operatorname d ( \tanh x)}{\operatorname d( x)} &= \frac{\operatorname d \ln ({e^x-e^{-x}})}{ \operatorname d ({e^x-e^{-x}})} \frac{\operatorname d ({e^x-e^{-x}})}{ \operatorname d x} - \frac{\operatorname d \ln (e^x+e^{-x}) }{\operatorname d (e^x+e^{-x})} \frac{\operatorname d (e^x+e^{-x}) }{\operatorname d x} \\ \frac{1}{\tanh x} \frac{\operatorname d ( \tanh x)}{\operatorname d( x)} &= \frac{ 1}{ ({e^x-e^{-x}})} ({e^x+e^{-x}}) - \frac{1 }{(e^x+e^{-x})} (e^x-e^{-x}) \\ \frac{1}{\tanh x} \frac{\operatorname d ( \tanh x)}{\operatorname d( x)} &= \frac{( e^x+e^{-x})(e^x+e^{-x}) }{ ({e^x-e^{-x}})(e^x+e^{-x})} - \frac{(e^x-e^{-x})(e^x-e^{-x}) }{(e^x+e^{-x})(e^x-e^{-x})} \\ \frac{1}{\tanh x} \frac{\operatorname d ( \tanh x)}{\operatorname d( x)} &= \frac{( e^x+e^{-x})^2 }{ ({e^x-e^{-x}})(e^x+e^{-x})} - \frac{(e^x-e^{-x})^2 }{(e^x+e^{-x})(e^x-e^{-x})} \\ \frac{1}{\tanh x} \frac{\operatorname d ( \tanh x)}{\operatorname d( x)} &= \frac{4}{ ({e^x-e^{-x}})(e^x+e^{-x})} \\ \frac{\operatorname d ( \tanh x)}{\operatorname d(x)} &= \frac{4 \tanh x}{ ({e^x-e^{-x}})(e^x+e^{-x})} \square \end{align} $$

0
On

There are two ways of tackling the problem. One way is to expand $\tanh x$: $$ \tanh x=\frac{e^x-e^{-x}}{e^x+e^{-x}}= \frac{e^x-e^{-x}}{e^x+e^{-x}}\frac{e^x}{e^x}= \frac{e^{2x}-1}{e^{2x}+1} $$ and then using the quotient rule. Tedious, but easy.

The second way is to remember that $$ \tanh x=\frac{\sinh x}{\cosh x} $$ and again using the quotient rule, but taking into account that the derivatives of $\sinh$ and $\cosh$ are…