# What is the general solution of the differential equation ? #xdy/dx=2/x+2-y# given that #x=-1,y=0#

##### 1 Answer

# y = (ln|x| + x + 1)/x#

#### Explanation:

We have:

# xdy/dx=2/x+2-y # ..... [A]

We can rearrange [A] as follows:

# dy/dx=2/x^2 + 2/x - y/x #

# dy/dx + y/x = 2/x^2 + 2/x # ..... [B]

We can use an integrating factor when we have a First Order Linear non-homogeneous Ordinary Differential Equation of the form;

# dy/dx + P(x)y=Q(x) #

So we form an Integrating Factor;

# I = e^(int P(x) dx) #

# \ \ = exp( int \ 1/x \ dx) #

# \ \ = exp( lnx ) #

# \ \ = x #

And if we multiply the DE [B] by this Integrating Factor,

# \ \ x \ dy/dx + y = 2/x+2x #

# :. d/dx( x y ) = 2/x+2 #

Which we can directly integrate to get:

# xy = int \ 2/x+2x \ dx #

# \ \ \ \ = 2ln|x| + 2x + C#

Using the initial Condition,

# 0 = 2ln|1| - 2 + C => C = 2#

Leading to the General Solution:

# xy = 2ln|x| + 2x + 2#

# => y = (ln|x| + x + 1)/x#