TITLE: How to get the solution to these differential equations
QUESTION [8 upvotes]: I would like to get from
$$
\tan(x) = \frac{y''}{y'} + y'
$$
The answer is
$$
y = \ln(c_1\tanh^{-1}(\tan(\frac{x}{2}))+c_2)
$$
The other equation is
$$
\sec(x) = \frac{y''}{y'}+y'
$$
The answer is 
$$
y = \ln(c_1\ln(e^{4\tanh^{-1}(\tan(\frac{x}{2}))}+1)+c_2)
$$
I have no idea where to begin, Any advice would be nice.

REPLY [2 votes]: dividing by $y^\prime$ turns $ {y^{\prime \prime} \over y^{\prime}} + y^{\prime} = f(x)$  into $ {y^{\prime \prime} \over {y^{\prime}}^2} + 1 = \frac{f}{y^{\prime}}$ which is 
$$-\frac{d(1/y^{\prime})}{dx} + 1 =\frac{f}{y^\prime}$$ make a change of variable $u =  1/y^\prime$ so that $${du \over dx} = 1 - uf$$ we will try variation of parameters, i.e. $$ u = Ae^{-\int_0^x f(t)dt} \mbox{where $A$ is a function of $x$ to be determined.}$$ substituting this in the equation for $u$ gives 
$$ e^{-\int_0^x f(t)dt } \frac{dA}{dx }- e^{-\int_0^x f(t)dt }Af = 1 - Ae^{-\int_0^x f(t)dt }f$$ so that $$ A = \int_0^x e^{-\int_0^x f(t)dt }dx + C, u = e^{-\int_0^x f(t)dt }\left( \int_0^x e^{-\int_0^x f(t)dt }dx + C \right)$$
one can now substitute $ \tan x \mbox{ and } \sec x$  for $f.$