Differentiation with trigonometric and logarithmic functions

hirophysics.com

Question:

Here is a function of \(x\).

\[ y=\alpha \cos x + 2 – \cos x \log\frac{1+\cos x}{1-\cos x} \]

\(\alpha\) is a constant, and the range of \(x\) is \(0<x<\pi\).

Calculate \(\frac{d^2 y}{dx^2}+\frac{\cos x}{\sin x}\frac{dy}{dx}\).

Answer:

OK. Maybe we should break it up in three terms. So define each term:

\[ y_1 =  \alpha \cos x \]

\[y_2 = 2 \]

\[ y_3 = \log\frac{1+\cos x}{1-\cos x}\]

Then, calculate each derivative.

\[ y_1′ = -\alpha \sin x  \]

\[  y_2′ = 0   \]

The above derivatives are easy, but the third one is a little complicated. Let’s try that:

\[  y_3′ = (\log|1+\cos x| – \log|1-\cos x|)’ \]

\[   = \frac{(1+\cos x)’}{1+\cos x} – \frac{(1-\cos x)’}{1-\cos x}   \]

\[   = \frac{-\sin x}{1+\cos x} – \frac{\sin x}{1-\cos x}   \]

\[ = \frac{-\sin x(1-\cos x) – \sin x(1+\cos x)}{1 – \cos^2x}  \]

\[ = \frac{-2\sin x}{\sin^2 x}   \]

\[ = \frac{-2}{\sin x} \]

Since \(y=y_1+y_2-\cos x y_3\), the derivative becomes \(y’=y_1’+y_2′-[(\cos x)’ y_3+\cos x y_3′]\). Namely,

\[ \frac{dy}{dx} = -\alpha\sin x + \sin x \log\frac{1+\cos x}{1-\cos x} + \frac{2\cos x}{\sin x}\]

The second derivative is calculated as follows:

\[ \frac{d^2y}{dx^2} = -\alpha\cos x + \cos x \log\frac{1+\cos x}{1-\cos x} + \sin x\frac{-2}{\sin x} + \frac{2((\cos x)’\sin x – \cos x(\sin x)’)}{\sin^2x}  \]

\[  = -\alpha\cos x + \cos x \log\frac{1+\cos x}{1-\cos x} – 2 – \frac{2}{\sin^2x} \]

You can notice that the first three terms of above is equal to \(-y\). Therefore,

\[ \frac{d^2y}{dx^2} = -y -\frac{2}{\sin^2 x} \]

On the other hand,

\[ \frac{\cos x}{\sin x}\frac{dy}{dx} = -\alpha\cos x + \cos x\log\frac{1+\cos x}{1-\cos x} + \frac{2\cos^2 x}{\sin^2 x} \]

This can be rewritten as

\[ \frac{\cos x}{\sin x}\frac{dy}{dx} = -y + 2 + \frac{2\cos^2 x}{\sin^2 x} \]

Thus, we use each term to add, and obtain following:

\[ \frac{d^2 y}{dx^2}+\frac{\cos x}{\sin x}\frac{dy}{dx} = -2y\]

It was a little tricky, but makes sense. What do you think?