# Solve the linear equations by considering y as a function of x, that is, y = y(x).displaystyle{y}'+{y} tan{{x}}= sec{{x}},displaystyle{y}{left(piright)}={1}

Solve the linear equations by considering y as a function of x, that is, y = y(x).
$$\displaystyle{y}'+{y} \tan{{x}}= \sec{{x}},$$
$$\displaystyle{y}{\left(\pi\right)}={1}$$

• Live experts 24/7
• Questions are typically answered in as fast as 30 minutes
• Personalized clear answers

### Plainmath recommends

• Get a detailed answer even on the hardest topics.
• Ask an expert for a step-by-step guidance to learn to do it yourself.

Fatema Sutton

Variation of parameters
First, solve the linear homogeneous equation by separating variables.
Rearranging terms in the equation gives
$$\displaystyle\frac{{{\left.{d}{y}\right.}}}{{{\left.{d}{x}\right.}}}=-{y} \tan{{x}}\Leftrightarrow\frac{{{\left.{d}{y}\right.}}}{{y}}=- \tan{{x}}{\left.{d}{x}\right.}$$
Now, the variables are separated, x appears only on the right side, and y only on the left.
Integrate the left side in relation to y, and the right side in relation to x
$$\displaystyle\int\frac{{{\left.{d}{y}\right.}}}{{y}}=-\int \tan{{x}}{\left.{d}{x}\right.}$$
Let's solve the integral on the right side.
$$\displaystyle\int \tan{{x}}{\left.{d}{x}\right.}=\int\frac{{ \sin{{x}}}}{{ \cos{{x}}}}{\left.{d}{x}\right.}$$
$$\displaystyle={\left|{ \cos{{x}}={t}\Rightarrow- \sin{{x}}{\left.{d}{x}\right.}={\left.{d}{t}\right.}}\right|}$$
$$\displaystyle=-\int\frac{{{\left.{d}{t}\right.}}}{{t}}$$
$$\displaystyle=- \ln{{\left|{{t}}\right|}}+{c}$$
$$\displaystyle=- \ln{{\left|{ \cos{{x}}}\right|}}+{c}$$
Therefore,
$$\displaystyle \ln{{\left|{{y}}\right|}}= \ln{{\left|{ \cos{{x}}}\right|}}+{c}$$
By taking exponents, we obtain
$$\displaystyle{\left|{{y}}\right|}={e}^{{ \ln{{\left|{ \cos{{x}}}\right|}}+{c}}}={\left|{ \cos{{x}}}\right|}\cdot{e}^{c}$$
Hence,we obtain
$$\displaystyle{y}={C} \cos{{x}}$$
where $$\displaystyle{C}\:=\pm{e}^{c}$$ and $$\displaystyle{y}_{{c}}= \cos{{x}}$$ is the compleentary solution
Next, we need to find the particular solution $$y_p$$
Therefore, we consider $$uy_c$$, and try to find w, a function of x, that will make this work.
Let's assume that $$uy_c$$ is a solution of the given equation. Hence, it satisfies the given equation. Substituting $$uy_c$$, and its derivative in the equation gives $$\displaystyle{\left({u}{y}_{{c}}\right)}'+{\left({u}{y}_{{c}}\right)} \tan{{x}}= \sec{{x}}$$
$$\displaystyle{u}'{y}_{{c}}+{u}{y}'_{{c}}+{\left({u}{y}_{{c}}\right)} \tan{{x}}= \sec{{x}}$$
$$\displaystyle{u}'{y}_{{c}}+\underbrace{{{u}{\left({y}'_{{c}}+{\left({y}_{{c}}\right)} \tan{{x}}\right)}}}_{{\text{=0 }\ }}= \sec{{x}}$$
since $$y_c$$ is a solution
Therefore,
$$\displaystyle{u}'{y}_{{c}}= \sec{{x}}\Rightarrow{u}'=\frac{{ \sec{{x}}}}{{y}_{{c}}}$$
which gives
$$\displaystyle{u}=\int\frac{{ \sec{{x}}}}{{{y}_{{c}}}}{\left.{d}{x}\right.}$$
Now, we can find the function u :
$$\displaystyle{u}=\int{\left(\frac{{ \sec{{x}}}}{{ \cos{{x}}}}\right)}{\left.{d}{x}\right.}$$
$$\displaystyle=\int \sec{{x}}\cdot \sec{{x}}{\left.{d}{x}\right.}$$
$$\displaystyle=\int{{\sec}^{2}{x}}{\left.{d}{x}\right.}$$
$$\displaystyle= \tan{{x}}+{c}$$
Since we need to find only one function that will mals this work, we don't need to introduce the constant of integration c. Hence,
$$\displaystyle{u}= \tan{{x}}$$
Recall that $$y_p= uy_c$$. Therefore,
$$\displaystyle{y}_{{p}}= \cos{{x}}\cdot \tan{{x}}$$
$$\displaystyle=\cancel{{ \cos{{x}}}}\cdot\frac{{ \sin{{x}}}}{{\cancel{{ \cos{{x}}}}}}$$
$$\displaystyle= \sin{{x}}$$
The general solution is
$$\displaystyle{y}={C}{y}_{{c}}+{y}_{{p}}$$
$$\displaystyle={C} \cos{{x}}+ \sin{{x}}$$
Integrating Factor technique
This equation is linear with $$\displaystyle{P}{\left({x}\right)}= \tan{{x}}\ \text{ and }\ {Q}{\left({z}\right)}= \sec{{x}}$$
Hence, $$\displaystyle{h}=\int{P}{\left.{d}{x}\right.}=\int \tan{{x}}{\left.{d}{x}\right.}=- \ln{{\left|{ \cos{{x}}}\right|}}$$
So, an integrating factor is
$$\displaystyle{e}^{h}={e}^{{- \ln{{\left|{ \cos{{x}}}\right|}}}}=\frac{1}{{{\left|{ \cos{{x}}}\right|}}}$$
and the general solution is
$$\displaystyle{y}{\left({x}\right)}={e}^{{-{h}}}{\left({c}+\int{Q}{e}^{h}{\left.{d}{x}\right.}\right)}$$
$$\displaystyle={\left|{ \cos{{x}}}\right|}{\left({c}+\int\frac{1}{{{\left|{ \cos{{x}}}\right|}}}\cdot \sec{{x}}{\left.{d}{x}\right.}\right)}$$
$$\displaystyle= \cos{{x}}{\left({C}+ \tan{{x}}\right)}$$
$$\displaystyle={C} \cos{{x}}+ \sin{{x}}$$
When we multiply $$\displaystyle{\left|{ \cos{{x}}}\right|}$$ with a constant c,we can use \displaystyle{C}=\pm{c}\) as a new constant and remove the absolute value, and when we multiply $$\displaystyle{\left|{ \cos{{x}}}\right|}$$ with the integral containing $$\displaystyle{\left|{ \cos{{x}}}\right|}$$, we can remove the absolute value since they have the same sign.
Now, all we need to do is to use the given initial condition to determine the numeric value of C.
Substitute $$\pi$$ for x and 1 for y
$$\displaystyle{1}={C} \cos{\pi}+ \sin{\pi}\Rightarrow{C}=-{1}$$
Hence, the particular solution of the IVP is
$$\displaystyle{y}= \sin{{x}}- \cos{{x}}$$