xaktly | Calculus

Differential equations

Differential Equations

Differential equations contain functions of one or more variables, and nth derivatives of those functions. If the highest-order derivative present in a differential equation is the first derivative, the equation is a first-order differential equation. An example is

$$\frac{dy}{dx} + x^2 = 0$$

The equation contains a first derivative of the function y (which we assume – implicitly – to be a function of the variable x), and a function of x, f(x) = x2.

$$\frac{d^2y}{dx^2} + cos(xy) = 0$$

An example of a second-order differential equation is

$$\frac{d^2y}{dx^2} + cos(xy) = 0$$

The most important distinction among differential equations in this section, really the introduction to differential equations, is separability.

A separable differential equation is an equation of two variables in which an algebraic rearrangement can lead to a separation of variables on each side of the = sign.

For example, the differential equation

$$\frac{dy}{dx} + xy = 0$$

can be separated in two simple steps. First move the xy to the right by subtraction:

$$\frac{dy}{dx} = -xy$$

Then multiply both sides by dx and divide both sides by y:

$$\frac{dy}{y} = -x dx$$

Now the left side only contains y and the right side only x. We'll solve this one later; this is just to show that it is separable.

A non-separable equation

$$\frac{dy}{dx} = x + y$$

is a non-separable equation. You can give it a try, but you won't be able to segregate x's and y's on either side of the = sign. This equation is solvable by other methods, but those will be covered in other sections.

Differential equations model many real phenomena

Differential equations really represent the essence of calculus, where the derivative and the integral merge. They model systems where things change differentially (at different rates).

falling ball figure

In this example, the acceleration of the falling ball is diminished by the upward force of wind resistance (k is a positive constant), which increases as the square of the velocity. Both velocity and its first derivative are present in the equation.

Differential equations are often very easy to write because they make so much sense. In this case, on the left, we have mass times the acceleration (dv/dt), which is a force. That force is equal to the downward pull of gravity (-mg) but it is reduced by the friction, a force in the upward (positive) direction, which becomes greater as the velocity increases. In fact, that kind of friction scales as the square of the velocity. Here, k is just a constant of proportionality which would reflect things like the size and shape of the falling object, the air temperature, and so on.

This differential equation leads to the terminal velocity of a skydiver, the idea that a skydiver (or any falling object) will reach a certain velocity at which those two forces are in balance, and therefore maintain a constant velocity (i.e. stop accelerating downward).

There are simpler examples of how to solve differential equations in the examples below, but if you're interested in the solution to this one, hit the button to see it.

Separable differential equations

A separable differential equation can be rewritten so that each of the two variables involved are on either side of the equal sign:

By treating differentials algebraically, i.e. by multiplying by dx and dividing by g(y) on both sides, we can separate the variables so that y's and dy's appear on one side, and x's and dx's on the other. Then it's a simple matter of integration of each side to solve the equation.

More generally, a separable differential equation is one that can be written in the form

f(x) dx = g(y) dy

Example 1

Let's learn how to solve these equations by example. Here is an operator equation, something that appears a lot in quantum mechanics:

Sometimes differential equations are written in "operator form."

$$\left( \frac{d}{dx} \right) y = 0$$

The operator is in parenthesis, and it "operates" on the variable y, so that it can be written

$$\frac{dy}{dx} + xy = 0$$

An operators elements distribute to the thing (y) upon which it operates. This can be rearranged and the variables separated in two steps. First the xy is moved to the right:

$$\frac{dy}{dx} = -xy$$

And then we divide both sides by y and multiply both by dx.

$$\frac{dy}{y} = -x dx$$

← Separate the variables, y on one side, x on the other.

Once the variables are separated, we can integrate each side, the left with respect to y, the right with respect to x:

$$\int \, \frac{dy}{y} = - \int \, x \, dx$$

The integral is straight forward:

$$ln(y) = - \frac{x^2}{2} + C \: \color{#E90F89}{\leftarrow \text{ implicit form}}$$

Now to find y(x), we exponentiate each side with base e, minding the laws of logarithms:

$$e^{ln(y)} = e^{\frac{-x^2}{2} + C}$$

Use the inverse operation to find y(x)

Converting the exponentials gives

$$y = e^{\frac{-x^2}{2}}e^C$$

← Just rename the constant eC = A.

Finally, exploiting the property of logs that xm+n = xm·xn, we get a compact form of the general solution of this differential equation:

$$y = A e^{\frac{-x^2}{2}}$$

← General solution

Now a few remarks about this solution.

  • The general solution to a differential equation is a family of functions, differing by a constant, which might, as it is in this case, be multiplicative (the A).

  • A specific solution can be found if some condition, sometimes called an initial condition or a boundary condition, is known. For example, if it was known that y(0) = 2, then A = 2.

  • Sometimes there is not such a convenient inverse function to apply to remove y from the implicit form and it might be best to leave it alone.

  • Finally, not all differential equations are separable, and those that aren't require different techniques to solve, if indeed they can be solved analytically.

Boundary conditions

Boundary conditions are extra bits of information that allow us to zero in on a specific solution to a differential equation. Without boundary conditions, our solution can only be a family of solutions.

Implicit solutions vs. explicit solutions

We began solving separable differential equations with the form on the left, then we integrated:

$$ \begin{align} \frac{dy}{g(y)} &= f(x) dx \, \longrightarrow \\[5pt] \int \frac{dy}{g(y)} &= \int f(x) dx \end{align}$$

to arrive at solutions of the form y(x) = (a function of x only). These were explicit solutions. But some differential equations just don't allow us to get that far, and we have to settle for some middle ground. Consider this differential equation:

$$\frac{dy}{dx} = \frac{x + 1}{2 + cos(y)}$$

It's separable, so we'll separate terms on either side of the equal sign:

$$[2 + cos(y)]\frac{dy}{dx} = x + 1$$

Now we integrate both sides with respect to x. Here I'm doing it in a slightly different way than before, canceling the dx's on either side, but the result is the same:

$$\int [2 + cos(y)] \frac{dy}{dx} dx = \int (x + 1)dx$$

The integral is:

$$2y + sin(y) = \frac{x^2}{2} + x + C$$

Now we've got a problem. We just can't solve the left side for y, so it's really not possible (or at least not very fun) to find a solution of the form y(x) = (a function of x only). It's not that this solution is useless. It's certainly a relationship between the y's and x's that solve the differential equation, and it's the best we can do. We call these types of solutions implicit solutions.

When you can, try to find the explicit solution, as in the first example, y(x) = a function just of x.

Many differential equations are not separable

Here is one example of a simple differential equation that is not separable. Go ahead and try. You won't be able to do it. This equation must be solved by more advanced methods.

$$\frac{dy}{dx} = x + y$$

Example 2

Find a solution to the differential equation:

$$\frac{dy}{dx} = \frac{y^2 + 1}{x + 1}$$

First separate the variables:

$$\frac{dy}{y^2 + 1} = \frac{dx}{x + 1}$$

then integrate each side:

$$\int \frac{dy}{y^2 + 1} = \int \frac{dx}{x + 1}$$

Recall that the integral on the left is tan-1(y)

$$tan^{-1}(y) = ln|x + 1| + C$$

Finally, use the tangent function to recover y(x):

$$y = tan[ln|x + 1| + C]$$

What does this solution look like?

We've already said that this general solution to our differential equation is really a whole family of solutions. Among them all is what the solution could be if we knew a single point (a boundary condition) that could "anchor" us in that vast space of solutions.

One way to visualize the solution is to calculate a "slope field," a picture that shows the direction of solutions on the x-y plane. It's calculated by finding the derivative, dy/dx on a grid of (x, y) points. Here's a picture of the slope field for this differential equation. On it, I've highlighted the specific solution if we knew that the point (2, 2) had to be in the solution we're looking for.

Example 3 — Using a boundary condition

Now let's solve a differential equation and then use boundary conditions to find a specific solution algebraically. Here's the equation:

$$\frac{dy}{dx} = xy^2$$

To solve it, first separate the terms, as usual,

$$\frac{dy}{y^2} = x dx$$

... and integrate:

$$\int \frac{dy}{y^2} = \int x \,dx$$

The result of these simple integrals is:

$$\frac{-1}{y} = \frac{x^2 + C}{2}$$

We can rearrange this to find the general solution, first cross multiplying:

$$y (x^2 + C) = -2$$

Then dividing to isolate y:

$$y = \frac{-2}{x^2 + C}$$

Now let's say that the boundary condition –a single (x, y) point is all we need – is y(2) = 4, then we have

$$4 = \frac{-2}{4 + C}$$

Solving for the constant C makes this a specific solution,

$$C = \frac{-9}{2}$$

So the specific solution is:

$$y = \frac{-2}{x^2 - \frac{9}{2}}$$

Here's the slope field for this differential equation. Our specific solution is highlighted in magenta. You could choose any other point as a boundary condition and find the shape of the solution from the slope field.

Practice problems

Find the general solutions of each of these differential equations.


$$\frac{dy}{dx} = \frac{x^4}{y^3}$$


$$\frac{dy}{dx} = 4 e^{x - y}$$


$$\frac{dy}{dx} = \frac{1}{sec^2 (y)}$$


$$\frac{dy}{dx} = \frac{x}{e^{5y}}$$


$$\frac{dy}{dx} = e^{y - x}$$


$$\frac{dy}{dx} = x \cdot e^y$$


$$\frac{dy}{dx} = \frac{2x}{e^{3y}}$$


$$\frac{dy}{dx} = 2xy + xy^2$$

Find the specific solutions of each of these differential equations using the given initial condition.


$$\frac{dy}{dx} = -\frac{1}{sin(y)}, \phantom{000} y(3) = \frac{\pi}{2}$$


$$\frac{dy}{dx} = \frac{2x}{e^{2y}}, \phantom{000} y(2) = ln(5)$$


$$\frac{dy}{dx} = -\frac{1}{sec^2(y)}, \phantom{000} y(3) = 0$$


$$\frac{dy}{dx} = \frac{3x^2}{e^{2y}}, \phantom{000} y(1) = 0$$

Video example 1

Homogeneous vs. non-homogeneous differential equations

We can make a further distinction between differential equations, whether they are homogeneous or inhomogenous. A homogeneous differential equation takes the form

$$\frac{dy}{dx} = f(x, y)$$

where f(x, y) can be replaced in the following way:

$$f(x, y) = f(ax,\,ay)$$

where a is some constant or parameter. Here is an example of such a differential equation:

$$\frac{dy}{dx} = \frac{x + y}{5x}$$

Now if we replace f(x, y) with f(ax, ay), we get:

$$f(ax, ay) = \frac{ax + ay}{5ax} = \frac{x + y}{5x}$$

Notice that in f(ax, ay), the a's all divide to one, thus f(x, y) = f(ax, ay).

Here is an example of an inhomogeneous differential equation. It has the same rough form as the homogeneous example, except for the x2 int he numerator.

$$\frac{dy}{dx} = \frac{x^2 + y}{5x}$$

Replacement of f(x, y) (the term on the right above) with f(ax, ay) leads to this chain of logical steps:

$$ \begin{align} f(ax, ay) &= \frac{(ax)^2 + ay}{5ax} = \frac{a^2x^2 + ay}{5ax} \\ \\ &= \frac{a^2x^2 + ay}{5ax} = \frac{ax^2 + y}{5x} \\ \\ &\ne f(x,y) \end{align}$$

Now notice that the a's don't all cancel, thus this differential equation is not homogeneous.

A quick check on homegeneity is whether all terms in f(x, y) have the same degree. In the previous example, each term has a degree of 1. In this one, the left term of the numerator has a degree of 2, while the denominator and the right-side term of the numerator have degrees of 1. This is a sure sign of inhomogeneity.



A parameter is an adjustable constant in the definition of a function that is different from the independent variable(s). Parameters are not independent variables. For example, in the quadratic function

f(x) = Ax2 + Bx + C

A, B and C are parameters which change the shape of the graph of the function. x is the independent variable. A, B and C are fixed for any particular version of f(x), but x can range from -&inf; to +&inf;

A quick check on the homogeneity of a differential equation of the form

$$\frac{dy}{dx} = f(x, y)$$

is to see if each term of f(x, y) has the same degree.

Creative Commons License   optimized for firefox
xaktly.com by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to jeff.cruzan@verizon.net.