Differential Equations: First-Order Linear

A linear first-order differential equation is one that is in the form, or can be placed in the form, $$\frac{dy}{dx} +p(x)\,y=q(x).$$ The ease with which a linear equation can be solved is very dependent on the form in which it is presented. For example, consider the two equations

\begin{eqnarray} (\cos x) \, \frac{dy}{dx}+(\sin x)\, y &=& 1,\\ (\sec x) \, \frac{dy}{dx}+(\sec x\,\tan x)\, y &=& \sec^2 x,\\ \end{eqnarray}

These two equations are actually equivalent: both may be reduced, by dividing throughout by the coefficient of dy/dx, to $$\frac{dy}{dx}+(\tan x)\,y=\sec x.$$ Yet the first equation is very difficult to deal with as it stands, whereas the second is easy. That's because the left-hand-side of the second happens to be what we call exact: that is, it's equal to the derivative of something. The expression $$(\sec x) \, \frac{dy}{dx}+(\sec x\,\tan x)\, y$$ happens to be equal to $$\frac{d}{dx} [(\sec x)\,y].$$ The reason this is such an advantage is that since we know that $$\frac{d}{dx} [(\sec x)\,y]=\sec^2 x,$$ we can simply integrate both sides to obtain $$(\sec x)\,y=\tan x + c,$$ and our solution is $$y=\sin x + c\,\cos x.$$ So: what we need is a reliable way of taking linear differential equations and rearranging them so that their left-hand-sides are exact. The following technique will work every time, as long as you can do the integrals.

  1. Put the equation in the form $$\frac{dy}{dx}+p(x)\,y=q(x).$$ (If it can't be put in this form it's not linear, and this method isn't appropriate in the first place.)

  2. ntegrate p(x) with respect to x (actually, all you need to do is find any antiderivative: anything that differentiates to give p(x)).

  3. Raise e to the power of this antiderivative to obtain what we call the integrating factor, I(x).

  4. Multiply throughout by I(x).

  5. The left-hand-side is now guaranteed to be the exact derivative of $$I(x)\,y,$$ and the solution of the differential equation is $$I(x)\,y = \int I(x)\,q(x)\,dx.$$

So, for example, consider the differential equation $$x\,\frac{dy}{dx}-y==x^2.$$

  1. We first put the equation into our standard form: $$\frac{dy}{dx}-\frac{1}{x}\,y=x.$$

  2. Now, $$\int -\frac{1}{x}\,dx = -\ln |x|+c,$$ so a suitable antiderivative is -\ln x.

  3. Our integrating factor is $$e^{-\ln x} = \frac{1}{e^{\ln x}} = \frac{1}{x}.$$

  4. Multiplying throughout by 1/x gives $$\frac{1}{x}\,\frac{dy}{dx}-\frac{1}{x^2}\,y=1.$$

  5. This is the same as $$\frac{d}{dx}\left(\frac{1}{x}\,y\right) = 1.$$ Integrating both sides, we obtain $$\frac{1}{x}\,y=x+c,$$ and therefore $$y=x^2+c x.$$

If we're also told, for example, that y(1)=0, then we can calculate the value of c. From our solution, $$0=1+c,$$ and therefore c=-1 and $$y=x^2-x.$$