Bernoulli ODE Solver
Solve Bernoulli differential equations y' + P(x)y = Q(x)yⁿ step by step. Applies the v = y^(1-n) substitution to linearize, builds the integrating factor, finds the closed-form solution, and plots the particular solution curve against the slope field.
Your ad blocker is preventing us from showing ads
MiniWebtool is free because of ads. If this tool helped you, please support us by going Premium (ad‑free + faster tools), or allowlist MiniWebtool.com and reload.
- Allow ads for MiniWebtool.com, then reload
- Or upgrade to Premium (ad‑free)
About Bernoulli ODE Solver
The Bernoulli ODE Solver tackles one of the most famous nonlinear first-order differential equations — the Bernoulli equation y' + P(x)y = Q(x)yn — and turns the classic textbook derivation into an interactive, step-by-step walkthrough. It linearizes the equation via the substitution v = y1−n, builds the integrating factor μ(x), and overlays the resulting closed-form curve on an RK4 numerical solution and a slope field so you can see every detail at once.
What Is a Bernoulli Differential Equation?
Introduced by Jacob Bernoulli in 1695, a Bernoulli equation is a first-order ODE of the form
When n = 0 the equation is already linear; when n = 1 it is separable. For every other real n the equation is nonlinear, but the classic substitution v = y1−n converts it into a linear ODE in v, which can be solved with the standard integrating factor trick.
The Six-Step Bernoulli Method
Starting from y' + P(x)y = Q(x)yn:
- Divide by yn: \( y^{-n}y' + P(x)\,y^{1-n} = Q(x) \).
- Substitute v = y1−n: note that \( v' = (1-n)y^{-n}y' \), so \( y^{-n}y' = v'/(1-n) \).
- Linearize: \( v' + (1-n)P(x)\,v = (1-n)Q(x) \) — a first-order linear ODE in v.
- Integrating factor: \( \mu(x) = \exp\!\left(\int (1-n)P(x)\,dx\right) \), so \( (\mu v)' = \mu(1-n)Q(x) \).
- Solve for v(x): \( v(x) = \frac{1}{\mu(x)}\left[\mu(x_0)v_0 + \int_{x_0}^{x}\mu(t)(1-n)Q(t)\,dt\right] \).
- Back-substitute: \( y(x) = v(x)^{1/(1-n)} \).
When the integrals involved are elementary you recover a clean closed form; when they are not, the calculator evaluates them numerically using Simpson's rule to plot the solution curve.
Special Cases Handled Automatically
| Exponent n | Equation becomes | How it's solved |
|---|---|---|
| n = 0 | y' + P(x)y = Q(x) (linear) | Integrating factor directly; no substitution needed. |
| n = 1 | y' = (Q(x) − P(x))·y (separable) | y(x) = y₀·exp(∫(Q−P) dx) — the Bernoulli substitution would divide by 1−n = 0, so this case is handled separately. |
| n = 2 | Logistic-style: y' + Py = Qy² | Standard Bernoulli with v = 1/y. Appears in population dynamics and chemical kinetics. |
| n = ½ | y' + Py = Q√y | v = √y. Watch out: requires y ≥ 0. |
| Non-integer n | Any real exponent allowed | Requires y > 0 (otherwise yn = en ln y would be complex). The solver flags this. |
Worked Example — n = 2, Logistic-Style
Consider y' + y/x = x·y² with initial condition y(1) = 1. Here P(x) = 1/x, Q(x) = x, and n = 2, so 1 − n = −1.
- Substitute v = y−1 = 1/y. Then v' = −y−2y' and the equation becomes v' − (1/x)v = −x.
- Integrating factor: μ(x) = exp(∫−1/x dx) = 1/x.
- (μ·v)' = μ·(−x) = −1. Integrate: (1/x)·v = −x + C, i.e. v = −x² + Cx.
- Apply IC: at x = 1, v = 1/1 = 1, so 1 = −1 + C ⇒ C = 2. Hence v(x) = −x² + 2x.
- Back-substitute: y(x) = 1/v(x) = 1/(2x − x²) = 1/(x(2 − x)).
The closed-form solution y = 1/(x(2−x)) has vertical asymptotes at x = 0 and x = 2 — exactly the kind of thing a slope field makes obvious at a glance.
How to Use This Calculator
- Fill in the equation builder. Type P(x) and Q(x) into the blue slots, and the exponent n into the small superscript box. The layout mirrors the standard form y' + P(x)y = Q(x)yn.
- Set the initial condition (x₀, y₀) and the plotting range [x min, x max]. The range should contain x₀.
- Click Solve. The calculator detects whether you are in a special case (n = 0 or n = 1) and shows the matching derivation. Otherwise it runs the full six-step Bernoulli substitution with MathJax-rendered equations.
- Read the plot. The orange curve is the RK4 numerical solution. The blue dashed curve is the closed form evaluated via the integrating factor. The arrow field shows y' everywhere, so you can eyeball other solutions too.
- Copy a CSV of sample points if you want to import the trajectory into another program.
Tips, Pitfalls, and Edge Cases
- Non-integer n requires y > 0. The solver flags combinations like n = 1/2 with y₀ ≤ 0, where yn would be complex.
- y₀ = 0 is often singular. Any Bernoulli equation with Q ≠ 0 and n > 0 has the trivial solution y ≡ 0, which is typically not the branch you want.
- Avoid P(x) blow-ups near x₀. Expressions like 1/x require x₀ ≠ 0; the solver validates this before running.
- Large exponents (|n| > 20) are rejected to prevent overflow. In practice Bernoulli equations with n this large almost never appear in real problems.
- Vertical asymptotes. If RK4 diverges, try narrowing the x range to the side of x₀ where the solution stays finite.
Where Bernoulli Equations Appear
- Population dynamics — the logistic equation y' = ry(1 − y/K) is a Bernoulli equation in disguise (n = 2 after rearranging).
- Chemical kinetics — autocatalytic reactions often obey y' ∝ y − y².
- Electrical circuits — certain nonlinear-resistor RL circuits yield Bernoulli form.
- Fluid mechanics — boundary-layer equations after similarity reduction.
- Epidemic models — the SIR model's susceptible fraction can be reduced to Bernoulli form.
- Economic growth — the Solow–Swan model with constant savings rate is Bernoulli with n = α.
Frequently Asked Questions
What is a Bernoulli differential equation?
A Bernoulli equation is a first-order ODE of the form y' + P(x)y = Q(x)yn, where P and Q are continuous functions and n is any real number. It is a classic example of a nonlinear ODE that can be transformed into a linear one via the substitution v = y1−n.
How does the substitution v = y1−n work?
Multiply the original equation by y−n so every y term becomes y1−n or y−ny'. Setting v = y1−n gives v' = (1−n)y−ny'. Substituting transforms the Bernoulli equation into v' + (1−n)P(x)v = (1−n)Q(x), which is linear in v and solvable with an integrating factor.
What happens when n = 0 or n = 1?
When n = 0 the equation is already linear first-order, so no substitution is required. When n = 1 the Bernoulli recipe would divide by 1 − n = 0, so we handle it separately: the equation collapses to y' = (Q(x) − P(x))·y, which is separable with the closed-form solution y = y₀·exp(∫(Q−P) dx).
Can Bernoulli equations always be solved in closed form?
In principle yes, but the resulting integrals involving the integrating factor may not have elementary antiderivatives. When that happens the calculator evaluates them numerically with Simpson's rule and plots the solution curve. The method itself always reduces a Bernoulli ODE to quadratures.
Why do negative y and non-integer n cause trouble?
If n is not an integer, yn is defined as exp(n·ln y) and is only real for y > 0. Feeding a negative y would produce a complex number. The solver flags this situation and asks for y₀ > 0 or an integer exponent so the solution stays real-valued.
What does the slope field show?
The slope field is a grid of tiny tangent segments whose angle equals y' at that (x, y) point. Any solution curve is forced to follow these tangents, so the slope field lets you see the qualitative shape of all solutions at once, with the initial condition singling out the particular curve.
Further Reading
- Bernoulli differential equation — Wikipedia
- Integrating factor — Wikipedia
- Logistic function — Wikipedia
- Slope field — Wikipedia
Reference this content, page, or tool as:
"Bernoulli ODE Solver" at https://MiniWebtool.com// from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: Apr 23, 2026
You can also try our AI Math Solver GPT to solve your math problems through natural language question and answer.