# First-Order Linear Differential Equations

The firs-order differential equation $\frac{dy}{dx}=f(x,y)$ is called linear if $f(x,y)$ is linear in $y$. Hence, a first-order linear differential equation can be written as \begin{equation}\label{eq:folde}\frac{dy}{dx}+P(x)y=Q(x)\end{equation} If $Q(x)=0$, \eqref{eq:folde} is separable. If $P(x)$ and $Q(x)$ both are constants, \eqref{eq:folde} is separable. Now we assume that \eqref{eq:folde} is not separable. Consider a function $\mu(x)$ which is unbeknown to us at the moment and multiply \eqref
{eq:folde3} by $\mu(x)$. \begin{equation}\label{eq:folde2}\mu(x)\frac{dy}{dx}+\mu(x)P(x)y=\mu(x)Q(x)\end{equation} On the other hand, we have $$\frac{d\mu y}{dx}=\frac{d\mu }{dx}y+\mu\frac{dy}{dx}$$ So \eqref{eq:folde2} can be writtend as \begin{equation}\label{eq:folde3}\frac{d\mu y}{dx}+y\left[-\frac{d\mu}{dx}+\mu P\right]=\mu Q\end{equation}  If \begin{equation}\label{eq:intfact}-\frac{d\mu}{dx}+\mu P=0\end{equation} then \eqref{eq:folde3} becomes separable and its solution is given by \begin{equation}\label{eq:foldesol}y=\frac{\int\mu Qdx}{\mu}\end{equation} \eqref{eq:intfact} is separable and its solution $\mu(x)$ is given by \begin{equation}\label{eq:intfact2}\mu(x)=e^{\int P(x)dx}\end{equation} The function $\mu(x)$ in \eqref{eq:intfact2} is called the integrating factor.

Example. Solve $\frac{dy}{dx}\sin x=y\cos x+\tan x$

Solution. First write the equation in the standard form \eqref{eq:folde}. $$\frac{dy}{dx}-\cot x y=\sec x$$ Hence $P(x)=-\cot x$ and $Q(x)=\sec x$. $$\int P(x)dx=-\int\cot xdx=-\ln \sin x=\in\csc x$$ and so the integrating factor $\mu(x)$ is given by $$\mu(x)=e^{\ln \csc x}=\csc x$$ and \begin{align*}y(x)&=\frac{\int\mu Qdx}{\mu}\\&=\frac{\csc x\sec xdx}{\csc x}\\&=\sin x\int\frac{dx}{\sin x\cos x}\\&=\sin x[\ln(\tan x)+C]\end{align*}

Example. Solve the initial value problem \begin{align*}ty’+2y&=4t^2\\y(1)&=2\end{align*}

Solution. First write the equation in the standard form \eqref{eq:folde}. $$y’+\frac{2}{t}y=4t$$ and so $P(t)=\frac{2}{t}$ and $Q(t)=4t$. The integrating factor $\mu(t)$ is given by $$\mu(t)=e^{\int\frac{2}{t}dt}=e^{\ln t^2}=t^2$$ \begin{align*}y&=\frac{\int\mu Qdx}{\mu}\\&=\frac{\int 4t^3dt}{t^2}\\&=t^2+\frac{C}{t^2}\end{align*} Since $y(1)=2$, 2=1+C i.e. C=1. Therefore the solution to the initial value problem is $$y(t)=t^2+\frac{1}{t^2}$$

Example. [RL Circuit] For a resistance-inductance circuit, Kirchhoff;s law leads to the first-order linear differential equation $$L\frac{dI(t)}{dt}+RI(t)=V(t)$$ for the current $I(t)$, where $L$ is the inductance and $R$ is the resistance, both constants. $V(t)$ is the time-dependent impressed voltage. The integrating factor $\mu(t)$ is given by $$\mu(t)=e^{\int\frac{R}{L}dt}=e^{\frac{R}{L}t}$$ and hence the current $I(t)$ is found to be \begin{align*}I(t)&=\frac{\int\mu Qdt}{\mu}\\&=\frac{\int e^{\frac{R}{L}t}\frac{V(t)}{L}dt}{e^{\frac{R}{L}t}}\\&=\frac{e^{-\frac{R}{L}t}}{L}\int e^{\frac{R}{L}t}V(t)dt\end{align*} For the special case $V(t)=V_0$, a constant $$I(t)=\frac{V_0}{R}+e^{-\frac{R}{L}t}C$$ If the initial condition is $I(0)=0$, then $C=-\frac{V_0}{R}$ and hence $$I(t)=\frac{V_0}{R}(1-e^{-\frac{R}{L}t})$$