Skip to content
Tutorials Center
My learning

Topics

Lesson 35 of 68 ยท Differential Equations

Wronskian, Variation of Parameters and Cauchy-Euler Equations

Use the Wronskian to test independent solutions, solve forced ODEs with variation of parameters, and handle Cauchy-Euler equations, checked with SymPy.

In second-order ODEs you met a neat recipe: for a*y'' + b*y' + c*y = f(t) with constant coefficients, solve the characteristic equation and guess a particular solution that looks like the forcing term. That recipe is powerful, but it has two limits. The guessing method (undetermined coefficients) works only for forcing terms like polynomials, exponentials, sines and cosines. And the characteristic equation works only when the coefficients are constants.

This lesson removes both limits. First the Wronskian, a single number that tells you whether two solutions are truly different. Then variation of parameters, which finds a particular solution for almost any forcing function. Finally the Cauchy-Euler equation, a family with variable coefficients that you can solve almost as easily as the constant-coefficient case. Every result is checked with SymPy.

Independent solutions and the Wronskian

For the homogeneous equation y'' + p(x)*y' + q(x)*y = 0, the general solution is c1*y1 + c2*y2, provided y1 and y2 are two linearly independent solutions (neither is a constant multiple of the other). How do you test independence without guessing? Use the Wronskian:

W(y1, y2) = y1*y2' - y2*y1'

If W is not zero at some point of the interval, the functions are independent; for solutions of the same equation, W is either never zero or always zero on the interval. Intuitively, W measures how differently the two functions behave: at a point where they have the same value and slope the determinant is zero.

Examples:

  • y1 = e**x, y2 = e**(2*x): W = e**x * 2*e**(2x) - e**(2x) * e**x = e**(3x), never zero, independent.
  • y1 = cos x, y2 = sin x: W = cos x * cos x - sin x * (-sin x) = 1.
  • y1 = x, y2 = 3x: W = x*3 - 3x*1 = 0. They are dependent.

Abel's theorem says that for y'' + p*y' + q*y = 0 the Wronskian of any two solutions satisfies W' = -p(x)*W, so W(x) = W(x0) * exp(-integral of p). Practical meaning: you only ever need to evaluate W at one convenient point, and for the equation y'' + q*y = 0 (no first-derivative term) W is constant.

Python Wronskians with SymPy

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

For x and x**2 the Wronskian is x**2, which is non-zero for x != 0. Abel's formula for the Bessel equation shows W = C/x, so W can never vanish for x > 0 unless it is zero everywhere.

Variation of parameters

Now the forced equation y'' + p(x)*y' + q(x)*y = g(x). Suppose you know the two independent solutions y1, y2 of the homogeneous equation. The idea of variation of parameters: the homogeneous solution is c1*y1 + c2*y2 with constant c1 and c2. Let those "constants" vary: try y_p = u1(x)*y1 + u2(x)*y2. Choose the functions u1, u2 so that the equation holds and the algebra simplifies. The result is

u1' = -y2*g / W, u2' = y1*g / W

so

y_p = -y1 * integral( y2*g / W ) + y2 * integral( y1*g / W ).

The equation must be in standard form, with a leading coefficient of 1; divide through first if it is not.

flowchart LR
    A["y'' + p y' + q y = g"] --> B["solve homogeneous:<br/>y1, y2"]
    B --> C["W = y1 y2' - y2 y1'"]
    C --> D["u1' = -y2 g / W<br/>u2' = y1 g / W"]
    D --> E["integrate, then<br/>y_p = u1 y1 + u2 y2"]

The recipe: homogeneous solutions, Wronskian, integrate two formulas.

A forcing term undetermined coefficients cannot handle

Solve y'' + y = tan x. The homogeneous solutions are y1 = cos x, y2 = sin x with W = 1. Then

  • u1' = -sin x * tan x = -sin(x)**2 / cos x = -sec x + cos x, so u1 = -ln|sec x + tan x| + sin x.
  • u2' = cos x * tan x = sin x, so u2 = -cos x.

Then y_p = (sin x - ln|sec x + tan x|) cos x + (-cos x) sin x = -cos x * ln|sec x + tan x|. The sin x cos x terms cancel. There is no polynomial or exponential "guess" that produces a ln of a secant, so the guessing method could never have found it.

Python Variation of parameters for y'' + y = tan x

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The residual comes out as zero, confirming y_p. SymPy writes the logarithm in a different but equivalent way (log(sin(x) - 1) is complex on this interval), and the printout shows it differs from the textbook form only by (pi/2)*i*cos(x), a multiple of a homogeneous solution. Any particular solution is acceptable, because the general solution adds c1*y1 + c2*y2 anyway.

Use undetermined coefficients when the forcing term is a polynomial, exponential, sine or cosine, because it is quicker. Reach for variation of parameters when it is anything else (tan x, 1/x, ln x, e**x / x), or when the coefficients are not constant.

Cauchy-Euler equations

The Cauchy-Euler equation (also called the Euler-Cauchy or equidimensional equation) has the form

x**2 * y'' + a*x*y' + b*y = 0

Notice how each term has the same "total degree": x**2 goes with the second derivative, x with the first. This pattern arises in problems with scale invariance, for instance the Laplace equation in polar coordinates, heat flow in cylinders and some pricing models.

Try y = x**m. Then y' = m*x**(m-1) and y'' = m*(m-1)*x**(m-2), and every term becomes a multiple of x**m. The equation reduces to the indicial equation

m*(m - 1) + a*m + b = 0, that is, m**2 + (a - 1)*m + b = 0.

The three cases mirror the constant-coefficient story (for x > 0):

Roots of the indicial equation General solution
Two real, distinct m1, m2 c1*x**m1 + c2*x**m2
One repeated real root m x**m * (c1 + c2*ln x)
Complex alpha +/- i*beta x**alpha * (c1*cos(beta*ln x) + c2*sin(beta*ln x))

The logarithm appears because the substitution x = e**t turns a Cauchy-Euler equation into a constant-coefficient one in t. That is also a handy way to solve any equation of this type.

Python Cauchy-Euler: three cases

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

You should see m = 1, 2 giving C1*x + C2*x**2, a repeated root m = 2 giving x**2*(C1 + C2*log(x)), and the complex pair +/- i giving cos(log(x)) and sin(log(x)).

Non-homogeneous Cauchy-Euler

For x**2*y'' + a*x*y' + b*y = g(x), divide by x**2 to reach standard form y'' + (a/x)*y' + (b/x**2)*y = g(x)/x**2, then use variation of parameters with the homogeneous solutions found above. Remember that the forcing term in the formulas is g/x**2, not g.

Python A forced Cauchy-Euler equation

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • Using variation of parameters without first dividing by the leading coefficient. The formulas assume y'' has coefficient 1.
  • Computing W with the wrong order: it is y1*y2' - y2*y1', and swapping the functions flips the sign, which flips the signs of u1' and u2'.
  • Forgetting that the real-root and complex-root solutions of a Cauchy-Euler equation use ln x, not x, inside sine and cosine.
  • Solving a Cauchy-Euler equation for negative x with ln x instead of ln|x|.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What does a non-zero Wronskian of two solutions tell you?

    A non-zero Wronskian means neither solution is a constant multiple of the other, so together they form a basis for the solutions.
  2. 2. What is the Wronskian of y1 = cos x and y2 = sin x?

    W = cos x * cos x - sin x * (-sin x) = cos^2 x + sin^2 x = 1.
  3. 3. For which equation is variation of parameters the better tool than undetermined coefficients?

    tan x is not a polynomial, exponential, sine or cosine, so there is no simple form to guess. Variation of parameters handles any continuous forcing term.
  4. 4. The indicial equation of x^2 y'' - 2x y' + 2y = 0 is m^2 - 3m + 2 = 0. What is the general solution?

    The roots are m = 1 and m = 2, both real and distinct, so the solutions are x^1 and x^2.
  5. 5. In the variation of parameters formulas, the equation must first be written with which leading coefficient?

    The derivation assumes the standard form y'' + p y' + q y = g, so divide through by the coefficient of y'' first.

Summary

  • The Wronskian W = y1*y2' - y2*y1' tests independence; a non-zero value means the two solutions form a basis.
  • Abel's theorem: W' = -p*W, so W is either never zero or always zero on an interval.
  • Variation of parameters gives y_p = -y1*integral(y2*g/W) + y2*integral(y1*g/W) for any forcing g, in standard form.
  • Cauchy-Euler x**2*y'' + a*x*y' + b*y = 0 is solved with y = x**m; roots of m**2 + (a-1)*m + b = 0 pick between powers, powers with ln x, or cos/sin of ln x.
  • SymPy's wronskian and dsolve are good checks on hand calculations.

Next: when no closed form exists at all, expand the solution as a series in Power-Series Solutions: Bessel and Legendre.