Undetermined Coefficients Calculator

Type ay'' + by' + cy = g(x), and optionally initial conditions, to find the particular solution.

Write y' and y'' (or dy/dx and d^2y/dx^2): y' + 2y = 4 or y'' - 3y' + 2y = 0. Type powers with ^ and functions with brackets: e^x, sin(x), ln(x).

Optional: two conditions at the same point, such as y(0) = 0, y'(0) = 1. Leave empty for the general solution, with C1 and C2.

Try

Result

You enteredy′′−y=exy'' - y = e^{x}

y=C1 e−x+C2 ex+x ex2\displaystyle y = C_{1}\,e^{-x} + C_{2}\,e^{x} + \frac{x\,e^{x}}{2}
Show the work
  1. Type of equation

    This is a second-order linear equation with constant coefficients whose right side is a polynomial, exponential, sine or cosine (or a product), so undetermined coefficients applies.

  2. Second-order linear equation

    The equation has constant coefficients: ay′′+by′+cy=g(x)ay'' + by' + cy = g(x) with a=1, b=0, c=−1a = 1,\ b = 0,\ c = -1 and g(x)=exg(x) = e^{x}.

    y′′−y=exy'' - y = e^{x}
  3. Characteristic equation

    Try y=erxy = e^{rx}: it solves ay′′+by′+cy=0ay'' + by' + cy = 0 exactly when rr is a root of the characteristic equation.

    Using ar2+br+c=0ar^2 + br + c = 0

    r2−1=0D=b2−4ac=4\begin{gathered} r^2 - 1 = 0 \\ D = b^2 - 4ac = 4 \end{gathered}
  4. Two distinct real roots

    D>0D > 0, so there are two real roots r1≠r2r_1 \ne r_2 and the solutions are er1xe^{r_1x} and er2xe^{r_2x}.

    Using y=C1er1x+C2er2xy = C_1e^{r_1x} + C_2e^{r_2x}

    r=−b±D2a=−1, 1  ⇒  yh=C1 e−x+C2 exr = \frac{-b \pm \sqrt{D}}{2a} = -1,\ 1 \;\Rightarrow\; y_h = C_{1}\,e^{-x} + C_{2}\,e^{x}
  5. Method of undetermined coefficients

    The right side g(x)g(x) is a polynomial, exponential, sine or cosine (or a product), so guess ypy_p of the same kind with unknown coefficients. exe^{x} is already a solution of the homogeneous equation (r=1r = 1 is a root of the characteristic equation), so the guess is multiplied by xx.

    yp=ex(A1x)y_p = e^{x}\left(A_1x\right)
  6. Match coefficients

    Substitute the guess into ay′′+by′+cy=g(x)ay'' + by' + cy = g(x) and equate the coefficients of like terms; this is a linear system for the unknown coefficients.

    A1=12A_1 = \frac{1}{2}
  7. Particular solution

    Put the coefficients back into the guess.

    yp=x ex2y_p = \frac{x\,e^{x}}{2}
  8. General solution

    Add the particular solution ypy_p to the homogeneous solution yhy_h.

    y=yh+yp=C1 e−x+C2 ex+x ex2\begin{aligned} y &= y_h + y_p \\ &= C_{1}\,e^{-x} + C_{2}\,e^{x} + \frac{x\,e^{x}}{2} \end{aligned}
  9. Result

    The general solution, with arbitrary constants.

    y=C1 e−x+C2 ex+x ex2y = C_{1}\,e^{-x} + C_{2}\,e^{x} + \frac{x\,e^{x}}{2}

Worked examples