Skip to content
    Calculus

    Integrating Factor Method for First-Order ODEs

    Fill a leaky bucket from a tap and the water level rises fast, then slows, then settles. That story is a first-order linear differential equation. This guide shows how the integrating factor solves it, and how to spot the steady level straight away.

    Math Solver Academic Editorial Board5 min read

    Key takeaways

    • Standard form: y' + p·y = q.
    • Integrating factor: μ = e^(∫p dx), which is e^(px) for constant p.
    • Solution with constants: y = q/p + (y₀ − q/p)·e^(−px).
    • q/p is the equilibrium: the steady level y settles to when p > 0.
    In this guide
    1. 01What is a first-order linear ODE?
    2. 02Why does this equation matter?
    3. 03The formula
    4. 04How to solve it step by step
    5. 05Common mistakes to avoid
    6. 06Tips and tricks
    7. 07Where you'll use it in real life
    8. 08Quick summary
    9. 09Worked example
    10. 10Frequently asked questions

    What is a first-order linear ODE?

    It is an equation involving y and its first derivative y', where y and y' appear only to the first power (no y², no √y). The standard shape is y' + P(x)·y = Q(x).

    A friendly picture: a bucket with a hole. Water pours in at a steady rate q, and leaks out at a rate p·y that grows with how much water y is inside. So y' = q − p·y, or y' + p·y = q. At first the level rises fast. Then the leak catches up, and the level settles where inflow equals outflow.

    This calculator solves the case where p and q are constants, with a starting value y(0) = y₀.

    Why does this equation matter?

    The 'fill and leak' pattern is one of the most common in science. A capacitor charging, a medicine drip, a room warming up, a falling object reaching top speed: each one rises quickly, then levels off at a steady value.

    The integrating factor is also a clever idea you'll use again and again. It turns a messy left side into the derivative of a single product, which you can simply integrate.

    After a time of 1/p, the gap between y and the steady level has shrunk to about 37% of what it was. That's why engineers talk about 'time constants'.

    The formula

    y(x) = q/p + (y₀ − q/p) · e^(−p·x)
    SymbolWhat it meansExample
    pConstant coefficient of y: how strongly y pulls back0.5 per hour
    qConstant input term: the steady supply10 mg per hour
    y₀Starting value y(0)0 mg
    xWhere you want the answer, often a time2 hours
    q/pThe equilibrium level20 mg

    The general method uses the integrating factor μ = e^(∫P dx), which is e^(px) here. If p = 0, the equation is just y' = q, and the calculator gives y₀ + qx.

    How to solve it step by step

    1. 1Write it in standard form. y' + p·y = q, with y' having coefficient 1.
    2. 2Find the integrating factor. μ = e^(px).
    3. 3Multiply both sides by μ. The left side becomes (e^(px)·y)', the product rule in reverse.
    4. 4Integrate both sides. e^(px)·y = (q/p)e^(px) + C, so y = q/p + C·e^(−px).
    5. 5Use the starting value. C = y₀ − q/p. Then put in x.

    Now enter your own p, q, starting value and x below to see the integrating factor at work.

    Try it yourself

    Pre-filled with the example — change any value.

    🧮
    Calculus
    University

    First-Order Linear ODE (Integrating Factor)

    Solve y' + py = q (constant P=p, Q=q) with y(0) = y₀. Evaluates at x.

    y' + P(x)y = Q(x) → y = e^(−∫P dx)[∫Q·e^(∫P dx)dx + C]

    Area Under Curve ∫f(x)dx
    0.120
    120
    120
    0.120

    💡 Example

    Reference
    Inputs:p=1, q=2, y0=0, x=1
    Result:1.2642
    Open the full First-Order Linear ODE (Integrating Factor) calculator

    Common mistakes to avoid

    • Getting the sign of the exponent wrong. μ = e^(+∫P dx), and the solution decays like e^(−px).
    • Forgetting the constant C before using the initial condition.
    • Moving p·y to the wrong side. y' = q − py becomes y' + py = q, so p keeps its sign.
    • Using this for y' = ky only. That one is also separable, which is quicker.

    Tips and tricks

    • Time constant: after x = 1/p, y has covered about 63% of the way from y₀ to q/p.
    • Check: put x = 0 into your answer. You must get y₀.
    • Negative p: the exponential grows instead, and y runs away from q/p.

    Where you'll use it in real life

    • Medicine: a drip adding a drug while the body clears it.
    • Electronics: a capacitor charging in an RC circuit.
    • Chemistry: a mixing tank with salt water flowing in and out.
    • Physics: Newton's law of cooling and a falling object with air resistance.

    Quick summary

    For y' + p·y = q, multiply by the integrating factor e^(px), integrate, and use the starting value to get y = q/p + (y₀ − q/p)e^(−px). The solution slides from y₀ towards the steady level q/p. Use the calculator above to see the full working.

    Worked example

    A hospital drip adds a medicine at 10 mg per hour, and the body removes it at a rate of 0.5 times the amount present, so y' + 0.5y = 10. The patient starts with none. How much is in the body after 2 hours? Use p = 0.5, q = 10, y₀ = 0 and x = 2.

    1. 01ODE: y' + 0.5y = 10, y(0) = 0
    2. 02Integrating factor: μ = e^(∫0.5dx) = e^(0.5x)
    3. 03Multiply through: (e^(0.5x)y)' = 10e^(0.5x)
    4. 04Integrate: e^(0.5x)y = 20e^(0.5x) + C
    5. 05y = 20 + C·e^(−0.5x)
    6. 06Apply y(0)=0: 0 = 20 + C → C = -20
    7. 07y(x) = 20 + -20·e^(−0.5x)
    8. 08At x = 2: 12.6424

    These numbers are pre-filled in the calculator above.

    Frequently asked questions

    What is an integrating factor?

    It is the multiplier μ = e^(∫P dx). Multiplying y' + Py = Q by it turns the left side into the derivative of μ·y, which you can integrate directly.

    What is the equilibrium solution of y' + py = q?

    Set y' = 0 to get y = q/p. When p > 0, every solution moves towards this value over time. In the drip example it is 10 ÷ 0.5 = 20 mg.

    What is the solution of y' + y = 2 with y(0) = 0?

    y = 2 − 2e⁻ˣ. At x = 1 it equals 2 − 2/e ≈ 1.2642.

    What if p = 0?

    Then there is no leak, the equation is y' = q, and y simply grows in a straight line: y = y₀ + q·x.

    #Calculus#University#First-Order Linear ODE (Integrating Factor)
    Updated

    Keep reading

    Sponsored ToolsAd

    More tools on Ytools →
    Calcu.click — 25+ Free Smart Calculators preview

    Calcu.click — 25+ Free Smart Calculators

    Brand new calculation platform with 0ms reactive math, 100% client-side privacy, and dedicated subdomains. Fast calculators for EMI, SIP, Mortgage, Income Tax, BMI, Age, Percentage, and more.

    25+ CalculatorsFinanceHealth0ms Real-TimeFree
    Keyboard Arena preview

    Keyboard Arena

    Master touch typing with real-time WPM speed tests, mechanical switch audio, A-Z finger biomechanics drills, 40+ structured lessons, and competitive arcade games.

    Typing TestWPMTouch Typing
    Flutter Log Explorer preview

    Flutter Log Explorer

    Real-time structured log viewer and search explorer for Flutter & Dart. Zero-config capture from Debug Adapter (DAP) & Dart VM Service with smart classification and filters.

    FlutterDartVS Code ExtensionOpen VSX