# Solving the differential equation $y' - y\tan(x) = 0$?

Here's my attempt at a solution to the differential equation $$y' - y\tan(x) = 0$$:

$$y' - y\tan(x) = 0 \Rightarrow \frac{y'}{y} = \tan(x) \\ \Rightarrow \int \frac{y'}{y} = \int \tan(x) + C \\ \Rightarrow \log y = -\log|\cos x| + C \\ \Rightarrow y = \frac{e^C}{|cosx|} = e^C|\sec x|$$

My book lists the answer as $$y = C \sec x$$. I have two slightly embarrassing misunderstandings about why this is true:

1. First, since the logarithm is defined only for positive real numbers, why is it that we can ignore the absolute value? For a fixed $$C$$, the two solutions clearly differ on points like $$x = 3\pi/2$$, where the secant is negative. Which one is correct?
2. Why is it that we can reduce $$e^C$$ to just the constant $$C$$? $$e^C$$ doesn't take on negative values, so it seems like, for example, $$y = - \sec x$$ is a particular solution of the second general solution, but not the first.

Thanks!

• Because $-log(cosx)$ is the same thing as $log(secx)$, that's the first part of your question – imranfat Aug 9 '19 at 2:00

First, and very importantly $$\int\frac{y'}{y}=\log |y|$$If you fix this, your solution is $$|y|=e^C |\sec(x)|$$

(2) Since $$C$$ is constant, so is $$C'=e^{C}$$. With this, your solution becomes $$|y|=C' |\sec(x)|$$ ($$C'$$ is positive)

(1) Remember that you solve the DE on an interval where everything makes sense.

Since $$\tan(x)$$ is not defined at $$\frac{\pi}{2}+k \pi$$, you are looking for the solution between two consecutive such numbers.

On any such interval, $$\sec(x)$$ does not change signs.

Therefore, for every $$x$$ your solution is $$y(x)= \pm C' \sec(x)$$ where the choice of $$\pm$$ could depend on $$x$$. But since the LHS is differentiable, hence continuous, the RHS is also continuous. Since $$\sec(x)$$ does not change sigh, this is only possible if the choice of $$\pm$$ is the same at all $$x$$ in the interval [this follows immediately from Intermediate Value Theorem]

• Thanks! Your answer to (1) makes sense to me. I still don't understand your answer to (2); an arbitrary real choice of $C$ doesn't allow for $e^C < 0$, so you'd still have $C' \geq 0$, no? – TheProofisTrivium Aug 9 '19 at 3:20
• @TheProofisTrivium That would be correct if your computation didn't contain a small mistake: What is $\int \frac{y'}{y}$? ;) – N. S. Aug 9 '19 at 3:22
• @TheProofisTrivium See the edit – N. S. Aug 9 '19 at 3:28
• Oops, my mistake. Thank you very much! – TheProofisTrivium Aug 9 '19 at 3:30