Calculus · real student question

Solve the differential equation y^2 + a y' = b, where a and b are constants.

Question

Solve

y2+adydx=by^{2}+a\frac{dy}{dx}=b

where a0a\neq0 and bb are constants.

Step-by-step solution

  1. Isolate the derivative and check separability. Rearranging,

    adydx=by2dydx=by2aa\frac{dy}{dx}=b-y^{2}\qquad\Longrightarrow\qquad\frac{dy}{dx}=\frac{b-y^{2}}{a}

    The right-hand side depends on yy only, so the equation is separable — and it is autonomous, meaning xx never appears explicitly. It is not linear in yy (the y2y^{2} blocks that), so an integrating factor is not the tool here.

  2. Separate the variables. Divide by by2b-y^{2} and multiply by dxdx:

    dyby2=dxa\frac{dy}{b-y^{2}}=\frac{dx}{a}

    This step assumes y2by^{2}\neq b. The excluded values are exactly the equilibrium solutions y=±by=\pm\sqrt{b} (for b>0b>0), where dy/dx=0dy/dx=0 and yy stays constant forever — genuine solutions that separation would otherwise lose.

  3. Integrate the left side by partial fractions (case b>0b>0). Writing k=bk=\sqrt{b},

    1k2y2=12k(1ky+1k+y)dyk2y2=12klnk+yky\frac{1}{k^{2}-y^{2}}=\frac{1}{2k}\left(\frac{1}{k-y}+\frac{1}{k+y}\right)\Longrightarrow\int\frac{dy}{k^{2}-y^{2}}=\frac{1}{2k}\ln\left|\frac{k+y}{k-y}\right|

    so, with the right side giving x/a+Cx/a+C:

    12blnb+yby=xa+C\frac{1}{2\sqrt{b}}\ln\left|\frac{\sqrt{b}+y}{\sqrt{b}-y}\right|=\frac{x}{a}+C

  4. Solve for yy explicitly. Multiplying by 2b2\sqrt{b} and exponentiating gives b+yby=Ae2bx/a\dfrac{\sqrt{b}+y}{\sqrt{b}-y}=Ae^{2\sqrt{b}x/a}, and solving the resulting linear equation for yy yields

    y=bAe2bx/a1Ae2bx/a+1=btanh ⁣(bax+C)y=\sqrt{b}\,\frac{Ae^{2\sqrt{b}x/a}-1}{Ae^{2\sqrt{b}x/a}+1}=\sqrt{b}\,\tanh\!\left(\frac{\sqrt{b}}{a}x+C\right)

    The second form follows from tanhu=e2u1e2u+1\tanh u=\dfrac{e^{2u}-1}{e^{2u}+1} — the ratio-of-exponentials shape is a hyperbolic tangent in disguise.

  5. Verify by substitution. With a=1.7a=1.7, b=2.3b=2.3, C=0.4C=0.4, a numerical check of y2+ayby^{2}+ay'-b at x=0.2x=0.2, 0.90.9 and 1.61.6 gives a residual below 10610^{-6} ✓. Note y±by\to\pm\sqrt{b} as x±x\to\pm\infty: solutions are trapped between the two equilibria, which is exactly the saturating behaviour tanh\tanh describes.

  6. Handle the other signs of bb. If b<0b<0, write b=c2b=-c^{2}; then ay=(c2+y2)a\,y'=-(c^{2}+y^{2}) integrates to an arctangent, giving y=ctan ⁣(cax+C)y=c\tan\!\left(-\dfrac{c}{a}x+C\right) — verified numerically to 10510^{-5} ✓, and unbounded in finite xx rather than saturating. If b=0b=0, then ay=y2a\,y'=-y^{2} separates to y=ax+Cy=\dfrac{a}{x+C}.

Answer

y=btanh ⁣(bax+C)(b>0);y=btan ⁣(bax+C)(b<0)y=\sqrt{b}\,\tanh\!\left(\frac{\sqrt{b}}{a}x+C\right)\quad(b>0);\qquad y=\sqrt{-b}\,\tan\!\left(-\frac{\sqrt{-b}}{a}x+C\right)\quad(b<0)

Need to solve a different problem like this? Open the solver →