Find dy for y = ln (cos 1/x) - 1/x
Find $dy$ for $y = \ln\!\left(\cos\dfrac{1}{x}\right) - \dfrac{1}{x}$.
Explanation of Method
A three-layer chain rule, where two minus signs conspire.
Step 1: Differentiate the logarithm — three layers
The composition is $\ln \to \cos \to \dfrac1x$, so the chain rule contributes three factors: \[\frac{d}{dx}\ln\!\left(\cos\frac1x\right) = \underbrace{\frac{1}{\cos\frac1x}}_{\text{outer}}\cdot\underbrace{\left(-\sin\frac1x\right)}_{\text{middle}}\cdot\underbrace{\left(-\frac{1}{x^{2}}\right)}_{\text{inner}}.\]
The two minus signs cancel, and the quotient of sine over cosine is a tangent: $= \frac{\sin\frac1x}{x^{2}\cos\frac1x} = \frac{1}{x^{2}}\tan\frac1x$.
Step 2: Differentiate the second term
Since $-\dfrac1x = -x^{-1}$, its derivative is $+x^{-2}$: $\frac{d}{dx}\left(-\frac1x\right) = \frac{1}{x^{2}}$.
Step 3: Combine
\[ y' = \frac{\tan\frac1x}{x^{2}} + \frac{1}{x^{2}} = \frac{1}{x^{2}}\left(1+\tan\frac1x\right). \]
Step 4: Form the differential
\[ dy = y'\,dx = \frac{1+\tan\dfrac1x}{x^{2}}\,dx. \]
Step 5: Verification
\[x = 1:\quad y' = \frac{1+\tan 1}{1} = 1+1.557408 = 2.557408\]
\[\frac{y(1.0001)-y(0.9999)}{0.0002} \approx 2.557409 \;\;\checkmark\]
\[\text{Zeros of } dy:\ \tan\frac1x = -1 \iff \frac1x = -\frac{\pi}{4}+k\pi, \text{ e.g. } x = \frac{4}{3\pi} \approx 0.42441 \;\;\checkmark\]
Result
Final answer:
\[\boxed{\,dy = \dfrac{1+\tan\dfrac{1}{x}}{x^{2}}\,dx\,}\]
Remark
Remark. The function is undefined wherever $\cos\frac1x\le 0$, and as $x\to0$ these gaps accumulate infinitely often — the domain near the origin is a sequence of shrinking intervals. Everything above is valid on each of them separately.