# Linear Differential Equations

A first-order linear differential equation has the form ${y}'+{p}{\left({t}\right)}{y}={q}{\left({t}\right)}$.

To solve it, rewrite it in the differential form: $\frac{{{d}{y}}}{{{d}{t}}}+{p}{\left({t}\right)}{y}={q}{\left({t}\right)}$, or ${\left({p}{\left({t}\right)}{y}-{q}{\left({t}\right)}\right)}{d}{t}+{d}{y}={0}$.

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

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

${y}'{{e}}^{{\int{p}{\left({t}\right)}{d}{t}}}+{p}{\left({t}\right)}{{e}}^{{\int{p}{\left({t}\right)}{d}{t}}}{y}={q}{\left({t}\right)}{{e}}^{{\int{p}{\left({t}\right)}{d}{t}}}$.

Closely looking at the left side, we note that it equals ${d}{\left({y}{{e}}^{{\int{p}{\left({t}\right)}{d}{t}}}\right)}$.

So, the equation can be rewritten as ${d}{\left({y}{{e}}^{{\int{p}{\left({t}\right)}{d}{t}}}\right)}={q}{\left({t}\right)}{{e}}^{{\int{p}{\left({t}\right)}{d}{t}}}$.

Integrating both sides gives ${y}{{e}}^{{\int{p}{\left({t}\right)}{d}{t}}}=\int{\left({q}{\left({t}\right)}{{e}}^{{\int{p}{\left({t}\right)}{d}{t}}}\right)}{d}{t}+{C}$.

Finally, ${y}={{e}}^{{-\int{p}{\left({t}\right)}{d}{t}}}\int{\left({q}{\left({t}\right)}{{e}}^{{\int{p}{\left({t}\right)}{d}{t}}}\right)}{d}{t}+{C}{{e}}^{{-\int{p}{\left({t}\right)}{d}{t}}}$.

This formula allows to find the solution directly.

Example 1. Solve ${y}'-{7}{y}={{e}}^{{{t}}}$.

Here, ${p}{\left({t}\right)}=-{7}$, and ${q}{\left({t}\right)}={{e}}^{{t}}$.

So, the solution is

${y}={{e}}^{{-\int-{7}{d}{t}}}\int{\left({{e}}^{{t}}\cdot{{e}}^{{\int-{7}{d}{t}}}\right)}{d}{t}+{C}{{e}}^{{-\int-{7}{d}{t}}}={{e}}^{{{7}{t}}}\int{\left({{e}}^{{-{6}{t}}}\right)}{d}{t}+{C}{{e}}^{{{7}{t}}}={{e}}^{{{7}{t}}}\cdot{\left(-\frac{{1}}{{6}}\right)}{{e}}^{{-{6}{t}}}+{C}{{e}}^{{{7}{t}}}={C}{{e}}^{{{7}{t}}}-\frac{{1}}{{6}}{{e}}^{{t}}$

Thus, ${y}={C}{{e}}^{{{7}{t}}}-\frac{{1}}{{6}}{{e}}^{{t}}$.

Let's work another quick example.

Example 2. Solve ${{t}}^{{2}}{y}'-{3}{y}-{1}={0}$, ${y}{\left({3}\right)}={0}$.

First, rewrite the equation: ${y}'-\frac{{3}}{{{t}}^{{2}}}{y}=\frac{{1}}{{{t}}^{{2}}}$.

Here, ${p}{\left({t}\right)}=-\frac{{3}}{{{t}}^{{2}}}$, and ${q}{\left({t}\right)}=\frac{{1}}{{{t}}^{{2}}}$.

So,

${y}={{e}}^{{-\int-\frac{{3}}{{{t}}^{{2}}}{d}{t}}}\int{\left(\frac{{1}}{{{t}}^{{2}}}{{e}}^{{\int-\frac{{3}}{{{t}}^{{2}}}{d}{t}}}\right)}{d}{t}+{C}{{e}}^{{-\int-\frac{{3}}{{{t}}^{{2}}}{d}{t}}}={{e}}^{{-\frac{{3}}{{t}}}}\int{\left(\frac{{1}}{{{t}}^{{2}}}{{e}}^{{\frac{{3}}{{t}}}}\right)}{d}{t}+{C}{{e}}^{{-\frac{{3}}{{t}}}}={{e}}^{{-\frac{{3}}{{t}}}}\cdot{\left(-\frac{{1}}{{3}}\right)}{{e}}^{{\frac{{3}}{{t}}}}+{C}{{e}}^{{-\frac{{3}}{{t}}}}={C}{{e}}^{{-\frac{{3}}{{t}}}}-\frac{{1}}{{3}}$

${y}={C}{{e}}^{{-\frac{{3}}{{t}}}}-\frac{{1}}{{3}}$.

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

${0}={C}{{e}}^{{-\frac{{3}}{{3}}}}-\frac{{1}}{{3}}$ or ${C}=\frac{{e}}{{3}}$

Finally, ${y}=\frac{{e}}{{3}}{{e}}^{{-\frac{{3}}{{t}}}}-\frac{{1}}{{3}}=\frac{{1}}{{3}}{\left({{e}}^{{{1}-\frac{{3}}{{t}}}}-{1}\right)}$.