First Order Linear Equations

The following are some examples of first-order linear differential equations (FOLDE):

  1. y+1xy=2y'+\dfrac{1}{x}y=2
  2. y+3x2y=6x2y'+3 x^2 y=6x^2
  3. y+2y=2exy'+2y=2e^x
  4. xy2y=x2xy'−2y=x^2

The general form is y+P(x)y=Q(x),y'+P(x)y=Q(x), where P(x)P(x) and Q(x)Q(x) are continuous, but not necessarily linear. These are called linear differential equations because they are linear with respect to y,y, meaning that they can be written in precisely this form. Notice that the last example above isn't in this form, but it can be easily rewritten in the proper form by dividing each term by x.x.

Procedure

First, we'll work through the first example above, skimming over some details. Once we've seen a full problem worked out, it will be easier to go back and fill in those details. We begin, then, with the following differential equation: y+1xy=2y'+\dfrac{1}{x}y=2

Without explaining why (this is what we'll come back to), I'll multiply every term in the equation by xx; this is what we call the integrating factor, because it will help us get to a point where we can solve by integrating. After doing this, we have xy+y=2x.xy'+y=2x.

How does this help? Notice that the left-hand side is equal to (xy)(xy)' (check this using the Product Rule). We'll see this in the other examples we do, but once we know what the integrating factor is, multiplying it on both sides will always make the left-hand side (assuming we've written the differential equation in standard FOLDE form) equal to the derivative of the integrating factor times y.y. In any case, now we have (xy)=2x(xy)'=2x which we can integrate with respect to xx in order to undo the derivative.

xy=2x dx=x2+Cxy = \int 2x\ dx = x^2+C

Finally, to solve for y,y, simply divide by xx: y=x+Cx\ans{y = x + \dfrac{C}{x}} If we had an initial condition to go with this problem, we could then solve for CC as usual.

Integrating Factor: I=e P(x) dxI=e^{\ \int P(x)\ dx}

The one point that we didn't see in detail was where the integrating factor came from in that example. The integrating factor can always be found by first writing the FOLDE in its standard form: y+P(x)y=Q(x)y'+P(x)y=Q(x) in which case the integrating factor is I(x)=eP(x) dxI(x) = e^{\int P(x)\ dx}

Why?

To be honest, you can skip this section and go on to the examples if you like; as long as you memorize how to find the integrating factor, you don't need to worry about where it came from. I believe in being thorough, though, and showing that nothing in math comes out of the blue.

To see where I(x)I(x) came from, think about what we wanted: we wanted the left-hand side to collapse to (I(x)y),(I(x)y)', so we want I(x)[y+P(x)y]=[I(x)y]I(x)\left[y'+P(x)y\right]=[I(x)y]'

Let's start from here and simplify things until it becomes clear what I(x)I(x) must be.

I(x)y+I(x)P(x)y=I(x)y+I(x)yI(x)P(x)y=I(x)yI(x)P(x)=I(x)(a separable eq in terms of I)I(x)P(x)=dIdxP(x) dx=1I dIP(x) dx=lnII=eP(x) dx\begin{aligned} I(x)y' + I(x)P(x)y &= I(x)y' + I'(x)y\ I(x)P(x)y &= I'(x)y\ I(x)P(x) &= I'(x)\ &\textrm{(a separable eq in terms of } I\textrm{)}\ I(x)P(x) &= \dfrac{dI}{dx}\ P(x)\ dx &= \dfrac{1}{I}\ dI\ \int P(x)\ dx &= \ln I\ I &= e^{\int P(x)\ dx} \end{aligned}

Solve the following differential equation. y+3x2y=6x2y'+3x^2y=6x^2

Solution

This one's already written in standard form, so it is clear that P(x)=3x2,P(x)=3x^2, which means that I(x)=e3x2 dx=ex3.I(x)=e^{\int 3x^2\ dx}=e^{x^3}.

Once we multiply that by every term, we get the following (noting that the left-hand side collapses as always): (ex3y)=6x2ex3\left(e^{x^3}y\right)'=6x^2e^{x^3}

To integrate, use u-substitution (not shown fully here, but you can verify the details). ex3y=6x2ex3 dx=2ex3+Ce^{x^3}y=\int 6x^2e^{x^3}\ dx=2e^{x^3}+C

Finally, solve for yy by dividing both sides by ex3e^{x^3}: y=2+Cex3\ans{y = 2 + Ce^{-x^3}}

  1. Solve the following differential equation. y+2y=2exy'+2y=2e^x

  2. 23ex+Ce2x\dfrac{2}{3}e^x+Ce^{−2x}

Solve the following differential equation. xy2y=x2xy'−2y=x^2

Solution

This one is not written in standard form, so we must do that before picking out P(x)P(x) in order to find I(x).I(x). y2xy=xy' - \dfrac{2}{x}y = x

P(x)=2xI(x)=e2/x dx=e2lnx\begin{aligned} P(x) &= -\dfrac{2}{x}\ I(x) &= e^{\int -2/x\ dx}\ &= e^{-2\ln x} \end{aligned}

To simplify I(x)I(x) further, you must remember your log rules: remember that a constant in front of a logarithm can be moved to the exponent inside the logarithm: I(x)=e2lnx=elnx2=x2=1x2\begin{aligned} I(x) &= e^{-2 \ln x}\ &= e^{\ln x^{-2}}\ &= x^{-2}\ &= \dfrac{1}{x^2} \end{aligned}

After multiplying the integrating factor through the equation, we get the following: (1x2y)=1x\left(\dfrac{1}{x^2}y\right)'=\dfrac{1}{x} which we can integrate.

1x2y=lnx+Cy=x2lnx+Cx2\dfrac{1}{x^2}y=\ln x+C \longrightarrow \ans{y=x^2 \ln x+Cx^2}

Solve the following differential equation. xy+y=xxy'+y=\sqrt{x}

Solution

With this one, too, we have to start by writing it in standard form: y+1xy=xxy'+\dfrac{1}{x}y=\dfrac{\sqrt{x}}{x}

P(x)=1xI(x)=e1/x dx=elnx=xP(x)=\dfrac{1}{x} \longrightarrow I(x)=e^{\int 1/x\ dx}=e^{\ln x}=x

After multiplying the integrating factor through, we get (xy)=x(xy)'=\sqrt{x} and after integrating, we find that xy=x dx=23x3/2+C\begin{aligned} xy &= \int \sqrt{x}\ dx\ &= \dfrac{2}{3}x^{3/2} + C \end{aligned} y=23x+Cx\ans{y = \dfrac{2}{3}\sqrt{x}+\dfrac{C}{x}}

  1. Solve the following differential equation. y=x+5yy'=x+5y

  2. 15x125+Ce5x−\dfrac{1}{5}x−\dfrac{1}{25}+Ce^{5x}

Mixing Problem Example

We can now return to the mixing problems that were introduced in the previous section, and we can deal with some complications now.

Mixing Problem

A tank initially contains 1000 L of pure water. There are two pipes that bring brine into the tank: one stream contains 0.1 kg of salt per liter of water and enters the tank at a rate of 10 L/min, and the other contains 0.2 kg of salt per liter of water and enters the tank at a rate of 5 L/min. The solution in the tank is kept thoroughly mixed and drains from the tank at 10 L/min. Find a solution for y(t),y(t), the amount of salt in the tank after tt minutes.

Solution

This mixing problem is different from the one in the last section; all three differences that I pointed out after doing that problem are present here. Remember, though, the only one that really changes the problem is the fact that the inlet and outlet flowrates are different. This means that instead of the concentration of salt in the tank being y1000\dfrac{y}{1000} it y1000+5t.\dfrac{y}{1000+5t}.

Again, dydt=rate inrate out=(0.1 kgL)(10 Lmin)+(0.2 kgL)(5 Lmin)(y5000+5t kgL)(10 Lmin)=22y200+t\begin{aligned} \dfrac{dy}{dt} &= \textrm{rate in} - \textrm{rate out}\ &= \left(0.1\ \dfrac{kg}{L}\right)\left(10\ \dfrac{L}{min}\right) + \left(0.2\ \dfrac{kg}{L}\right)\left(5\ \dfrac{L}{min}\right) - \left(\dfrac{y}{5000+5t}\ \dfrac{kg}{L}\right)\left(10\ \dfrac{L}{min}\right)\ &= 2-\dfrac{2y}{200+t} \end{aligned}

Note that this one is not separable, specifically because of that 200+t200+t in the denominator. We'll have to solve this one using an integrating factor. To do so, start by writing it in standard FOLDE form: y+2200+ty=2y'+\dfrac{2}{200+t}y=2

P(t)=2200+tI(t)=e2ln200+t=eln200+t2=(200+t)2\begin{aligned} P(t) &= \dfrac{2}{200+t}\ I(t) &= e^{2 \ln |200+t|}\ &= e^{\ln |200+t|^2}\ &= (200+t)^2 \end{aligned}

Now multiply this integrating factor through: ((200+t)2y)=2(200+t)2(200+t)2y=2(200+t)2 dt(200+t)2y=23(200+t)3+Cy=23(200+t)+C(200+t)2\begin{aligned} \left((200+t)^2y\right)' &= 2(200+t)^2\ (200+t)^2y &= \int 2(200+t)^2\ dt\ (200+t)^2y &= \dfrac{2}{3}(200+t)^3 + C\ y &= \dfrac{2}{3}(200+t) + \dfrac{C}{(200+t)^2} \end{aligned}

To find this constant, use the initial condition: if the tank is initially full of pure water, then y(0)=0.y(0)=0.

0=23(200)+C20020=4003+C40,0004003=C40,00016,000,0003=C\begin{aligned} 0 &= \dfrac{2}{3}(200) + \dfrac{C}{200^2}\ 0 &= \dfrac{400}{3} + \dfrac{C}{40,000}\ -\dfrac{400}{3} &= \dfrac{C}{40,000}\ -\dfrac{16,000,000}{3} &= C \end{aligned} y=23(200+t)+16,000,000(200+t)2\ans{y=\dfrac{2}{3}(200+t)+\dfrac{16,000,000}{(200+t)^2}}