# Solving the differential equation $y' \tan y = \frac1x$

Express the differential equation $$\tan y\,\frac{dy}{dx}=\frac{1}{x}$$ in a form not involving $\frac{dy}{dx}$.

I understand the concept of a differential equation (though, as a student, I am fairly new to the topic), but I'm not sure how to put this in a form that can be integrated.

Thanks so much,

cyanfox

• Do you know what to do with separable equations? (Everything with $y$ goes to the left, everything with $x$ to the right, then integrate both sides.) Also, please note that "quick question" is not a good title. The title should be descriptive of the actual question.
– user147263
Jul 29, 2014 at 0:30
• I'm familiar with separable equations; just this particular one was bugging me. Also, thanks for the edits. Jul 29, 2014 at 3:08

Factor the $dx$ to the right-hand side and you can then integrate both sides. $$\tan y\, dy = \frac{1}{x}\,dx$$ However, the $\int \tan y\, dy$ isn't something that I remember off the top of my head, though I would recommend $u$-substitution in the form of: $$\int \tan y\, dy = \int \frac{\sin y}{\cos y}dy$$ LET: $u=\cos y, du = -\sin y\, dy$ $$\int \frac{1}{u}(-du)=-\int \frac{du}{u} = -\ln|u|+C$$ Therefore, the final solution is: $$-\ln\left|\cos y\right|+C = \ln|x|$$

So for $c=\pm e^C$, $$\frac{c}{\cos y}=x$$ or rather $$x=c\sec y$$

• I think it should be $-\ln(\cos(y)) + C = \ln(x)$, as the variable of integration was $y$. Jul 29, 2014 at 0:34
• Good catch. I fixed it now. Does this look better? Jul 29, 2014 at 1:15
• Almost! There is the left-hand integral in your second equation where it is still $\tan(x) dx$, but you got the others! Jul 29, 2014 at 1:38

This is called a separable differential equation, as it is possible to isolate the dependent and independent variables on both sides of the equality.

The general form of the equation is $$f(y)y'=g(x),$$ or $$f(y)dy=g(x)dx.$$ If you can find the antiderivatives in analytic form, you get $$\int_{y_0}^yf(y)dy=F(y)-F(y_0)=\int_{x_0}^xg(x)dx=G(x)-G(x_0).$$ And if you are lucky enough that you can invert $F$ analytically, $$\color{blue}{y=F^{-1}(G(x)-G(x_0)+F(y_0))}.$$

Note: when you don't know the initial conditions, you just replace $-G(x_0)+F(y_0)$ by an arbitrary constant $C$.

Check:

By the inversion and chain rules, $$y'=\frac{(G(x)-G(x_0)+F(y_0))'}{F'(G(x)-G(x_0)+F(y_0))}=\frac{g(x)}{f(y)}.$$

In your case, $$f(y)=\tan y\implies F(y)=-\log\cos y\implies F^{-1}(t)=\arccos\exp(-t),\\g(x)=\frac1x\implies G(x)=\log x,$$ so that $$y=\arccos\exp(-\log x+\log x_0+\log\cos y_0),$$ $$\color{blue}{y=\arccos(\frac{x_0\cos y_0}{x})}.$$ Check: $$y'=\frac{-x_0\cos y_0}{x^2}\frac{-1}{\sin(\arccos(\frac{x_0\cos y_0}x))}=\frac{\cos y}x\frac1{\sin y}.$$

(We have used $(\arccos t)'=\frac{-1}{\sqrt{1-t^2}}=\frac{-1}{\sin\arccos t}$.)