# Linear Differential Equations

A first-order linear differential equation has the form y'+p(t)y=q(t).

To solve it, rewrite it in the differential form: (dy)/(dt)+p(t)y=q(t), or (p(t)y-q(t))dt+dy=0.

Now, using the facts about exact equations, we see that this equation is not exact. However, since M(t,y)=p(t)y-q(t) and N(t,y)=1, we have that (partial M)/(partial y)=p(t) and (partial N)/(partial x)=0. So, 1/N((partial M)/(partial y)-(partial N)/(partial x))=1/1 (p(t)-0)=p(t). Thus, the integrating factor is I(t,y)=e^(int p(t) dt).

Now, return to the initial equation and multiply it by the integrating factor:

y'e^(int p(t) dt)+p(t)e^(int p(t)dt)y=q(t)e^(int p(t) dt).

Closely looking at the left side, we note that it equals d(ye^(int p(t) dt)).

So, the equation can be rewritten as d(ye^(int p(t) dt))=q(t)e^(int p(t) dt).

Integrating both sides gives ye^(int p(t) dt)=int (q(t)e^(int p(t)dt))dt+C.

Finally, y=e^(-int p(t) dt) int (q(t)e^(int p(t)dt))dt+Ce^(-int p(t) dt).

This formula allows to find solution directly.

Example 1. Solve y'-7y=e^(t).

Here, p(t)=-7, and q(t)=e^t.

So, the solution is

 y=e^(-int -7 dt) int (e^t*e^(int -7dt))dt+Ce^(-int -7 dt)=e^(7t) int (e^(-6t))dt+Ce^(7t)=e^(7t)*(-1/6)e^(-6t)+Ce^(7t)=Ce^(7t)-1/6 e^t

Thus, y=Ce^(7t)-1/6 e^t.

Let's work another quick example.

Example 2. Solve t^2y'-3y-1=0, y(3)=0.

First, rewrite the equation: y'-3/t^2 y=1/t^2.

Here, p(t)=-3/t^2, and q(t)=1/t^2.

So,

y=e^(-int -3/t^2 dt) int (1/t^2 e^(int -3/t^2 dt))dt+Ce^(-int -3/t^2 dt)=e^(-3/t) int (1/t^2 e^(3/t))dt+Ce^(-3/t)=e^(-3/t) *(-1/3)e^(3/t)+Ce^(-3/t)=Ce^(-3/t)-1/3

y=Ce^(-3/t)-1/3.

To find the particular solution, plug in the initial condition:

0=Ce^(-3/3)-1/3 or C=e/3

Finally, y=e/3 e^(-3/t)-1/3=1/3 (e^(1-3/t)-1).