# Linear Differential Equations

A first-order linear differential equation has 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` then `(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, integrating factor `I(t,y)=e^(int p(t) dt)` .

Now, return to initial equation and multiply it by 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, 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, 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`.

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

First rewrite 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 particular solution, plug in 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)`