molecalculator

Moles & Molar Mass

First Order Differential Equation Formula

Calculator No. 01-13378 · Updated · Formula and assumptions shown below

General solution y(x) 2.5000
P(x)
2
Set in the form below
Q(x)
3
Set in the form below
Constant of integration C
1
Set in the form below
You enter
P(x), Q(x), Constant of integration C
You get
General solution y(x)
Rounding
4 dp

For study and lab planning. The result follows from the numbers you enter and the formula shown. Check it against your method before you weigh, mix or dilute anything, follow the safety data sheet and your supervisor, and do not use it for clinical, dosing or medication work.

The general first order differential equation formula is dy/dx = f(x, y), where f is any function of x and y. A linear first order equation has the standard form dy/dx + P(x)y = Q(x), and its solution uses the integrating factor μ(x) = e∫P(x)dx.

Formula

The standard linear first order differential equation is:

dy/dx + P(x)y = Q(x)

where P(x) and Q(x) are known functions of x. The solution is found by multiplying both sides by the integrating factor μ(x) = e∫P(x)dx, which turns the left side into the derivative of μ(x)y. Then integrate both sides:

y(x) = (1/μ(x)) ∫ μ(x)Q(x)dx + C/μ(x)

Here, C is the constant of integration, determined by an initial condition if given. The calculator above shows a simplified case where P and Q are constants, giving y(x) = Q/P + C·e−Px (the exponential form is not shown in the simplified output, but the principle holds).

Worked Example

Solve dy/dx + 2y = 3, with P = 2, Q = 3, and C = 1.

Step 1: Integrating factor μ = e∫2dx = e2x.

Step 2: Multiply both sides: e2xdy/dx + 2e2xy = 3e2x.

Step 3: Left side is d/dx(e2xy). Integrate: e2xy = ∫3e2xdx = (3/2)e2x + C.

Step 4: Solve for y: y = 3/2 + C·e−2x. With C = 1, y = 1.5 + e−2x.

At x = 0, y = 2.5. The calculator’s simplified expression (q/p) + (c/exp(p*0)) gives 3/2 + 1/1 = 2.5, matching the initial value. For general x, the exponential term decays, so y approaches 1.5 as x→∞.

Assumptions

  • P(x) and Q(x) are continuous on the interval of interest.
  • The equation is linear in y and dy/dx.
  • The integrating factor is nonzero for all x in the domain.
  • The constant C is arbitrary unless an initial condition is specified.

Background: What Makes an Equation “First Order”?

The order of a differential equation is the highest derivative present. A first order equation involves only the first derivative, dy/dx, not second or higher derivatives. These equations model processes where the rate of change depends on the current state and time, such as radioactive decay (dy/dt = −ky), population growth (dy/dt = ky), and RC circuits (dV/dt + V/RC = 0).

First order equations are the simplest class of differential equations, but they still cover a wide range of real-world phenomena. They can be linear or nonlinear, separable or not, and exact or inexact. The linear form dy/dx + P(x)y = Q(x) is the most widely taught because it has a systematic solution method.

How to Choose the Right Method

Different first order equations require different techniques. Here is a quick guide:

  • Separable: If you can write dy/dx = g(x)h(y), separate variables and integrate both sides.
  • Linear: If it fits dy/dx + P(x)y = Q(x), use the integrating factor method.
  • Exact: If M(x,y)dx + N(x,y)dy = 0 and ∂M/∂y = ∂N/∂x, find a potential function.
  • Bernoulli: If it has the form dy/dx + P(x)y = Q(x)yn, substitute u = y1−n to make it linear.

For simple constant-coefficient equations like the one in the calculator, the integrating factor reduces to a straightforward exponential solution.

Common Problems and Mistakes

Students often make these errors:

  • Forgetting the constant of integration when integrating—always include C.
  • Misidentifying P(x) when the equation is not in standard form—first divide by the coefficient of dy/dx.
  • Incorrect integrating factor—forgetting the exponential or the integral sign.
  • Unit errors in applied problems—for example, mixing seconds and minutes in decay problems.

Always check your solution by substituting back into the original equation.

Real-World Applications

First order differential equations appear in many fields:

  • Physics: Newton’s law of cooling, radioactive decay, RC and RL circuits.
  • Biology: Logistic population growth, drug elimination from the body (though clinical use is beyond this page).
  • Chemistry: First-order reaction kinetics, where concentration [A] follows d[A]/dt = −k[A].
  • Economics: Continuous compounding of interest, depreciation models.

In chemistry, the integrated rate law for a first-order reaction is [A] = [A]₀e−kt, which is a direct consequence of the differential equation.

Limits of the Formula

The integrating factor method works only for linear equations. Nonlinear first order equations (like dy/dx = y²) require other methods, and many have no closed-form solution. Also, the formula assumes P and Q are continuous; if they have singularities, the solution may only exist on intervals between them. Numerical methods (Euler, Runge-Kutta) are needed when analytical solutions are impossible.

Frequently Asked Questions

What is the difference between first order and second order?

First order involves only dy/dx; second order involves d²y/dx². Second order equations are harder and often have two independent solutions, requiring two initial conditions.

How do I find the integrating factor?

For dy/dx + P(x)y = Q(x), compute μ(x) = e∫P(x)dx. No constant of integration is needed for μ; any constant would cancel out.

What is an initial condition and why is it needed?

An initial condition gives the value of y at a specific x (e.g., y(0) = 2). It lets you solve for the constant C, giving a particular solution instead of a family of solutions.

Can I use this for nonlinear equations?

No. The integrating factor method is only for linear equations. For nonlinear ones, try separation of variables or numerical methods.

Why does the constant C appear in the solution?

Integration always adds an arbitrary constant because many functions have the same derivative. The constant represents the family of curves that satisfy the differential equation.

Related

Formula used
in p | P(x) | - | 2 | -1000
in q | Q(x) | - | 3 | -1000
in c | Constant of integration C | - | 1 | -1000
out y | General solution y(x) | - | (q / p) + (c / exp(p * 0)) | 4

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.

More in this section

The whole Moles & Molar Mass section →