How to solve the differential equation $y' + \sec(x)*y = \tan(x)$

I am really struggling to solve the differential equation: $y' + \sec(x)y = \tan(x)$. If someone could point me in the right direction or give me a step by step plan it would be much appreciated!

So far I have tried taking the common factor to be $\exp(\int(\sec(x))$ (which simplifies to $\tan(x)+\sec(x)+c$ if I am not mistaken) however I end up with an equation which is beyond my integration abilities because it has both $X$ and $Y$ in it. I'm not sure if it is a case of trig identities or imaginary numbers which are letting me down.

• Are you familiar with the integrating factor method? – David Quinn Feb 10 '16 at 22:36
• Is this a homework problem or do you just need the answer? You can see the answer here – Yuriy S Feb 10 '16 at 22:36
• I don't think so - I have only used a 'common factor' and then a 'particular integral' - I'm not sure if this is the same thing just worded differently? – Tech Feb 10 '16 at 22:38
• It seems like you've misunderstood the role of the integrating factor. Let $h(x) = \exp \left(\int \sec x \mathrm{d}x \right)$. Multiplying by $h$ on both sides gives you $hy' + (\sec x )hy = (hy)' = h(x)\tan x \iff hy = \int h(x) \tan x ~\mathrm{d} x$, and the latter integral is only in $x$. – stochasticboy321 Feb 10 '16 at 22:38
• There is an exact formula to solve this type of ode!! See here. Have not you been taught this method? – Mhenni Benghorbal Feb 10 '16 at 22:46

This is in the form of a Linear Differential Equation

and here the integrating factor would be $e^{\int(\sec(x))}$ so that you will get \begin{align} (\tan(x)+\sec(x))\frac{dy}{dx}+(\tan(x)+\sec(x))y\sec(x) = &\, \tan^2(x)+\sec(x)\tan(x) \\ ((\tan(x)+\sec(x))y)' = & \\ \end{align}

So integrating on both sides you have, $$(\tan(x)+\sec(x))y=\tan(x)+\sec(x)-x+C$$ $$y=\frac{\tan(x)+\sec(x)-x+C}{\tan(x)+\sec(x)}.$$

I have just outlined what you need to do here, you can go to the hyperlink given to know more about linear differential equations. Hope it helps.

EXTRA EDITS:

Links to the integrals: integrating factor, and the integral of the right side. For both links, press the Go!button next to the formula.

As you have noted, the integrating factor is $$\exp\left(\int\sec x\,dx\right) = \exp\left(-\ln(\cos(x/2)-\sin(x/2)) + \ln(\cos(x/2)+\sin(x/2))\right) = \frac{\cos(x/2)+\sin(x/2)}{\cos(x/2)-\sin(x/2)} = \frac{\cos x}{(\cos(x/2)-\sin(x/2))^2}.$$ Multiplying both sides by the integrating factor gives \begin{align*} \frac{d}{dx}\left(y\frac{\cos x}{(\cos(x/2)-\sin(x/2))^2}\right) &= \tan x\cdot\frac{\cos x}{(\cos(x/2)-\sin(x/2))^2} \\ &= \frac{\sin x}{(\cos(x/2)-\sin(x/2))^2} \\ &= \frac{\sin x}{1 - 2\sin(x/2)\cos(x/2)} \\ &= \frac{\sin x}{1-\sin x}. \end{align*} Now just integrate both sides.

• Thank you, I will need to brush up on my half angle formulae! – Tech Feb 10 '16 at 22:48