Skip to content

First Order Linear Differential Equation

Differential Solution

In this theoretical article we will try to solve as easier as possible a generic first order differential equation.
This equation is always there to ruin our days 😆
If you try to solve a simple RC circuit is there and waiting for you.
It is quite annoying how many times you will find it at your way so we decided to solve this equation even for people who does not have a lot mathematical knowledge.
Lets start.

This is a generic First Order Linear Differential Equation

{{dy} \over {dx}} + P(x)y = Q(x)

Another way to remember it is

y' + P(x)y = Q(x)

So as you can see it is a first order differential equation since the y function is only derivated once.

The first step to solve this equation is to multiply all members with a function called u(x)

  u(x){{dy} \over {dx}} + u(x)P(x)y = u(x)Q(x)  (1)

 

Let's remember the product rule of the derivative :

  {{d(f(x)g(x))} \over {dx}} = f(x){{d(g(x))} \over {dx}} + g(x){{d(f(x))} \over {dx}}

So in our case we can see that the product derivative rule between u(x)*y gives us

  {{d(u(x)y)} \over {dx}} = u(x){{dy} \over {dx}} + y{{d(u(x))} \over {dx}}  (2)

The second part of the formula (2) is extremely the same with the fisrt part of the formula (1)

In order to be equal the two parts we have to dimension correctly P(x)

  y{{d(u(x))} \over {dx}} = u(x)P(x)y \Rightarrow {{d(u(x))} \over {dx}} = u(x)P(x)

So we have to dimension P(x) like this formula below :

P(x) = {1 \over {u(x)}}{{d(u(x))} \over {dx}} (3)

P(x) is known , on the other hand u(x) is not. So we have to solve the equation (3) by integrating both parts

\int {P(x)} dx = \int {{1 \over {u(x)}}{{d(u(x))} \over {dx}}} dx = \int {{1 \over u}du} (4)

Time to remember that :

{{d\ln u} \over {du}} = {1 \over u}

So integrating both parts we get

\int {{{d\ln u} \over {du}}du = } \ln u = \int {{1 \over u}} du + C (5)

Knowing (4) and (5) we get

\ln u(x) = \int {P(x)dx} + C (6)

From the definition of the logarithm we know that

ln x=y \Leftrightarrow x= e^y

So using the logarithm definition from (6) and setting C=0 we get

u(x) = e^{\int {P(x)dx} } (7)

So setting

u(x) = e^{\int {P(x)dx} }

we get from (1) and (2)

{{d(u(x)y)} \over {dx}} = u(x)Q(x)

Integrating both parts we get

u(x)y = \int {u(x)Q(x)dx} + C

So the solution of the differential equation is :

y = {1 \over {e^{\int {P(x)dx} } }}\left( {\int {Q(x)e^{\int {P(x)dx} } dx} + C} \right)

In the next page we will se some particular cases of this generic solution.