# Ordinary Differential Equations/First Order Linear 1

## What is a linear first order equation?Edit

A linear first order equation is an equation in the form

- .

The simpliest case of which is shown below in Example 1 where and 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 . 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 , and there is one term without a derivative of .

Let's compare the left hand side

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

- .

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

But now this would only look like the product rule if and hence , 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 and integrating we get:

Integrating by substitution the integral on the left hand side is simply . Thus pulling over the natural logarithm to the right, we have:

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

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

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

Below we provide another derivation of this formula.

### Step-by-Step SolutionEdit

### Example 1: P and Q are ConstantEdit

- Let's say we have the equation

- where
*n*and*m*are constants. Solve this for*y*.

**Step 1**: Find the integrating factor, ,- with P(x) = m and the integration of a constant being

- yielding

- is collapsing into C. Letting C=1, we get
*e*^{mx}.

**Step 2**: Multiply through by the integrating factor just found.

**Step 3**: Recognize that the left hand side is ,- that is subject to the product rule, giving us.

**Step 4**: Integrate both sides with respect to*x*,- with the left hand side now easily integrated.

**Step 5**: And finally solve for*y*

### Example 2: P and Q are *x*Edit

- Take the equation

- Solve for
*y*.

**Step 1**: Find , P(x) = x and the integral of x being

- yielding

- Letting C=1, we get

**Step 2**: Multiply through

**Step 3**: Recognize that the left hand is , giving

**Step 4**: Integrate

**Step 5**: Solve for*y*

### Edit

- Take the equation

- 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 or for . For the purposes of this solution we shall assume .

**Step 1**: Find , ,- and the integration of 1/x being

- yielding

- Letting C=1, we get
*x*.

**Step 2**: Multiply through

**Step 3**: Recognize that the left hand is

**Step 4**: Integrate both sides w.r.t.*x*.

**Step 5**: Solve for*y*

## An alternative derivationEdit

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.

- 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).

- This equation is separable, so separate it:

- Solve the equation to obtain the solution

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

- Substitute the previous equation into the differential equation to get

- Now solve for g(x) to get

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

## Making Linear Equations from Non-Linear EquationsEdit

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

### ExampleEdit

- Let's make the following substitution:

- Plugging in, we get

- We can then solve as a linear equation in
*v*, using the step-by-step method above:

**Step 1**: Find the integrating factor:

- Letting C=1 for convenience, we get as our integrating factor.

**Step 2**: Multiply through

**Step 3**: Recognize that the left hand is

**Step 4**: Integrate both sides w.r.t.*x*.

**Step 5**: Solve for*v*.

- Now that we have
*v*, solve for*y*.