# Introduction to differential equations

## Population growth under ideal conditions

• Let $$P(t)$$ denote the number of individuals in a population (of animals, eg. bacteria).
• We assume that the population can grow under ideal conditions (unlimited space, unlimited resources, no predators, no diseases, eternal life, free beer)
• Then the rate of change of the population is proportial to the size of the population.
• That is, there exists a constant $$k$$ such that $\frac{\mathrm dP}{\mathrm dt}=kP.$
• Let's find such population functions.
• We need $$P'=kP$$.
• One such function is $$P(t)=e^{kt}$$.
• Also, for any constant $$A$$, we have another solution $$P(t)=Ae^{kt}$$.
• It can be shown that every solution is of the form $$P(t)=Ae^{kt}$$.
• What this model is good for:
• Mathematical models can be used to make predictions about the future based on data about the past.
• In this particular case, if the conditions are ideal, and we know the population $$P_0$$ at some given point of time, we can predict the population at future times.
• We let the time variable $$t=0$$ at the time at which we know the population: $P(t=0)=P_0.$
• This requirement fixes the constant $$A$$ in our solution: $A=Ae^0=P(t=0)=P_0.$
• Therefore, for future times $$t>0$$, we can predict that the population size will be $$P(t)=P_0e^{kt}$$.

## The logistic differential equation

• Now we'll make a more realistic assumption: the enviroment the population is growing in has a carrying capacity $$M$$.
• That is, we'll assume that the population is growing exponentially when it's small: $P'\approx kP\text{ when P is small,}$
• but we'll also require that if the population exceeds $$M$$, then it should decrease: $P'<0\text{ when P>M.}$
• One simple expression that satisfies both requirements is the logistic differential equation: $\frac{\mathrm dP}{\mathrm dt}=kP\left(1-\frac{P}{M}\right).$
• Note that there are two special solutions: $P(t)=0,\quad P(t)=M.$ Constant solutions are called equilibrium solutions for they are in equilibrium, they don't change.
• If the initial population $$P(t=0)$$ is between $$0$$ and $$M$$, then $$P(t)$$ will be increasing.
• If the initial population $$P(t=0)$$ is larger than $$M$$, then $$P(t)$$ will be decreasing.
• In both cases, we have $$P'(t)\to0$$ and $$P(t)\to M$$ as $$t\to\infty$$.

## A model for the motion of the spring

• Let's now set up a differential equation to describe the motion of an object of mass $$m$$ at the end of a spring.
• Let $$x$$ measure how much the spring is stretched or compressed from its natural length.
• $$x>0$$ means that the spring is stretched by $$|x|$$ units,
• $$x<0$$ means that the spring is compressed by $$|x|$$ units.
• Then Hooke's law states that there is a restoring force, which is proportional to the displacement $$x$$: $F_\mathrm{restoring}=-kx,$ where $$k>0$$ is the spring constant.
• If no other forces are acting on the object, then by Newton's second law, we get: $mx''=ma=F=F_\mathrm{restoring}=-kx.$
• We can rewrite the equation as $x''=-\frac{k}{m}x.$
• Let $$\alpha=\sqrt{\frac{k}{m}}$$. We get two solutions $x_1(t)=\cos(\alpha t),\,x_2(t)=\sin(\alpha t).$
• It can be shown, that for any constants $$a,b$$, the linear combination $x(t)=ax_1(t)+bx_2(t)$ is also a solution.

## The vocabulary of differential equations

• An equation that contains an unknown function and one or more of its derivatives is called a differential equation (DE).
• The order of the DE is the order of the highest derivative in the equation.
• The population growth examples used first order DE's, and the spring example used a second order DE.
• The specification of a value of a solution (or a derivative), like $$P(t=0)=P_0$$, is called an initial condition (IC).
• A DE of order $$n$$ together with initial conditions $f(t=t_0)=f_0,\,f'(t=t_0)=f'_0,\cdots,f^{(n-1)}(t=t_0)=f^{(n-1)}(t=t_0)$ is called an initial value problem (IVP).
• It can be proven that every IVP has a unique solution. [But this is only true because we are considering ordinary differential equations, that is we only have one variable. In multivariable calculus, you'll see partial diffential equations. Those don't always have a solution.]
• Exercises. 9.1: 3, 5, 9, 11, 13

## Direction fields

• Note that even though it can be proven that every DE has a solution, it is not always an elementary function.
• For example, the solution of $x'=f(x)$ is $$x=\int f(x)\,\mathrm dx$$, and we have already talked about how not every antiderivative is an elementary function.
• We still have approximation methods (which are not covered in this course).
• We can also still visualize the solutions using the slope field.
• Consider a first order differential equation $x'=F(t,x).$
• The direction field of the differential equation is drawn on a grid.
• At each point $$(a,b)$$ of the grid, we draw a small line with slope $$F(t=a,x=b)$$.
• This shows that if the graph of a solution is nearby, its slope is going to be close to the slope of the nearby grid points.
• If we have an initial condition $$x(t=t_0)=x_0$$, then the graph should hit the point $$(t_0,x_0)$$. We can sketch the graph by following the slopes drawn in the direction field.
• For example, consider the logistic DE with $$k=2$$ and $$M=10$$: $x'=2x(1-x/10).$
• You can check that if the IC has a value smaller than $$M$$, then the solution will increase and have $$x=M$$ as a horizontal asymptote.
• If the IC has a value larger than $$M$$, then the solution will decrease and have $$x=M$$ as a horizontal asymptote.