First Order ODE Solver

Published on: November 9, 2025

This First Order ODE Solver helps you solve first-order differential equations and shows each step clearly. It can be used to work with common first-order ODE forms, apply suitable solution methods, and optionally use an initial condition to find a particular solution. This makes it useful for checking answers, understanding how first-order ODEs are solved, and practising differential equations step by step.

Step-by-step method

  1. Write the ODE clearly (use dy/dx or y').
  2. Detect the first-order type (separable or linear).
  3. Apply the matching method (separate variables OR integrating factor).
  4. Integrate and include the constant (+ C).
  5. If an initial condition is given, solve for the constant.
  6. Rewrite the final solution in terms of y(x).

Formula bank:

Separable:
dy
dx
= f(x)g(y)
1
g(y)
dy = f(x) dx
1
g(y)
dy = ∫ f(x) dx + C
Linear: y′ + P(x)y = Q(x)
μ(x) = e∫P(x)dx
(μy)′ = μQ
y =
∫ μ(x)Q(x) dx + C
μ(x)
General: if not separable/linear, try dsolve (when possible).

Example 1: dy/dx + y = x, x, y

Step 1 - Write the ODE.

In this problem: Start with the given differential equation.

dy
dx
+ y = x

Step 2 - Identify the type.

In this problem: Linear first-order (integrating factor).

Linear: y′ + P(x)y = Q(x)
μ(x) = e∫P(x)dx
(μy)′ = μQ
y =
∫ μ(x)Q(x) dx + C
μ(x)

Step 3 - Identify P(x) and Q(x).

In this problem: Compare with y′ + P(x)y = Q(x).

P(x) = 1
Q(x) = x

Step 4 - Compute the integrating factor μ(x).

In this problem: μ(x) = e^{∫P(x)dx}.

μ(x) = ex

Step 5 - Multiply the entire ODE by μ(x).

In this problem: Multiply every term and simplify.

ex
dy
dx
+ ex1y = exx
dy
dx
ex + exy = xex

Step 6 - Rewrite the left side as a derivative.

In this problem: Use (μy)′ = μy′ + μP(x)y.

(exy)′ =
dy
dx
ex + exy
(exy)′ = xex

Step 7 - Integrate both sides.

In this problem: ∫(μy)′ dx = ∫ μQ dx.

(exy)′ dx = (−1 + x)ex
exy = (−1 + x)ex + C

Step 8 - Solve for y.

In this problem: Divide both sides by μ(x).

y =
(−1 + x)ex + C
ex
y = −1 + x + Ce−x

Step 9 - Final answer.

In this problem: Write the solution in standard form.

y = −1 + x + Ce−x

Final answer: Solution

Example 2: dy/dx = y/x, x, y, y(1)=2

Step 1 - Write the ODE.

In this problem: Start with the given differential equation.

dy
dx
=
1
x
y

Step 2 - Identify the type.

In this problem: Linear first-order (integrating factor).

Linear: y′ + P(x)y = Q(x)
μ(x) = e∫P(x)dx
(μy)′ = μQ
y =
∫ μ(x)Q(x) dx + C
μ(x)

Step 3 - Identify P(x) and Q(x).

In this problem: Compare with y′ + P(x)y = Q(x).

P(x) =
1
x
Q(x) = 0

Step 4 - Compute the integrating factor μ(x).

In this problem: μ(x) = e^{∫P(x)dx}.

μ(x) = e−ln(x)

Step 5 - Multiply the entire ODE by μ(x).

In this problem: Multiply every term and simplify.

e−ln(x)
dy
dx
+ e−ln(x)
1
x
y = e−ln(x)0
1
x
dy
dx
+
1
x2
y = 0

Step 6 - Rewrite the left side as a derivative.

In this problem: Use (μy)′ = μy′ + μP(x)y.

(e−ln(x)y)′ =
1
x
dy
dx
+
1
x2
y
(e−ln(x)y)′ = 0

Step 7 - Integrate both sides.

In this problem: ∫(μy)′ dx = ∫ μQ dx.

(e−ln(x)y)′ dx = 0
e−ln(x)y = 0 + C

Step 8 - Solve for y.

In this problem: Divide both sides by μ(x).

y =
0 + C
e−ln(x)
y = Cx

Step 9 - Apply initial condition.

In this problem: Use y(1) = 2 to determine the constant.

y(1) = 2

Step 10 - Final answer.

In this problem: Write the solution in standard form.

y = 2x

Final answer: Solution