First order linear equations

Integrating factor calculator

Educational tool; results are estimates for learning, verify with your textbook or instructor.

Handwritten differential equations next to a scientific calculator.
A calculator beside handwritten differential equations.

This integrating factor calculator is a first order linear differential equation solver for y' + P(x) y = Q(x). The coefficient of y' is already 1. P(x) is a constant or a polynomial. Q(x) is a polynomial, a polynomial times an exponential, or a polynomial times a sine and a cosine of the same frequency. The steps name P and Q, build μ(x) = e^(∫ P dx), multiply through, integrate, and write the general solution. An optional condition y(x₀) = y₀ fixes the constant.

The boxes open on y' + 2y = 4x with y(0) = 1. The particular solution is 2x − 1 + 2 e^(−2x). Leave both condition boxes blank when you only want the family with C still in it.

Separation is a different first order method. A product of a function of x and a function of y is on the separable walkthrough. Constant-coefficient second order equations use a characteristic polynomial, not an integrating factor. That solver is the second order differential equation calculator. The map around both is differential equations.

Q(x) is the polynomial whose coefficients are below. Leave a blank box as 0.

Use integers, decimals, or fractions such as 3/4 or −1/2. Enter both initial conditions, or leave both blank. The endpoint and the step count are used only when the integral of μ Q is not elementary. A closed-form answer ignores them.

How the integrating factor works

Start from standard form, y' + P(x) y = Q(x). If a textbook writes a(x) y' + b(x) y = g(x), divide by a(x) first, on an interval where a(x) is not zero. This page does not do that division. P and Q are the functions after it.

Choose any antiderivative of P. The page uses the one with constant term 0. Then μ(x) = e raised to that antiderivative. The product rule says (μ y)' = μ y' + μ' y. Because μ' = μ P, the left side of the multiplied equation is exactly (μ y)'. Integrate both sides. Divide by μ, which is never zero. The constant of integration becomes the C in y = (1/μ) (∫ μ Q dx + C).

For a constant P = p, μ(x) = e^(p x). A polynomial Q, a polynomial times e^(kx), and a polynomial times A sin(bx) + B cos(bx) all integrate against that factor by a finite reduction. The page writes the coefficients. For a nonconstant polynomial P, a polynomial Q sometimes has a polynomial particular solution, and the homogeneous piece is still C e^(−∫ P dx). The page checks every power before it trusts that polynomial. If a power disagrees, it does not print a formula.

How to read the result

The large line is the general solution, or the particular solution when C came out as an exact fraction. Under it, the steps follow the order above: standard form, integrating factor, multiplied equation, integral, general solution, then the initial condition if you supplied one.

Fractions stay exact. A decimal such as 0.5 is kept as 1/2. If the initial time makes an exponential, a sine, or a cosine that is not 0, 1, or −1, the page still writes an exact expression for C when the rest of the value is rational, and it prints a decimal on its own line, labelled as a decimal approximation.

The curve is the particular solution when a condition was entered. The marked point is (x₀, y₀). With no condition, the curve uses the sample choice C = 1, and the legend says so. It is one member of the family. A Runge-Kutta plot is the numerical table, not a closed form. The legend says that too.

When the integral is not elementary

Some integrating factors do not have an elementary antiderivative against Q. The example to keep is y' + x y = 1. Here P(x) = x, so μ(x) = e^(x^2/2). With y(0) = 0 the exact initial-value statement is still an integral, y(x) = e^(−x^2/2) times the integral from 0 to x of e^(t^2/2) dt. That integral is not a finite combination of polynomials, exponentials, and sines and cosines. Printing one would be a wrong answer.

The preset "Not elementary" asks for that initial condition, the endpoint x = 1, and 10 steps. Classical fourth-order Runge-Kutta then reports a value near 0.724778 at x = 1. The later digits move if you shorten the step. Every row is labelled as a numerical approximation. Without an initial condition the page stops after the integrating factor and asks for y(x₀), because a table has to start somewhere.

Three worked examples

The three solutions below are written on the page, so you can read them with scripts turned off. The form opens on the first one. Each check substitutes the solution back into the differential equation.

Polynomial forcing. y' + 2y = 4x, y(0) = 1.

P(x) = 2 and Q(x) = 4x.
∫ P dx = 2x, taking the antiderivative with no added constant.
μ(x) = e^(2x).

Multiply through.
d/dx [ e^(2x) y ] = 4x e^(2x).

Integrate. For ∫ x^n e^(a x) dx with a = 2, the antiderivative is e^(2x) times a polynomial.
The coefficient of x is 4/2 = 2.
The constant term is (0 − 1·2)/2 = −1.
∫ 4x e^(2x) dx = e^(2x) (2x − 1), up to a constant.

Divide by μ.
y = 2x − 1 + C e^(−2x).

Initial condition y(0) = 1.
−1 + C = 1, so C = 2.
y = 2x − 1 + 2 e^(−2x).

Check.
y' = 2 − 4 e^(−2x).
y' + 2y = 2 − 4 e^(−2x) + 4x − 2 + 4 e^(−2x) = 4x.
y(0) = −1 + 2 = 1.

Sine forcing. y' + y = sin(x), y(0) = 1.

P(x) = 1 and Q(x) = sin(x).
μ(x) = e^x.
d/dx [ e^x y ] = e^x sin(x).

∫ e^(a x) sin(bx) dx with a = 1 and b = 1 is e^x (sin(x) − cos(x)) / 2.
Divide by e^x.
y = (1/2) sin(x) − (1/2) cos(x) + C e^(−x).

y(0) = 1 gives −1/2 + C = 1, so C = 3/2.
y = (1/2) sin(x) + (−1/2) cos(x) + (3/2) e^(−x).

Check at x = 0.
(1/2)·0 + (−1/2)·1 + 3/2 = 1.
The derivative of the particular piece at 0, plus the derivative of (3/2) e^(−x) at 0, plus y(0), returns sin(0) = 0.

Integrating factor e^(x^2). y' + 2x y = 2x, y(0) = 3.

P(x) = 2x and Q(x) = 2x.
∫ P dx = x^2.
μ(x) = e^(x^2).
d/dx [ e^(x^2) y ] = 2x e^(x^2).

The right side is the derivative of e^(x^2). A polynomial particular solution is the constant 1, because 0 + 2x·1 = 2x.
y = 1 + C e^(−x^2).

y(0) = 3 gives 1 + C = 3, so C = 2.
y = 1 + 2 e^(−x^2).

Check.
y' = −4x e^(−x^2).
y' + 2x y = −4x e^(−x^2) + 2x + 4x e^(−x^2) = 2x.
y(0) = 1 + 2 = 3.

Common mistakes

The first mistake is skipping the division that puts the equation in standard form. If the book says 2y' + 4y = 8x, then P is 2 and Q is 4x, not 4 and 8x. This page assumes you already divided by the coefficient of y'.

The second mistake is keeping a constant inside the exponent of μ and then treating that constant as part of the answer. It multiplies every term and cancels. The arbitrary constant belongs with the integral of μ Q, as C, not inside μ.

The third mistake is integrating μ Q and forgetting to multiply back by 1/μ. The product μ y equals that integral. y itself is the integral divided by μ.

The fourth mistake is reaching for a characteristic equation. That method solves a y'' + b y' + c y = 0, a second order equation with constant coefficients. It is the second order calculator. A first order linear equation has an integrating factor even when P depends on x.

The fifth mistake is inventing an elementary antiderivative for e^(x^2/2). The preset "Not elementary" exists so the page can refuse that guess and show a labelled numerical table instead.

Related reading

Place the equation on the differential equations map. Separation, which is a different method, is the separable walkthrough. The short definitions are differential equation and initial value problem. A course shaped path that arrives at this chapter is the AP Calculus AB bridge.

After this first order chapter, constant coefficients of a second derivative are the second order differential equation calculator. Two candidate solutions from that page can be tested on the Wronskian calculator. A zero at one point is not, by itself, a proof of dependence. The same initial value problem can also be started from a transform. Once you have Y(s), the Laplace transform calculator inverts it.

Disclaimer. Educational estimate only. This page is not a computer algebra system and not a proof. See the site disclaimer and the FAQ on calculators versus understanding.

Sources

  • Paul’s Online Math Notes, Linear Equations, the integrating factor section used in a first differential equations course. tutorial.math.lamar.edu
  • MIT OpenCourseWare, 18.03SC Differential Equations, Solution by Integrating Factors. ocw.mit.edu
  • OpenStax Calculus Volume 2, Section 4.5, First-order Linear Equations. openstax.org

Last reviewed: 28 October 2026.

Common questions

What does an integrating factor calculator solve?

It solves y' + P(x) y = Q(x), the standard form of a first order linear equation. P can be a constant or a polynomial of degree up to 4. Q can be a polynomial, a polynomial times an exponential e^(kx), or a polynomial times A sin(bx) + B cos(bx). The page identifies P and Q, builds the integrating factor, multiplies through, integrates when that integral is in its closed-form class, and writes the general solution. If you enter y at x0, it also fixes the constant.

How do you compute the integrating factor of y' + P(x) y = Q(x)?

Divide through first so the coefficient of y' is 1. Integrate P(x), and drop the constant of integration. The integrating factor is μ(x) = e raised to that antiderivative. Multiplying the differential equation by μ makes the left side equal to the derivative of μ times y.

What is the general solution after multiplying by the integrating factor?

The multiplied equation says the derivative of μ y equals μ Q. Integrate both sides and divide by μ. The general solution is y = (1/μ) times (the integral of μ Q dx, plus C). When P is the constant p and Q is a polynomial, this becomes a polynomial plus C e^(−p x).

When does this page switch from a formula to a Runge-Kutta table?

It switches when the integral of μ Q is outside the closed-form class it can finish exactly. A typical case is y' + x y = 1. The integrating factor is e^(x^2/2), and the integral of that factor is not an elementary function. The page says so, instead of printing a guessed antiderivative. With an initial condition, an endpoint, and a step count, it shows a classical fourth-order Runge-Kutta table and labels every row as a numerical approximation.

Why does the integrating factor omit the constant of integration?

Adding a constant to the integral of P multiplies μ by a nonzero constant. That factor stands on both sides of the multiplied equation and cancels when you solve for y. The page uses the antiderivative of P whose constant term is 0. A different legal choice gives the same family of solutions.

How many initial conditions does a first order linear equation need?

The general solution has one arbitrary constant, because the equation contains a first derivative and no higher derivative. One condition, y(x0) = y0, determines that constant when the integrating factor is a nonzero real number at x0. A second order equation needs two conditions. The characteristic-equation method on the second order calculator is a different problem.

Want a tool that matches a new explainer, or a check that a page and a calculator disagree? Write a short note.

Suggest a topic or tool