An equation with one or more terms, consisting of the derivatives of the dependent variable with respect to one or more independent variables is known as a differential equation.

**dy/dx + Py = Q** where y is a function and dy/dx is a derivative.

The solution of this differential equation produces the value of variable y. In this article, we will learn to solve linear and first-order differential equations step by step along with solved examples.

**Table of contents:**

## Linear Differential Equations Definition

A linear differential equation is defined by the linear polynomial equation, which consists of derivatives of several variables. It is also stated as Linear Partial Differential Equation when the function is dependent on variables and derivatives are partial in nature.

A differential equation having the above form is known as the first-order linear differential equationÂ where P and Q are either constants or functions of the independent variable (in this case x) only.

Also, the differential equation of the form,Â dy/dx + Py = Q, is aÂ Â * first-order linear differential equation* where P and Q are either constants or functions of y (independent variable) only.

To find **linear differential equations solution,** we have to derive the general form or representation of the solution.

## Solving Differential Equations

For finding the solution of such linear differential equations, we determine a function of the independent variable let us say M(x), which is known as the Integrating factor(I.F).

Multiplying both sides of equation (1) with the integrating factor M(x) we get;

M(x)dy/dx + M(x)Py = QM(x) Â …..(2)

Now we chose M(x) in such a way that the L.H.S of equation (2) becomes the derivative of y.M(x)

i.e.Â Â Â d(yM(x))/dx = (M(x))dy/dx + y (d(M(x)))dx … (Using d(uv)/dxÂ Â = v(du/dx)Â Â +Â u(dv/dx)

â‡’ M(x) /(dy/dx) + M(x)Py = M (x) dy/dx + y d(M(x))/dx

â‡’M(x)Py = y dM(x)/dx

â‡’1/M'(x) = P.dxÂ

Integrating both sides with respect to x, we get;

log M (x) = \( \int Pdx (As \int \frac {f'(x)}{f(x)} ) = log f(x) \)

â‡’ M(x) = \( e^{\int Pdx} \) I.F

Now, using this value of the integrating factor, we can find out the solution of our first order linear differential equation.

Multiplying both the sides of equation (1) by the I.F. we get

\( e^{\int Pdx}\frac{dy}{dx} + yPe^{\int Pdx} = Qe^{\int Pdx} \)

This could be easily rewritten as:

\( \frac {d(y.e^{\int Pdx}}{dx} = Qe^{\int Pdx} (Using \frac{d(uv)}{dx} = v \frac{du}{dx} + u\frac{dv}{dx} ) \)

Now integrating both the sides with respect to x, we get:

\( \int d(y.e^{\int Pdx }) = \int Qe^{\int Pdx}dx + c \)

\( y = \frac {1}{e^{\int Pdx}} (\int Qe^{\int Pdx}dx + c )\)

where C is some arbitrary constant.

## How to Solve First Order Linear Differential Equation

Learn to solve first-order differential equation with the help of following below given steps.

- Rearrange the terms of the given equation in the form dy/dx + Py = Q

Â Â Â Â Â where P and Q are constants or functions of the independent variable x only.

- To obtain the integrating factor, integrate P (obtained in step 1) with respect to x and put this integral as a power to e.

\( e^{\int Pdx} \) = I.F

- Multiply both the sides of theÂ linear first-order differential equation with the I.F.

\( e^{\int Pdx} \frac{dy}{dx} + yPe^{\int Pdx} = Qe^{\int Pdx} \)

- The L.H.S of the equation is always a derivative of y Ã— M (x)

i.e. L.H.S = d(y Ã— I.F)/dx

d(y Ã— I.F)dx = Q Ã— I.FÂ

- In the last step, we simply integrate both the sides with respect to x and get a constant term c to get the solution.

âˆ´ y Ã— I.F = \( \int Q Ã— I.F dx + c \) ,

where C is some arbitrary constant

Similarly, we can also solve the other form of linear first-order differential equation dx/dy +Px = Q using the same steps. In this form P and Q are the functions of y. The integrating factor (I.F) comes out to be Â and using this we find out the solution which will be

**(x) Ã— (I.F) = \( \int Q Ã— I.F dy + c \)**

Now, to get a better insight into the linear differential equation, let us try solving some questions. where C is some arbitrary constant.

## Examples of Solving Differential Equations

**Example 1:Â Solve theÂ LDEÂ = Â dy/dx = 1/1+x ^{8} – 3x^{2}/(1 + x^{2})**

**Solution:**

The above mentioned equation can be rewritten as Â dy/dx + 3x^{2}/1 + x^{2}} y = 1/1+x^{3}

Comparing it withÂ dy/dx + Py = O, we get

P= 3x^{2}/1+x^{3}

Q= 1/1 + x^{3}

Letâ€™s figure out the integrating factor(I.F.) which is \( e^{\int Pdx} \)

â‡’I.F Â = Â \( e^{\int \frac {3x^2}{1 + x^3}} dx = e^{ln (1 + x^3)} \)

â‡’I.F. = 1 + x^{3}

Now, we can also rewrite the L.H.S as:

d(y Ã— I.F)/dx,Â

d(y Ã— I.F.)/dx},Â

â‡’ d(y Ã— (1 + x^{3}))dx = 1/1 +x^{3} Ã— (1 + x^{3})

Integrating both the sides w. r. t. x, we get,

â‡’ yÂ Ã— Â ( 1 + x^{3}) =Â Â 1dxÂ

â‡’ y = x/1 + x^{3} = xÂ

â‡’ y =x/1 + x^{3Â }+ cÂ

**Example 2:**

**Solve the following differential equation Â dy/dx + (sec x)y = 7Â **

**Solution:**

Comparing the given equation with dy/dx + Py = QÂ

We see,Â P = secÂ x, Q = 7

Now lets find out the integrating factor using the formula

\( e^{\int Pdx} \)= I.F

â‡’\( e^{\int secdx} \) Â = I.F.

â‡’I.F. = Â \( e^{ln |sec x + tan x |} = sec x + tan x Â \)

Now we can also rewrite the L.H.S as

d(yÂ Ã— I.F)/dx},

i.e . d(y Ã— (sec x + tan x ))

â‡’d(y Ã— (sec x + tan x ))/dx = 7(sec x + tan x)Â

Integrating both the sides w. r. t. x, we get,

\( Â \int d ( yÂ Ã— (sec x + tan x )) = \int 7(sec x + tan x) dx \)

\( \Rightarrow yÂ Ã— (sec x + tan x) = 7 (ln|sec x + tan x| + log |sec x| ) \)

â‡’ Â y = \( \frac {7(ln|sec x + tan x| + log|sec x| }{(sec x + tan x)} + c \)

**Example 3:**

**A curve is passing through the origin and the slope of the tangent at a point R(x,y) where -1<x<1 is given as (x ^{4} + 2xy + 1)/(1 – x^{2}). What will be the equation of the curve?**

**Solution:**

We know that the slope of the tangent at (x,y) is,

tanÆŸ= dy/dx = x^{4} + 2xy + 1/1 – x^{2}

Reframing the equation in the form dy/dxÂ + Py = Q Â , we get

dy/dx = 2xy/(1 – x^{2}Â + x^{4} + 1)/(1 – x^{2})

â‡’dy/dx – 2xy/(1 – x^{2}) = (x^{4} + 1)/(1 – x^{2})

Comparing we get P = -2x/(1 – x^{2})

Q =(x^{4} + 1)/(1 – x^{2})

Now, letâ€™s find out the integrating factor using the formula.

\( e^{\int Pdx} \)= I.F

â‡’ \( e^{\int \frac{-2x}{1-x^2}}dx = e^{ln (1 – x^2)} = 1 – x^2 \)Â I.F

Now we can also rewrite the L.H.S as

\( \frac {d(y Ã— I.F)}{dx}, \)

i.e \( \frac{d(y Ã— (1 – x^2))}{dx} = \frac{x^4 + 1}{1 – x^2}Â Ã— 1 – x^2 \)

Integrating both the sides w. r. t. x, we get,

\( \int d(yÂ Ã— (1 – x^2)) = \int \frac{x^4 + 1}{1 – x^2}Â Ã— (1 – x^2 )dx \)

\( \Rightarrow yÂ Ã— (1 – x^2) = \int x^4 + 1 dx Â \) Â ……(1)

Â x (1 – x^{2}) = x^{5}/5 + x + c

â‡’ y =Â x^{5}/5 + x/(1 – x^{2)}+CÂ

It is the required equation of the curve. Also as the curve passes through origin; substitute the values as x=0, y=0 in the above equation. Thus,C=0.

Hence, equation of the curve is: Â â‡’ y =Â x^{5}/5 + x/(1 – x^{2})