# Ordinary Differential Equations/First Order Linear 2

Remember the population growth problem, where ${\frac {dP}{dt}}=(B-D)P$ ? Now that we can solve linear equations, we can also solve variations where a factor $f(t)$  is added in. The new equation is ${\frac {dP}{dt}}=(B-D)P+f(t)$ , and can be solved by the linear methods taught in the last section.

### Immigration

Lets say that 1000 people move into a city, in addition to the normal population growth. This can be interpreted by making $f(x)=1000$ . This gives us a linear differential equation to solve

${\frac {dP}{dt}}=kP+1000$

${\frac {dP}{dt}}-kP=1000$

Step 1: Find $e^{\int P(t)dt}$

$\int kdt=kt+C$

$e^{\int P(t)dt}=Ce^{kt}$

Letting C=1, we get $e^{kt}$

Step 2: Multiply through

$e^{kt}P'+e^{kt}P=1000e^{kt}$

Step 3: Recognize that the left hand is ${\frac {d}{dt}}e^{\int P(t)dt}y$

${\frac {d}{dt}}e^{kt}P=1000e^{kt}$

Step 4: Integrate

$\int ({\frac {d}{dt}}e^{kt}P)dt=\int 1000e^{kt}dt$

$e^{kt}P={\frac {1000}{k}}e^{mt}+C$

Step 5: Solve for y

$P={\frac {1000}{k}}+{\frac {C}{e^{kt}}}$

See how the answer is a constant addition to the normal solution, as expected.

### Hunting

Lets say the government allows 10 animals to be killed a year. This makes $f(t)=-10t$ . How does this effect the solution?

${\frac {dP}{dt}}=kP-10t$

${\frac {dP}{dt}}-kP=-10t$

Step 1: Find $e^{\int P(t)dt}$

$\int kdt=kt+C$

$e^{\int P(t)dt}=Ce^{kt}$

Letting C=1, we get $e^{kt}$

Step 2: Multiply through

$e^{kt}P'+e^{kt}P=-10te^{kt}$

Step 3: Recognize that the left hand is ${\frac {d}{dt}}e^{\int P(t)dt}y$

${\frac {d}{dt}}e^{kt}P=-10te^{kt}$

Step 4: Integrate

$\int ({\frac {d}{dt}}e^{kt}P)dt=\int -10te^{kt}dt$

$e^{kt}P={\frac {-10(kx-1)e^{kx}}{k^{2}}}+C$

Step 5: Solve for y

$P={\frac {-10(kx-1)}{k^{2}}}+{\frac {C}{e^{kx}}}$

## Mixture problems

Imagine we have a tank containing a solution of water and some other substance (say salt). We have water coming into the tank with a concentration $C_{i}$ , at a rate of $R_{i}$ . We also have water leaving the tank at a concentration $C_{o}$  and rate $R_{o}$ . We therefore have a change in concentration in the tank of

${\frac {dx}{dt}}=R_{i}C_{i}-R_{o}C_{o}$

Thinking this through, $R_{i}$ , $C_{i}$ , and $R_{o}$  are constants, but $C_{o}$  depends on the current concentration of the tank, which is not constant. The current concentration is ${\frac {x}{V}}$  where V is the volume of water in the tank. Unfortunately, the volume is changing based on how much water is in the tank. If the tank initially has $V_{0}$  volume, the volume at time t is $V(t)=V_{0}+t(r_{i}-r_{o})$ . This makes the final equation

$x'=R_{i}C_{i}-{\frac {R_{o}x}{V_{0}+t(R_{i}-R_{o})}}$

which is an obvious linear equation. Lets solve it.

$x'+{\frac {R_{o}x}{V_{0}+t(R_{i}-R_{o})}}=R_{i}C_{i}$

Step 1: Find $e^{\int P(t)dt}$

$\int {\frac {R_{o}}{V_{0}+t(R_{i}-R_{o})}}={\frac {R_{o}ln((R_{i}-R_{o})t+V_{0})}{R_{i}-R_{o}}}+C$

$e^{\int P(t)dt}=Ce^{\frac {R_{o}ln((R_{i}-R_{o})t+V_{0})}{R_{i}-R_{o}}}=C((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}$

Letting C=1, we get $((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}$

Step 2: Multiply through

$((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}x'+((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}{\frac {R_{o}x}{V_{0}+t(R_{i}-R_{o})}}=((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}R_{i}C_{i}$

Step 3: Recognize that the left hand is ${\frac {d}{dt}}e^{\int P(t)dt}x$

${\frac {d}{dt}}((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}x=((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}R_{i}C_{i}$

Step 4: Integrate

$\int (((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}x)dt=\int (R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}R_{i}C_{i}dt$

$((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}x={\frac {C_{i}V_{0}((R_{i}-R_{o})t+V_{0})^{\frac {R_{i}}{V_{0}}}}{(R_{i}-R_{o})}}$

Step 5: Solve for y

$x={\frac {C_{i}V_{0}((R_{i}-R_{o})t+V_{0})^{\frac {R_{i}}{V_{0}}}}{(R_{i}-R_{o})((R_{i}-R_{o})t+V_{0})^{\frac {R_{o}}{R_{i}-R_{o}}}}}$

Ugly, isn't it. Most of the time when dealing with real world mixture problems, you'll plug in much earlier and use numbers, which makes it easier to deal with.