Solution for dx/dy + px = q

Solution for dx/dy + px = q, where p and q are functions of y or constants

A differential equation is called linear if there are no multiplications among dependent variables and their derivatives. In other words, all coefficients are functions of independent variables. It can be written in two forms. The second is discussed in detail here.


Such that, P and Q are either constants or functions of y variable only. This type of differential equation is called a first-order linear differential equation. To solve this type of equation, we first multiply both the sides of the equation by a function of y: g(y):


The function $g(x)$ is chosen such that RHS becomes the derivative of y.$g(x)$



Now we integrate both the sides with respect to x to obtain:

$\int{Pdy}=\log (g(y))$


$g(y)= e^{\int{P dy}}$

$e^{\int{P dy}}\frac{dx}{dy}+Pe^{\int{P dy}}x=Qe^{\int{P dy}}$

$\frac{d}{dx}(xe^{\int{P dy}})=Qe^{\int{P dy}}$

By integrating both equations we obtain:

$xe^{\int{P dy}}=\int{(Qe^{\int{P dy}})dy}$

$y=e^{-\int{P dy}}\cdot \int{Qe^{\int{P dy}}}dy+C$

Steps used to solve first-order linear differential equation are as follows:

(i) Write the given differential equation in the following first-order linear DE form $\frac{dx}{dy}+Px=Q$

where P, Q are constants or functions of y only.

(ii) Find the Integrating Factor (IF): $e^{\int{P dy}}$

(iii) Write the solution of the given differential equation using IF in the following manner: $x(IF)=\int{(Q\times IF)dy+C}$

Example: Find the general solution of the linear DE: $y dx-(x+2y^{2})dy=0$

This equation can be written in the form: $\frac{dx}{dy}-\frac{x}{y}=2y$

This is a linear differential equation of the type discussed above: $\frac{dx}{dy}+Px=Q$

Here P = -1/y and Q = 2y which are both functions of y.

$IF=e^{\int{P dy}}=e^{\int{-\frac{1}{y} dy}}=e^{-\log y}=\frac{1}{y}$

Hence, the solution of the given differential equation can be written as:

$x\frac{1}{y}=\int{2y (\frac{1}{y})dy+c}$



Integrating the equation gives:


Hence we can write:


Since c is also a function of y. This is the general solution of the linear DE.

Example: Solve the given differential equation: $(tan^{-1}y-x)dy=(1+y^{2})dx$

We can write this equation in a linear form, such that: $\frac{dx}{dy}+\frac{x}{1+y^{2}}=\frac{\tan ^{-1}y}{1+y^{2}}$

In this case, we identify that P = $\frac{1}{1+y^{2}}$ and Q = $\frac{\tan ^{-1}y}{1+y^{2}}$ where P and Q are both functions of y

Hence we can write the equation using the integrating factor:

$IF=e^{\int{\frac{1}{1+y^{2}}dy}}=e^{\tan ^{-1}y}$

Now we can write the given differential equation is:

$xe^{\tan ^{-1}y}=\int{\frac{\tan ^{-1}y}{1+y^{2}}e^{\tan ^{-1}y}dy+c}$

Now let S = $\int{\frac{\tan ^{-1}y}{1+y^{2}}e^{\tan ^{-1}y}dy}$

Substituting $\tan ^{-1}y=t$, such that $\frac{1}{1+y^{2}}dy=dt$

Now, we get:

S = $\int{\frac{\tan ^{-1}y}{1+y^{2}}e^{\tan ^{-1}y}dy=\int{te^{t}dt}}$


$S=e^{\tan ^{-1}y}(\tan ^{-1}y-1)$

Now we substitute the value of S in the differential equation:

$x e^{\tan ^{-1}y}= e^{\tan ^{-1}y}(\tan ^{-1}y-1)+c$

Hence the general solution for the differential equation is:

$x=(\tan ^{-1}y)+ce^{\tan ^{-1}y}$


Please Share