# Solve the linear equations by considering y as a function of x, that is, y = y(x). displaystylefrac{{{left.{d}{y}right.}}}{{{left.{d}{x}right.}}}+frac{y}{{x}}=frac{{ cos{{x}}}}{{x}},{y}{left(frac{pi}{{2}}right)}=frac{4}{pi},{x}>{0}

Solve the linear equations by considering y as a function of x, that is, $$y = y(x)$$.
$$\displaystyle\frac{{{\left.{d}{y}\right.}}}{{{\left.{d}{x}\right.}}}+\frac{y}{{x}}=\frac{{ \cos{{x}}}}{{x}},{y}{\left(\frac{\pi}{{2}}\right)}=\frac{4}{\pi},{x}>{0}$$

• Questions are typically answered in as fast as 30 minutes

### 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.

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.}}}=-\frac{y}{{x}}\Leftrightarrow\frac{{{\left.{d}{y}\right.}}}{{y}}=-\frac{{{\left.{d}{x}\right.}}}{{x}}$$
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\frac{{{\left.{d}{x}\right.}}}{{x}}$$
which is
$$\displaystyle \ln{{\left|{{y}}\right|}}=- \ln{{\left|{{x}}\right|}}+{c}$$
By taking exponents, we obtain
$$\displaystyle{\left|{{y}}\right|}={e}^{{- \ln{{\left|{{x}}\right|}}+{c}}}=\frac{1}{{{\left|{{x}}\right|}}}\cdot{e}^{c}$$
Hence,we obtain
$$\displaystyle{y}=\frac{1}{{\frac{1}{{C}}{x}}}$$
where $$\displaystyle{C}\:=\pm{e}^{c}$$ and $$\displaystyle{y}_{{c}}=\frac{1}{{x}}$$ is the complementary solution .
Next, we need to find the particular solution $$y_p$$
Therefore, we consider $$uy_c$$ , and try to find u, a function of x, that will make this work.
Let’s assume that $$uy_c$$, is « 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)}'+\frac{{{u}{y}_{{c}}}}{{x}}=\frac{{ \cos{{x}}}}{{x}}$$
$$\displaystyle{u}'{y}_{{c}}+{u}{y}'_{{c}}+\frac{{{u}{y}_{{c}}}}{{x}}=\frac{{ \cos{{x}}}}{{x}}$$
$$\displaystyle{u}'{y}_{{c}}+\underbrace{{{u}{\left({y}'_{{c}}+\frac{{{y}_{{c}}}}{{x}}\right)}}}_{{\text{=0 }\ }}=\frac{{ \cos{{x}}}}{{x}}$$
since $$y_c$$ is a solution
Step 2
Therefore, $$\displaystyle{u}'{y}_{{c}}=\frac{{ \cos{{x}}}}{{x}}\Rightarrow{u}'=\frac{{\frac{{ \cos{{x}}}}{{x}}}}{{y}_{{c}}}$$
which gives
$$\displaystyle{u}=\int\frac{{\frac{{ \cos{{x}}}}{{x}}}}{{y}_{{c}}}{\left.{d}{x}\right.}$$
Now, we can find the function u:
$$\displaystyle{u}=\int\frac{{\frac{{ \cos{{x}}}}{{x}}}}{{\frac{1}{{x}}}}{\left.{d}{x}\right.}$$
$$\displaystyle=\int\frac{{cancel\ {{{x}}}{\cos}}}{cancel\ {{{x}}}}{\left.{d}{x}\right.}$$
$$\displaystyle=\int \cos{{x}}{\left.{d}{x}\right.}$$
$$\displaystyle= \sin{{x}}+{c}$$
Since we need to find only one function that will male this work, we don’t need to introduce the constant of integration c. Hence,
$$\displaystyle{u}= \sin{{x}}$$
Recall that $$y_p=uy_c$$
Therefore,
$$\displaystyle{y}_{{p}}=\frac{{ \sin{{x}}}}{{x}}$$
The general solution is
$$\displaystyle{y}={C}{y}_{{c}}+{y}_{{p}}$$
$$\displaystyle=\frac{C}{{x}}+\frac{{ \sin{{x}}}}{{x}}$$
$$\displaystyle=\frac{1}{{x}}{\left({C}+ \sin{{x}}\right)}$$
Integrating Factor technique
this equation is linear with $$\displaystyle{P}{\left({x}\right)}=\frac{1}{{x}}$$ and $$\displaystyle{Q}{\left({x}\right)}=\frac{{ \cos{{x}}}}{{x}}$$
Hence,
$$\displaystyle{h}=\int\frac{1}{{x}}{\left.{d}{x}\right.}= \ln{{\left|{{x}}\right|}}$$
So, an integrating factor is
$$\displaystyle{e}^{h}={e}^{{ \ln{{\left|{{x}}\right|}}}}={\left|{{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=\frac{1}{{{\left|{{x}}\right|}}}{\left({c}+\int{\left|{{x}}\right|}\cdot\frac{{ \cos{{x}}}}{{x}}{\left.{d}{x}\right.}\right)}$$
$$\displaystyle=\frac{1}{{x}}{\left({C}+\int \cos{{x}}{\left.{d}{x}\right.}\right)}$$
$$\displaystyle=\frac{1}{{x}}{\left({C}+ \sin{{x}}\right)}$$
When we multiply $$\displaystyle{\left|{{z}}\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|{{z}}\right|}$$ with the integral containing $$\displaystyle{\left|{{z}}\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 $$\displaystyle\frac{\pi}{{2}}\ \text{ for }\ {x}\ \text{ and }\ \frac{4}{\pi}\ \text{ for }\ {y}$$
$$\displaystyle\frac{4}{\pi}=\frac{1}{{\frac{\pi}{{2}}}}{\left({C}+ \sin{\ }\frac{\pi}{{2}}\right)}\Rightarrow\frac{4}{\pi}=\frac{2}{\pi}{\left({C}+{1}\right)}$$
$$\displaystyle\Rightarrow{2}={C}+{1}$$
$$\displaystyle\Rightarrow{C}={1}$$
Therefore . the particular solution of the IVP is
$$\displaystyle{y}=\frac{1}{{x}}{\left( \sin{{x}}+{1}\right)}$$