Variation of Parameters Calculator

Type ay'' + by' + cy = g(x) with constant coefficients, such as y'' + y = sec(x), to solve it.

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=csc⁡xy'' + y = \csc x

y=C1 cos⁡x+C2 sin⁡x−x cos⁡x+sin⁡x ln⁡∣sin⁡x∣\displaystyle y = C_{1}\,\cos x + C_{2}\,\sin x - x\,\cos x + \sin x\,\ln\left|\sin x\right|
Show the work
  1. Type of equation

    This is a second-order linear equation with constant coefficients and a right side g(x); variation of parameters works for any g(x) whose integrals can be found.

  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)=csc⁡xg(x) = \csc x.

    y′′+y=csc⁡xy'' + y = \csc 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. Complex roots

    D<0D < 0, so the roots are α±βi\alpha \pm \beta i with α=0\alpha = 0 and β=1\beta = 1; the real solutions are eαxcos⁡βxe^{\alpha x}\cos\beta x and eαxsin⁡βxe^{\alpha x}\sin\beta x.

    Using y=eαx(C1cos⁡βx+C2sin⁡βx)y = e^{\alpha x}(C_1\cos\beta x + C_2\sin\beta x)

    yh=C1cos⁡x+C2sin⁡xy_h = C_1\cos x + C_2\sin x
  5. Variation of parameters

    Look for yp=u1y1+u2y2y_p = u_1y_1 + u_2y_2 with y1,y2y_1, y_2 the solutions of the homogeneous equation and u1,u2u_1, u_2 unknown functions.

    Using u1′=−y2gW,u2′=y1gWu_1' = -\frac{y_2 g}{W},\quad u_2' = \frac{y_1 g}{W}

  6. Wronskian

    The Wronskian of y1=cos⁡xy_1 = \cos x and y2=sin⁡xy_2 = \sin x is W=y1y2′−y1′y2W = y_1y_2' - y_1'y_2.

    W=y1y2′−y1′y2=1\begin{aligned} W &= y_1y_2' - y_1'y_2 \\ &= 1 \end{aligned}
  7. u1' = -y2 g/W and u2' = y1 g/W

    Divide by aa first so the equation reads y′′+⋯=g/ay'' + \dots = g/a; then solve for the derivatives of u1u_1 and u2u_2.

    u1′=−1u2′=cos⁡xsin⁡x\begin{gathered} u_1' = -1 \\ u_2' = \frac{\cos x}{\sin x} \end{gathered}
  8. Integrate

    Integrate each (no constant is needed: constants are already in the homogeneous part).

    u1=−xu2=ln⁡∣sin⁡x∣\begin{gathered} u_1 = -x \\ u_2 = \ln\left|\sin x\right| \end{gathered}
  9. Assemble the solution

    Add the particular solution to the homogeneous one: y=yh+u1y1+u2y2y = y_h + u_1y_1 + u_2y_2.

    y=C1 cos⁡x+C2 sin⁡x−x cos⁡x+sin⁡x ln⁡∣sin⁡x∣y = C_{1}\,\cos x + C_{2}\,\sin x - x\,\cos x + \sin x\,\ln\left|\sin x\right|
  10. Result

    The general solution, with arbitrary constants.

Worked examples