Ordinary Differential Equations/First Order Linear 1: Difference between revisions

From testwiki
Jump to navigation Jump to search
changed position of "=" in ODEs
 
(No difference)

Latest revision as of 10:53, 26 April 2019

[[../First Order|First Order Differential Equations]]

What is a linear first order equation?

A linear first order equation is an equation in the form

dydx+P(x)y=Q(x).

The simpliest case of which is shown below in Example 1 where P(x) and Q(x) are not functions but simple constants. Linear first order equations are important because they show up frequently in nature and physics, and can be solved by a fairly straight forward method.

We first begin by motivating the method. First recall that the product rule states that [f(x)g(x)]=f(x)g(x)+f(x)g(x). The key observation is that the left hand side of the first order ODE appears to be fairly similar to the product rule. There is one term with a derivative of y, and there is one term without a derivative of y.

Let's compare the left hand side

dydx+P(x)y

to the product rule applied to the product involving y. Notice that ddx is equal to the prime operator.

ddx[μ(x)y(x)]=μ(x)dydx+dμdxy(x).

The first fact we notice is that on the left hand side of our first order ODE there is no μ(x) in front of the term dydx. We can try to correct that by multiplying through by μ(x). Then the ODE would become:

μ(x)dydx+μ(x)P(x)y=μ(x)Q(x).

But now this would only look like the product rule if dμdx=μ(x)P(x) and hence μ(x)dydx+y(x)dμdx=μ(x)Q(x), which we do not know by now. But this simple equation can easily be solved, as it is a separable equation. Dividing both sides of it by μ(x) and integrating we get:

1μ(x)dμdxdx=P(x)dx

Integrating by substitution the integral on the left hand side is simply ln|μ(x)|. Thus pulling over the natural logarithm to the right, we have:

μ(x)=eP(x)dx.

This is very important and is called the 'integrating factor'. So our original ODE can be rewritten as

eP(x)dxdydx+P(x)eP(x)dxy=eP(x)dxQ(x)

But now the whole point of introducing μ(x) was we were trying to turn the left hand side of this ODE into [μ(x)y] for easily integrating it, which is exactly what we have done. Thus

[eP(x)dxy]=eP(x)dxQ(x).

So we may integrate both sides and then solve for y to get

eP(x)dxy=eP(x)dxQ(x)dx.
y=eP(x)dxeP(x)dxQ(x)dx.

Below we provide another derivation of this formula.

Step-by-Step Solution

Example 1: P and Q are Constant

Let's say we have the equation
dydx=my+n
where n and m are constants. Solve this for y.
Step 1: Find the integrating factor, eP(x)dx,
with P(x) = m and the integration of a constant being
mdx=mx+C
yielding
eP(x)dx=emxec=Cemx
ec is collapsing into C. Letting C=1, we get emx.
Step 2: Multiply through by the integrating factor just found.
emxdydx+emxmy=nemx
Step 3: Recognize that the left hand side is ddx[eP(x)dxy],
that is subject to the product rule, giving us.
ddx[emxy]=nemx
Step 4: Integrate both sides with respect to x,
with the left hand side now easily integrated.
(ddxemxy)dx=nemxdx
emxy=nmemx+C
Step 5: And finally solve for y
y=nm+Cemx

Example 2: P and Q are x

Take the equation
dydx+xy=x
Solve for y.
Step 1: Find eP(x)dx, P(x) = x and the integral of x being
x=12x2+C
yielding
eP(x)dx=Ce12x2
Letting C=1, we get e12x2
Step 2: Multiply through
e12x2dydx+e12x2xy=e12x2x
Step 3: Recognize that the left hand is ddxeP(x)dxy, giving
ddxe12x2y=e12x2x
Step 4: Integrate
(ddxe12x2y)dx=xe12x2dx
e12x2y=e12x2+C
Step 5: Solve for y
y=1+Ce12x2

Example 3: P and Q are Unrelated

Take the equation
dydx+1xy=x
Solve for y.

Before we begin we notice that for the function y, we are not guaranteed a solution for all x because the coefficient is discontinuous at 0. So either we can find a solution in x(0,) or for x(,0). For the purposes of this solution we shall assume x(0,).

Step 1: Find eP(x)dx, P(x)=1/x,
and the integration of 1/x being
1xdx=ln(x)+C
yielding
eP(x)dx=Celn(x)=Cx
Letting C=1, we get x.
Step 2: Multiply through
xdydx+y=x2
Step 3: Recognize that the left hand is ddxeP(x)dxy
ddx[xy]=x2
Step 4: Integrate both sides w.r.t.x.
ddx[xy]dx=x2dx
xy=13x3+C
Step 5: Solve for y
y=13x2+Cx

An alternative derivation

There is a strategy for solving inhomogeneous equations called variation of parameters that proceeds as follows. First find the general solution to the homogeneous equations. Guess that the solutions of the inhomogeneous equations can be written in the same way as for the solutions of the homogeneous equations, except where the unknown constants are replaced by unknown functions. Then you plug a solution of this form back in to the equation to see if you can find what the unknown function is.

This method works well in case of first order linear equations and gives us an alternative derivation of our formula for the solution which we present below.

  1. First, set Q(x) equal to 0 so that you end up with a homogeneous linear equation (the usage of this term is to be distinguished from the usage of "homogeneous" in the previous sections).

    dydx+P(x)y=0

  2. This equation is separable, so separate it:

    dyy+P(x)dx=0

  3. Solve the equation to obtain the solution

    y=CeP(x)dx

  4. Now let C be replaced by a variable function of x, and denote it g(x).

    y=g(x)eP(x)dx

  5. Substitute the previous equation into the differential equation to get

    g(x)eP(x)dx=Q(x)

  6. Now solve for g(x) to get

    g(x)=C+Q(x)eP(x)dxdx

  1. Now obtain the general solution by plugging in this expression in g(x):

    y=g(x)eP(x)dx=CeP(x)dx+eP(x)dxQ(x)eP(x)dxdx

Making Linear Equations from Non-Linear Equations

Sometimes a non-linear equation, which is not solvable like this, can be made linear, and more easily solvable, by applying a substitution.

Example

ydydx+xy2=5x
Let's make the following substitution:
v=y2
dvdx=2ydydx
Plugging in, we get
12dvdx+xv=5x
dvdx+2xv=10x
We can then solve as a linear equation in v, using the step-by-step method above:
Step 1: Find the integrating factor:
eP(x)dx
e2xdx=ex2+C
eP(x)dx=Cex2
Letting C=1 for convenience, we get ex2 as our integrating factor.
Step 2: Multiply through
ex2dvdx+ex2xv=10ex2x
Step 3: Recognize that the left hand is ddxeP(x)dxv
ddxex2v=10ex2x
Step 4: Integrate both sides w.r.t.x.
(ddxex2v)dx=10ex2xdx
ex2v=5ex2+C
Step 5: Solve for v.
v=5+Cex2
Now that we have v, solve for y.
v=y2
y2=5+Cex2

Template:BookCat