Mathematics for Electrical Science and Physical Science 1. Module 2, second-order linear odes: homogeneous, undetermined coefficients, variation of parameters.

GYMAT101 · 10 pages · Your place is saved in this browser

Contents · Second-Order Linear Ordinary Differential Equations
Text size18

Second-Order Linear Ordinary Differential Equations

Learners will master techniques for solving second-order linear ordinary differential equations, covering both homogeneous and nonhomogeneous systems. They will be able to apply characteristic equations, the method of undetermined coefficients, and variation of parameters to solve initial value problems.

Before you start: Differential Calculus (differentiation rules, product rule, chain rule); Integral Calculus (integration by parts, standard trigonometric and logarithmic integrals); Basic Linear Algebra and System of Linear Equations.

Your path through this module

  1. Structure of Second-Order Linear ODEs: Any general solution to a linear homogeneous second-order ODE is formed by a linear combination of exactly two independent solutions.
  2. Homogeneous ODEs with Constant Coefficients: Assuming an exponential solution transforms a differential equation into a simple quadratic polynomial equation.
  3. Method of Undetermined Coefficients: Differentiating polynomials, exponentials, and sines/cosines reproduces their own family, allowing us to guess the particular solution's algebraic form.
  4. Method of Variation of Parameters: Replacing the constants in the homogeneous solution with variable functions yields an exact formula valid for any continuous forcing function.
  5. Solution Verification, IVPs, and Reduction of Order: Practicing direct verification and reduction of order confirms how linear independence operates algebraically.
  6. Constant-Coefficient Homogeneous ODEs and IVPs: Mastering the three root cases of the characteristic equation enables instant writing of the general solution.
  7. Undetermined Coefficients: Guided Problems and IVPs: Initial conditions must always be applied to the complete solution y_h + y_p, never to y_h alone.
  8. Undetermined Coefficients: Comprehensive Case Practice: Whenever the driving function mimics a natural solution mode, the trial solution must be boosted by powers of x to preserve independence.
  9. Variation of Parameters Practice: Evaluating Wronskian-based integrals provides particular solutions even for functions that do not possess finite derivative sets.

Structure of Second-Order Linear ODEs

In differential calculus, you learned to take derivatives to find rates of change, such as velocity and acceleration from position. This lesson lets you classify second-order differential equations and build their complete solution spaces from individual pieces.

Imagine a mass bouncing on a spring: Newton's second law relates its acceleration (y′′y'') to its velocity (y′y') and position (yy). When the relationship involves only first powers of these terms, we write the equation in standard form as y′′+p(x)y′+q(x)y=r(x)y'' + p(x)y' + q(x)y = r(x). It is called linear because yy and its derivatives are never raised to powers or multiplied by each other. If the external driving force r(x)=0r(x) = 0, the equation is homogeneous; if r(x)≠0r(x) \neq 0, it is nonhomogeneous.

For a homogeneous linear equation, the superposition principle guarantees that if y1(x)y_1(x) and y2(x)y_2(x) are solutions, any combination y(x)=c1y1(x)+c2y2(x)y(x) = c_1 y_1(x) + c_2 y_2(x) is also a solution for any constants c1c_1 and c2c_2. To describe every possible motion, the two solutions must be linearly independent, meaning one is not simply a constant multiple of the other (y2≠ky1y_2 \neq k y_1). Two independent solutions form a basis (or fundamental system), and their combination provides the general solution.

To test independence, we use a determinant called the Wronskian, defined as W(y1,y2)=y1y2′−y1′y2W(y_1, y_2) = y_1 y_2' - y_1' y_2. If W(y1,y2)≠0W(y_1, y_2) \neq 0 across an interval, the two solutions are independent and span the full solution space.

If you already know one valid solution y1(x)y_1(x), you can find a second independent solution y2(x)y_2(x) using reduction of order. By substituting y2(x)=v(x)y1(x)y_2(x) = v(x)y_1(x) into the ODE, the equation collapses into a simpler first-order problem for v′v', yielding the formula:

y2(x)=y1(x)∫e−∫p(x) dxy1(x)2 dxy_2(x) = y_1(x) \int \frac{e^{-\int p(x)\,dx}}{y_1(x)^2}\,dx

Worked example

Find a second independent solution to y′′−4y′+4y=0y'' - 4y' + 4y = 0, given that y1(x)=e2xy_1(x) = e^{2x}.

  1. Identify the coefficient p(x)p(x): In standard form, the coefficient of y′y' is p(x)=−4p(x) = -4.

  2. Compute the numerator exponential: Calculate e−∫p(x) dx=e−∫(−4) dx=e4xe^{-\int p(x)\,dx} = e^{-\int (-4)\,dx} = e^{4x}.

  3. Set up and evaluate the integral: Divide by y12=(e2x)2=e4xy_1^2 = (e^{2x})^2 = e^{4x}:

    ∫e4xe4x dx=∫1 dx=x\int \frac{e^{4x}}{e^{4x}}\,dx = \int 1\,dx = x
  4. Form the second solution: Multiply this result by y1(x)y_1(x) to get y2(x)=xe2xy_2(x) = x e^{2x}.

  5. Write the general solution: Combine them to obtain y(x)=c1e2x+c2xe2xy(x) = c_1 e^{2x} + c_2 x e^{2x}.

Remember

  • The general solution to y′′+p(x)y′+q(x)y=0y'' + p(x)y' + q(x)y = 0 requires exactly two linearly independent solutions: y=c1y1+c2y2y = c_1 y_1 + c_2 y_2.
  • Two solutions are independent if their Wronskian W=y1y2′−y1′y2W = y_1 y_2' - y_1' y_2 is nonzero.
  • If one solution y1y_1 is known, reduction of order determines y2y_2 by setting y2=v(x)y1y_2 = v(x)y_1.

Homogeneous ODEs with Constant Coefficients

In the previous lesson, we saw that any general solution to a second-order linear homogeneous equation is built from two independent solutions: y=c1y1+c2y2y = c_1 y_1 + c_2 y_2. When the equation has constant coefficients, finding those two solutions requires nothing more than high school algebra.

Consider the equation y′′+ay′+by=0y'' + a y' + b y = 0, where aa and bb are fixed real numbers. Think of a physical system like a car shock absorber: the restoring and damping forces depend directly on position and speed. The only function whose derivatives naturally match its own shape—allowing terms to cancel to zero—is the exponential function y=eλxy = e^{\lambda x}.

If we substitute y=eλxy = e^{\lambda x}, y′=λeλxy' = \lambda e^{\lambda x}, and y′′=λ2eλxy'' = \lambda^2 e^{\lambda x} into the differential equation, we get (λ2+aλ+b)eλx=0(\lambda^2 + a\lambda + b)e^{\lambda x} = 0. Because eλxe^{\lambda x} is never zero, we can divide it out. This leaves the characteristic equation (also called the auxiliary equation): λ2+aλ+b=0\lambda^2 + a\lambda + b = 0. Solving this quadratic gives the values of λ\lambda needed to construct our solution.

The roots fall into three distinct cases depending on the quadratic discriminant:

  • Distinct real roots (λ1≠λ2\lambda_1 \neq \lambda_2): The solutions are pure exponentials, giving y=c1eλ1x+c2eλ2xy = c_1 e^{\lambda_1 x} + c_2 e^{\lambda_2 x}. On a graph, this looks like smooth exponential growth or decay.
  • Repeated real root (λ1=λ2=λ\lambda_1 = \lambda_2 = \lambda): A single root only gives one exponential. To obtain a second independent solution, multiply by xx: y=c1eλx+c2xeλxy = c_1 e^{\lambda x} + c_2 x e^{\lambda x}.
  • Complex conjugate roots (λ=α±iβ\lambda = \alpha \pm i\beta): Using Euler's formula (eiθ=cos⁡θ+isin⁡θe^{i\theta} = \cos\theta + i\sin\theta), imaginary powers convert into sines and cosines: y=eαx(c1cos⁡(βx)+c2sin⁡(βx))y = e^{\alpha x}(c_1 \cos(\beta x) + c_2 \sin(\beta x)). Graphically, this is an oscillation with an exponentially growing or decaying amplitude.

An initial value problem provides starting values y(x0)=k0y(x_0) = k_0 and y′(x0)=k1y'(x_0) = k_1. Substituting these values into the general solution and its derivative yields two linear equations to pin down c1c_1 and c2c_2.

Worked example

Solve y′′−4y′+13y=0y'' - 4y' + 13y = 0 subject to y(0)=2y(0) = 2 and y′(0)=1y'(0) = 1.

  1. Write the characteristic equation: Replace derivatives with powers of λ\lambda to get λ2−4λ+13=0\lambda^2 - 4\lambda + 13 = 0.
  2. Find the roots: By the quadratic formula, λ=4±16−522=2±3i\lambda = \frac{4 \pm \sqrt{16 - 52}}{2} = 2 \pm 3i. Here α=2\alpha = 2 and β=3\beta = 3.
  3. Form the general solution: Plug α\alpha and β\beta into the complex-root template: y(x)=e2x(c1cos⁡(3x)+c2sin⁡(3x))y(x) = e^{2x}(c_1 \cos(3x) + c_2 \sin(3x)).
  4. Differentiate to prepare for initial conditions: Using the product rule, y′(x)=2e2x(c1cos⁡(3x)+c2sin⁡(3x))+e2x(−3c1sin⁡(3x)+3c2cos⁡(3x))y'(x) = 2e^{2x}(c_1 \cos(3x) + c_2 \sin(3x)) + e^{2x}(-3c_1 \sin(3x) + 3c_2 \cos(3x)).
  5. Apply y(0)=2y(0) = 2: Since e0=1e^0 = 1, cos⁡(0)=1\cos(0) = 1, and sin⁡(0)=0\sin(0) = 0, we find c1=2c_1 = 2.
  6. Apply y′(0)=1y'(0) = 1: Evaluating y′(0)y'(0) gives 2c1+3c2=12c_1 + 3c_2 = 1. Substituting c1=2c_1 = 2 yields 4+3c2=14 + 3c_2 = 1, so c2=−1c_2 = -1.
  7. State the final result: y(x)=e2x(2cos⁡(3x)−sin⁡(3x))y(x) = e^{2x}(2\cos(3x) - \sin(3x)).

Remember

  • The characteristic equation λ2+aλ+b=0\lambda^2 + a\lambda + b = 0 converts the ODE into an algebraic quadratic problem.
  • Repeated roots gain a factor of xx; complex roots α±iβ\alpha \pm i\beta produce oscillations governed by eαxcos⁡(βx)e^{\alpha x}\cos(\beta x) and eαxsin⁡(βx)e^{\alpha x}\sin(\beta x).
  • Given initial conditions y(x0)y(x_0) and y′(x0)y'(x_0), differentiate the general solution once to solve for constants c1c_1 and c2c_2.

Method of Undetermined Coefficients

Now that you can solve homogeneous equations where a system vibrates freely, we can add an external push—known as a forcing term—to model driven systems like a car riding over rhythmic bumps. This lesson shows you how to find the full response of the system by predicting the algebraic shape of the forced motion.

When an external force f(x)f(x) acts on the system, giving ay′′+by′+cy=f(x)a y'' + b y' + c y = f(x), the complete solution divides into two parts: y(x)=yh(x)+yp(x)y(x) = y_h(x) + y_p(x). The homogeneous solution yhy_h describes the natural, unforced behavior, while the particular solution ypy_p is any single specific function that balances the external push.

Why does guessing work? Differentiating polynomials, exponentials, and sines or cosines keeps them within their own algebraic families. A derivative of an exponential is an exponential, and derivatives of sines produce cosines. Therefore, we select a trial form for ypy_p using unknown constants, plug it into the differential equation, and equate like terms on both sides to find those constants.

If the forcing function consists of several added pieces, the sum rule tells us to add the corresponding trial forms together. However, if any term in your trial guess duplicates a term already present in yhy_h, the differential operator will crush it to zero instead of matching the force. This behavior represents resonance. To fix it, use the modification rule: multiply the trial guess by xx (or x2x^2 if the characteristic root is repeated) until no part duplicates a term in yhy_h.

Worked example

Find the general solution to y′′−3y′+2y=4e3xy'' - 3y' + 2y = 4e^{3x}.

  1. Find the homogeneous solution yhy_h: Solve the characteristic equation r2−3r+2=(r−1)(r−2)=0r^2 - 3r + 2 = (r - 1)(r - 2) = 0. The roots are r=1r = 1 and r=2r = 2, yielding yh=C1ex+C2e2xy_h = C_1 e^{x} + C_2 e^{2x}.
  2. Choose the trial form for ypy_p: The forcing term is 4e3x4e^{3x}. Because e3xe^{3x} does not appear in yhy_h, duplication is not an issue. We guess yp=Ae3xy_p = A e^{3x}, where AA is an undetermined coefficient.
  3. Substitute into the differential equation: Taking derivatives gives yp′=3Ae3xy_p' = 3A e^{3x} and yp′′=9Ae3xy_p'' = 9A e^{3x}. Substituting these into the left side yields (9Ae3x)−3(3Ae3x)+2(Ae3x)=2Ae3x(9A e^{3x}) - 3(3A e^{3x}) + 2(A e^{3x}) = 2A e^{3x}.
  4. Solve for the coefficient: Set the result equal to the forcing function: 2Ae3x=4e3x2A e^{3x} = 4e^{3x}. Equating coefficients gives 2A=42A = 4, so A=2A = 2. Thus, yp=2e3xy_p = 2e^{3x}.
  5. Write the complete solution: Combine the natural and driven responses: y(x)=C1ex+C2e2x+2e3xy(x) = C_1 e^{x} + C_2 e^{2x} + 2e^{3x}.

Remember

  • The general solution is always the sum of the natural response and the forced response: y=yh+ypy = y_h + y_p.
  • Trial forms must mirror the family of the forcing function (polynomial, exponential, or sinusoidal combinations).
  • If a trial term duplicates any part of yhy_h, multiply that trial term by xx until the overlap is gone.

Method of Variation of Parameters

You already know how to find particular solutions when the forcing term has cycling derivatives, like polynomials or sines. But what happens if an engine is driven by a force like sec⁡(x)\sec(x) or ln⁡(x)\ln(x)? Because their derivatives keep creating new shapes indefinitely, guessing fails; variation of parameters provides a universal formula that works for any continuous forcing function.

Imagine a radio receiver with two tuning knobs, c1c_1 and c2c_2, in the homogeneous response yh=c1y1+c2y2y_h = c_1 y_1 + c_2 y_2. Instead of leaving those knobs permanently fixed at constant values, we let them continuously adjust over time as functions, u1(x)u_1(x) and u2(x)u_2(x). Our new particular solution takes the form yp=u1(x)y1(x)+u2(x)y2(x)y_p = u_1(x)y_1(x) + u_2(x)y_2(x).

To find these functions, we measure how independent the two fundamental solutions are using the Wronskian, denoted W(y1,y2)W(y_1, y_2). The Wronskian is a 2×22 \times 2 determinant formed by the solutions and their slopes: W=y1y2′−y2y1′W = y_1 y_2' - y_2 y_1'. You can picture this as tracking the area spanned by the two solution states at each point; since y1y_1 and y2y_2 are independent, this area is never zero.

For an equation in standard form y′′+p(x)y′+q(x)y=g(x)y'' + p(x)y' + q(x)y = g(x), substituting ypy_p yields two straightforward formulas for the rates at which our knobs must turn:

u1′(x)=−y2(x)g(x)W(x),u2′(x)=y1(x)g(x)W(x)u_1'(x) = -\frac{y_2(x) g(x)}{W(x)}, \quad u_2'(x) = \frac{y_1(x) g(x)}{W(x)}

Integrating both gives u1(x)u_1(x) and u2(x)u_2(x), directly assembling ypy_p.

Worked example

Find the general solution to y′′+y=sec⁡(x)y'' + y = \sec(x).

  1. Find the homogeneous solutions: The characteristic equation r2+1=0r^2 + 1 = 0 gives roots r=±ir = \pm i, so y1=cos⁡(x)y_1 = \cos(x) and y2=sin⁡(x)y_2 = \sin(x).

  2. Compute the Wronskian: Apply the determinant definition to ensure independence:

    W=(cos⁡(x))(cos⁡(x))−(sin⁡(x))(−sin⁡(x))=cos⁡2(x)+sin⁡2(x)=1W = (\cos(x))(\cos(x)) - (\sin(x))(-\sin(x)) = \cos^2(x) + \sin^2(x) = 1
  3. Set up and evaluate u1u_1 and u2u_2: Plug g(x)=sec⁡(x)g(x) = \sec(x) into the rate formulas:

    u1′(x)=−sin⁡(x)sec⁡(x)1=−tan⁡(x)  ⟹  u1(x)=ln⁡∣cos⁡(x)∣u_1'(x) = -\frac{\sin(x)\sec(x)}{1} = -\tan(x) \implies u_1(x) = \ln|\cos(x)|
u2′(x)=cos⁡(x)sec⁡(x)1=1  ⟹  u2(x)=xu_2'(x) = \frac{\cos(x)\sec(x)}{1} = 1 \implies u_2(x) = x
  1. Assemble the general solution: Combine y=yh+ypy = y_h + y_p:

    y(x)=c1cos⁡(x)+c2sin⁡(x)+cos⁡(x)ln⁡∣cos⁡(x)∣+xsin⁡(x)y(x) = c_1\cos(x) + c_2\sin(x) + \cos(x)\ln|\cos(x)| + x\sin(x)

Remember

  • Always divide the ODE by the coefficient of y′′y'' first so that g(x)g(x) is identified correctly.
  • The Wronskian W=y1y2′−y2y1′W = y_1 y_2' - y_2 y_1' sits in the denominator of both parameter rates.
  • The first rate carries a negative sign: u1′=−y2g/Wu_1' = -y_2 g / W, while u2′=y1g/Wu_2' = y_1 g / W.

Solution Verification, IVPs, and Reduction of Order

Having covered fundamental ODE properties in theory, you will now practice verifying solutions and generating independent bases from scratch. Practicing direct verification and reduction of order confirms how linear independence operates algebraically.

The idea

A function y=h(x)y = h(x) is a solution of a second-order ODE on an open interval II if it is twice differentiable on II and turns the equation into a true identity when you substitute hh, h′h', and h′′h'' for yy, y′y', and y′′y''. Once you verify two solutions y1y_1 and y2y_2 that are not proportional (y1/y2≠constanty_1 / y_2 \neq \text{constant}), they form a basis (or fundamental system) of linearly independent solutions. Their linear combination y=c1y1+c2y2y = c_1 y_1 + c_2 y_2 is the general solution.

An initial value problem (IVP) pairs the ODE with two initial conditions, y(x0)=k0y(x_0) = k_0 and y′(x0)=k1y'(x_0) = k_1, at a single point x0x_0. Because the general solution contains two arbitrary constants c1c_1 and c2c_2, you need both the function value and the derivative value to lock in a unique curve. Substituting these conditions into yy and y′y' gives two algebraic equations; solving for c1c_1 and c2c_2 yields the particular solution.

Sometimes you only know one solution y1y_1 of a homogeneous equation in standard form, y′′+p(x)y′+q(x)y=0y'' + p(x)y' + q(x)y = 0, where the coefficient of y′′y'' is 1. Reduction of order finds a second, independent solution y2y_2 without guessing. Seeking y2y_2 as a non-constant multiple of y1y_1 cancels the zero-order terms and reduces the problem to a direct integration:

y2=y1∫1y12e−∫p(x) dx dxy_2 = y_1 \int \frac{1}{y_1^2} e^{-\int p(x)\,dx}\,dx

The resulting y1y_1 and y2y_2 are guaranteed to form a basis.

Worked example

Given: The homogeneous ODE y′′+y=0y'' + y = 0 and the candidate functions y=cos⁡xy = \cos x and y=sin⁡xy = \sin x. Find: Whether y=cos⁡xy = \cos x and y=sin⁡xy = \sin x are solutions of the ODE.

  1. Differentiate the first candidate y=cos⁡xy = \cos x twice to get y′=−sin⁡xy' = -\sin x and y′′=−cos⁡xy'' = -\cos x, because we must substitute both the function and its second derivative into the ODE.
  2. Substitute yy and y′′y'' into y′′+y=0y'' + y = 0 to obtain −cos⁡x+cos⁡x=0-\cos x + \cos x = 0, which simplifies to the identity 0=00 = 0 and confirms y=cos⁡xy = \cos x is a solution.
  3. Differentiate the second candidate y=sin⁡xy = \sin x twice to find y′=cos⁡xy' = \cos x and y′′=−sin⁡xy'' = -\sin x.
  4. Substitute these into y′′+y=0y'' + y = 0 to get −sin⁡x+sin⁡x=0-\sin x + \sin x = 0, confirming that y=sin⁡xy = \sin x is also a solution.

Answer: Both y=cos⁡xy = \cos x and y=sin⁡xy = \sin x are solutions of y′′+y=0y'' + y = 0.

More problems

Problem 2: Checking exponential candidates by substitution

Given: The ODE y′′−5y′+6y=0y'' - 5y' + 6y = 0 and candidate functions y=e2xy = e^{2x} and y=exy = e^x. Find: Whether e2xe^{2x} and exe^x are solutions of the ODE.

  1. Differentiate y=e2xy = e^{2x} twice using the chain rule to get y′=2e2xy' = 2e^{2x} and y′′=4e2xy'' = 4e^{2x}.
  2. Substitute into the ODE to get 4e2x−5(2e2x)+6e2x=04e^{2x} - 5(2e^{2x}) + 6e^{2x} = 0, confirming y=e2xy = e^{2x} is a solution.
  3. Differentiate y=exy = e^x twice to get y′=exy' = e^x and y′′=exy'' = e^x.
  4. Substitute into the ODE to get ex−5ex+6ex=2ex≠0e^x - 5e^x + 6e^x = 2e^x \neq 0, showing exe^x fails the equation.

Answer: y=e2xy = e^{2x} is a solution, whereas y=exy = e^x is not a solution.

Problem 3: Solving an IVP with trigonometric solutions

Given: Solutions y1=cos⁡xy_1 = \cos x and y2=sin⁡xy_2 = \sin x for y′′+y=0y'' + y = 0, with y(0)=3y(0) = 3 and y′(0)=−0.5y'(0) = -0.5. Find: The general solution and the particular solution.

  1. Combine the basis functions to write the general solution y=c1cos⁡x+c2sin⁡xy = c_1 \cos x + c_2 \sin x.
  2. Differentiate yy to get y′=−c1sin⁡x+c2cos⁡xy' = -c_1 \sin x + c_2 \cos x so we can apply the derivative condition.
  3. Substitute y(0)=3y(0) = 3 into yy to get c1cos⁡0+c2sin⁡0=3c_1 \cos 0 + c_2 \sin 0 = 3, which gives c1=3c_1 = 3.
  4. Substitute y′(0)=−0.5y'(0) = -0.5 into y′y' to get −c1sin⁡0+c2cos⁡0=−0.5-c_1 \sin 0 + c_2 \cos 0 = -0.5, giving c2=−0.5c_2 = -0.5.
  5. Insert c1=3c_1 = 3 and c2=−0.5c_2 = -0.5 into the general solution to form the particular solution.

Answer: General solution: y=c1cos⁡x+c2sin⁡xy = c_1 \cos x + c_2 \sin x; Particular solution: y=3cos⁡x−0.5sin⁡xy = 3\cos x - 0.5\sin x.

Problem 4: Verifying a basis and solving an IVP

Given: Candidates y1=exy_1 = e^x and y2=e−xy_2 = e^{-x} for y′′−y=0y'' - y = 0, with y(0)=6y(0) = 6 and y′(0)=−2y'(0) = -2. Find: Verification that y1y_1 and y2y_2 are solutions, and the particular solution of the IVP.

  1. Compute y1′=exy_1' = e^x and y1′′=exy_1'' = e^x, then substitute into y′′−y=0y'' - y = 0 to get ex−ex=0e^x - e^x = 0.
  2. Compute y2′=−e−xy_2' = -e^{-x} and y2′′=e−xy_2'' = e^{-x}, then substitute into y′′−y=0y'' - y = 0 to get e−x−e−x=0e^{-x} - e^{-x} = 0.
  3. Write the general solution y=c1ex+c2e−xy = c_1 e^x + c_2 e^{-x} since exe^x and e−xe^{-x} are not proportional.
  4. Differentiate the general solution to obtain y′=c1ex−c2e−xy' = c_1 e^x - c_2 e^{-x}.
  5. Apply y(0)=6y(0) = 6 and y′(0)=−2y'(0) = -2 to get the system c1+c2=6c_1 + c_2 = 6 and c1−c2=−2c_1 - c_2 = -2.
  6. Add the two equations to find 2c1=4⇒c1=22c_1 = 4 \Rightarrow c_1 = 2, then substitute back to get c2=4c_2 = 4.
  7. Substitute c1=2c_1 = 2 and c2=4c_2 = 4 into the general solution.

Answer: Both exe^x and e−xe^{-x} are verified solutions; the particular solution is y=2ex+4e−xy = 2e^x + 4e^{-x}.

Problem 5: Finding a second solution by reduction of order

Given: The ODE y′′−5y′+6y=0y'' - 5y' + 6y = 0 and one known solution y1=e2xy_1 = e^{2x}. Find: A second linearly independent solution y2y_2 using reduction of order.

  1. Compare y′′−5y′+6y=0y'' - 5y' + 6y = 0 with standard form y′′+p(x)y′+q(x)y=0y'' + p(x)y' + q(x)y = 0 to identify p(x)=−5p(x) = -5.
  2. Substitute y1=e2xy_1 = e^{2x} and p=−5p = -5 into the reduction of order formula y2=y1∫1y12e−∫p dx dxy_2 = y_1 \int \frac{1}{y_1^2} e^{-\int p\,dx}\,dx.
  3. Evaluate y12=e4xy_1^2 = e^{4x} and the integrating factor e−∫−5 dx=e5xe^{-\int -5\,dx} = e^{5x} to get y2=e2x∫e5xe4x dxy_2 = e^{2x} \int \frac{e^{5x}}{e^{4x}}\,dx.
  4. Simplify the integrand to exe^x and integrate to find y2=e2x∫ex dx=e2xex=e3xy_2 = e^{2x} \int e^x\,dx = e^{2x} e^x = e^{3x}.

Watch out. Keep the negative sign attached to p(x)=−5p(x) = -5 and remember the formula already has a minus sign in e−∫p dxe^{-\int p\,dx}, making the exponent +5x+5x.

Answer: y2=e3xy_2 = e^{3x}.

Constant-Coefficient Homogeneous ODEs and IVPs

With the general solution structure understood, you can now apply characteristic equations to solve homogeneous differential equations of increasing complexity. Mastering the three root cases of the characteristic quadratic equation allows you to write down the general solution instantly and solve initial value problems systematically.

The idea

Substituting the exponential trial solution y=eλxy = e^{\lambda x} into the constant-coefficient equation y′′+ay′+by=0y'' + ay' + by = 0 transforms the calculus problem into an algebra problem: the characteristic equation (or auxiliary equation) λ2+aλ+b=0\lambda^2 + a\lambda + b = 0. Because every second-order linear homogeneous ODE requires two linearly independent solutions to form a basis, the algebraic nature of the roots λ1,λ2\lambda_1, \lambda_2 dictates the exact functional form of the general solution (also called the complementary function, yhy_h).

When the quadratic yields two distinct real roots λ1≠λ2\lambda_1 \neq \lambda_2, the two exponential functions eλ1xe^{\lambda_1 x} and eλ2xe^{\lambda_2 x} are automatically independent, giving y=c1eλ1x+c2eλ2xy = c_1 e^{\lambda_1 x} + c_2 e^{\lambda_2 x}. If the discriminant a2−4ba^2 - 4b is zero, you get a real double root λ=−a/2\lambda = -a/2. Because repeating eλxe^{\lambda x} fails linear independence, reduction of order multiplies the second term by xx, producing the basis eλxe^{\lambda x} and xeλxx e^{\lambda x} and the general solution y=(c1+c2x)eλxy = (c_1 + c_2 x)e^{\lambda x}. When the discriminant is negative, the quadratic formula produces complex conjugate roots α±iβ\alpha \pm i\beta. Applying Euler's formula converts complex exponentials into real oscillating functions modulated by an exponential envelope, yielding y=eαx[c1cos⁡(βx)+c2sin⁡(βx)]y = e^{\alpha x}[c_1 \cos(\beta x) + c_2 \sin(\beta x)].

To solve an initial value problem (IVP), you first write the general solution for the appropriate root case, differentiate it once to obtain y′(x)y'(x), and substitute the given initial values y(x0)y(x_0) and y′(x0)y'(x_0). This creates a 2×22 \times 2 linear system of algebraic equations for the unknown constants c1c_1 and c2c_2.

Worked example

Problem 2.2: Given: The homogeneous differential equation y′′+36y=0y'' + 36y = 0. Find: The general solution y(x)y(x) and check the answer by direct substitution.

  1. Replace y′′y'' with λ2\lambda^2 and yy with 11 to write the characteristic equation λ2+36=0\lambda^2 + 36 = 0, since y′=0⋅y′y' = 0\cdot y' has coefficient a=0a = 0.
  2. Solve the quadratic equation for λ\lambda to obtain the pure imaginary conjugate roots λ=±6i\lambda = \pm 6i, which correspond to complex roots α±iβ\alpha \pm i\beta with real part α=0\alpha = 0 and imaginary part β=6\beta = 6.
  3. Substitute α=0\alpha = 0 and β=6\beta = 6 into the Case 3 complex-root template y=eαx[c1cos⁡(βx)+c2sin⁡(βx)]y = e^{\alpha x}[c_1 \cos(\beta x) + c_2 \sin(\beta x)] to get the general solution y(x)=c1cos⁡(6x)+c2sin⁡(6x)y(x) = c_1 \cos(6x) + c_2 \sin(6x) because e0x=1e^{0x} = 1.
  4. Differentiate y(x)y(x) twice using the chain rule to verify the solution: y′(x)=−6c1sin⁡(6x)+6c2cos⁡(6x)y'(x) = -6c_1 \sin(6x) + 6c_2 \cos(6x) and y′′(x)=−36c1cos⁡(6x)−36c2sin⁡(6x)y''(x) = -36c_1 \cos(6x) - 36c_2 \sin(6x).
  5. Substitute y′′y'' and yy into the left-hand side of the ODE: [−36c1cos⁡(6x)−36c2sin⁡(6x)]+36[c1cos⁡(6x)+c2sin⁡(6x)]=0[-36c_1 \cos(6x) - 36c_2 \sin(6x)] + 36[c_1 \cos(6x) + c_2 \sin(6x)] = 0, confirming the solution is valid.

Answer: y(x)=c1cos⁡(6x)+c2sin⁡(6x)y(x) = c_1 \cos(6x) + c_2 \sin(6x)

More problems

Problem 2.1: Distinct real roots from a two-term ODE

Given: The differential equation 4y′′−25y=04y'' - 25y = 0. Find: The general solution y(x)y(x) and verify it by substitution.

  1. Divide the equation by 44 to put it into standard form y′′−254y=0y'' - \frac{25}{4}y = 0.
  2. Write the characteristic equation λ2−254=0\lambda^2 - \frac{25}{4} = 0 and solve to find distinct real roots λ=±52\lambda = \pm \frac{5}{2}.
  3. Write the Case 1 general solution y(x)=c1e52x+c2e−52xy(x) = c_1 e^{\frac{5}{2}x} + c_2 e^{-\frac{5}{2}x}.
  4. Differentiate twice to get y′(x)=52c1e52x−52c2e−52xy'(x) = \frac{5}{2} c_1 e^{\frac{5}{2}x} - \frac{5}{2} c_2 e^{-\frac{5}{2}x} and y′′(x)=254c1e52x+254c2e−52xy''(x) = \frac{25}{4} c_1 e^{\frac{5}{2}x} + \frac{25}{4} c_2 e^{-\frac{5}{2}x}.
  5. Substitute y′′y'' and yy into y′′−254y=0y'' - \frac{25}{4}y = 0 to obtain 254c1e52x+254c2e−52x−254[c1e52x+c2e−52x]=0\frac{25}{4} c_1 e^{\frac{5}{2}x} + \frac{25}{4} c_2 e^{-\frac{5}{2}x} - \frac{25}{4}[c_1 e^{\frac{5}{2}x} + c_2 e^{-\frac{5}{2}x}] = 0.

Answer: y(x)=c1e52x+c2e−52xy(x) = c_1 e^{\frac{5}{2}x} + c_2 e^{-\frac{5}{2}x}

Problem 2.3: General solution with distinct negative roots

Given: The differential equation y′′+9y′+20y=0y'' + 9y' + 20y = 0. Find: The general solution y(x)y(x) and check by substitution.

  1. Form the characteristic equation λ2+9λ+20=0\lambda^2 + 9\lambda + 20 = 0 and factor it as (λ+5)(λ+4)=0(\lambda + 5)(\lambda + 4) = 0.
  2. Extract the distinct real roots λ=−5,−4\lambda = -5, -4 and write the general solution y=c1e−5x+c2e−4xy = c_1 e^{-5x} + c_2 e^{-4x}.
  3. Differentiate twice: y′=−5c1e−5x−4c2e−4xy' = -5c_1 e^{-5x} - 4c_2 e^{-4x} and y′′=25c1e−5x+16c2e−4xy'' = 25c_1 e^{-5x} + 16c_2 e^{-4x}.
  4. Substitute y,y′,y′′y, y', y'' into the ODE to get (25−45+20)c1e−5x+(16−36+20)c2e−4x=0(25 - 45 + 20)c_1 e^{-5x} + (16 - 36 + 20)c_2 e^{-4x} = 0.

Answer: y=c1e−5x+c2e−4xy = c_1 e^{-5x} + c_2 e^{-4x}

Problem 2.4: Repeated transcendental root

Given: The differential equation y′′+2πy′+π2y=0y'' + 2\pi y' + \pi^2 y = 0. Find: The general solution y(x)y(x) and check by substitution.

  1. Write the characteristic equation λ2+2πλ+π2=0\lambda^2 + 2\pi\lambda + \pi^2 = 0 and factor the perfect square as (λ+π)2=0(\lambda + \pi)^2 = 0.
  2. Identify the real double root λ=−π\lambda = -\pi and write the Case 2 general solution y(x)=(c1+c2x)e−πxy(x) = (c_1 + c_2 x)e^{-\pi x}.
  3. Differentiate using the product rule to find y′(x)=(c2−πc1−πc2x)e−πxy'(x) = (c_2 - \pi c_1 - \pi c_2 x)e^{-\pi x} and y′′(x)=(π2c1−2πc2+π2c2x)e−πxy''(x) = (\pi^2 c_1 - 2\pi c_2 + \pi^2 c_2 x)e^{-\pi x}.
  4. Substitute y,y′,y′′y, y', y'' into y′′+2πy′+π2y=0y'' + 2\pi y' + \pi^2 y = 0 so all terms cancel to 00.

Answer: y(x)=(c1+c2x)e−πxy(x) = (c_1 + c_2 x)e^{-\pi x}

Problem 1.3: Initial value problem with pure imaginary roots

Given: The initial value problem y′′+y=0y'' + y = 0, y(0)=3y(0) = 3, y′(0)=−0.5y'(0) = -0.5. Find: The particular solution y(x)y(x).

  1. Solve the characteristic equation λ2+1=0\lambda^2 + 1 = 0 to obtain complex roots λ=±i\lambda = \pm i with α=0,β=1\alpha = 0, \beta = 1.
  2. Write the general solution y=C1cos⁡x+C2sin⁡xy = C_1 \cos x + C_2 \sin x and differentiate to get y′=−C1sin⁡x+C2cos⁡xy' = -C_1 \sin x + C_2 \cos x.
  3. Apply y(0)=3y(0) = 3 to the general solution to find C1=3C_1 = 3.
  4. Apply y′(0)=−0.5y'(0) = -0.5 to the derivative to find C2=−0.5C_2 = -0.5, and substitute both constants into y(x)y(x).

Answer: y(x)=3cos⁡x−0.5sin⁡xy(x) = 3 \cos x - 0.5 \sin x

Problem 4.2: Oscillating IVP with frequency scaling

Given: The initial value problem y′′+25y=0y'' + 25y = 0, y(0)=4.6y(0) = 4.6, y′(0)=−1.2y'(0) = -1.2. Find: The particular solution y(x)y(x).

  1. Solve the characteristic equation λ2+25=0\lambda^2 + 25 = 0 to get λ=±5i\lambda = \pm 5i, giving y=c1cos⁡5x+c2sin⁡5xy = c_1 \cos 5x + c_2 \sin 5x.
  2. Differentiate using the chain rule to obtain y′=−5c1sin⁡5x+5c2cos⁡5xy' = -5c_1 \sin 5x + 5c_2 \cos 5x.
  3. Substitute y(0)=4.6y(0) = 4.6 into yy to get c1=4.6c_1 = 4.6.
  4. Substitute y′(0)=−1.2y'(0) = -1.2 into y′y' to get 5c2=−1.2  ⟹  c2=−0.245c_2 = -1.2 \implies c_2 = -0.24.

Watch out. Do not forget the chain-rule factor of 55 when differentiating sin⁡5x\sin 5x, or c2c_2 will be off by a factor of 55.

Answer: y=4.6cos⁡5x−0.24sin⁡5xy = 4.6 \cos 5x - 0.24 \sin 5x

Problem 1.1: Initial value problem with distinct real roots

Given: The initial value problem y′′+y′−2y=0y'' + y' - 2y = 0, y(0)=4y(0) = 4, y′(0)=5y'(0) = 5 (solved using y′(0)=−5y'(0) = -5 in steps). Find: The particular solution y(x)y(x).

  1. Factor the characteristic equation λ2+λ−2=0\lambda^2 + \lambda - 2 = 0 as (λ−1)(λ+2)=0(\lambda - 1)(\lambda + 2) = 0 to get roots λ1=1,λ2=−2\lambda_1 = 1, \lambda_2 = -2.
  2. Write the general solution y=c1ex+c2e−2xy = c_1 e^x + c_2 e^{-2x} and differentiate to get y′=c1ex−2c2e−2xy' = c_1 e^x - 2c_2 e^{-2x}.
  3. Apply y(0)=4y(0) = 4 and y′(0)=−5y'(0) = -5 to form the linear system c1+c2=4c_1 + c_2 = 4 and c1−2c2=−5c_1 - 2c_2 = -5.
  4. Subtract the second equation from the first to get 3c2=9  ⟹  c2=33c_2 = 9 \implies c_2 = 3, which gives c1=4−3=1c_1 = 4 - 3 = 1.

Watch out. The problem statement prints y′(0)=5y'(0) = 5, but the worked steps and answer use y′(0)=−5y'(0) = -5 (which gives y=ex+3e−2xy = e^x + 3e^{-2x}; using +5+5 gives y=133ex−13e−2xy = \frac{13}{3}e^x - \frac{1}{3}e^{-2x}).

Answer: y=ex+3e−2xy = e^x + 3e^{-2x}

Problem 4.1: Distinct real roots with zero initial velocity

Given: The initial value problem y′′+y′−6y=0y'' + y' - 6y = 0, y(0)=10y(0) = 10, y′(0)=0y'(0) = 0. Find: The particular solution y(x)y(x).

  1. Factor the characteristic equation λ2+λ−6=0\lambda^2 + \lambda - 6 = 0 as (λ+3)(λ−2)=0(\lambda + 3)(\lambda - 2) = 0 to find roots λ=−3,2\lambda = -3, 2.
  2. Write the general solution y=c1e−3x+c2e2xy = c_1 e^{-3x} + c_2 e^{2x} and its derivative y′=−3c1e−3x+2c2e2xy' = -3c_1 e^{-3x} + 2c_2 e^{2x}.
  3. Substitute x=0x = 0 into both expressions to form the system c1+c2=10c_1 + c_2 = 10 and −3c1+2c2=0-3c_1 + 2c_2 = 0.
  4. Multiply c1+c2=10c_1 + c_2 = 10 by −3-3 and add to −3c1+2c2=0-3c_1 + 2c_2 = 0 to find c2=6c_2 = 6 and c1=4c_1 = 4.

Answer: y=4e−3x+6e2xy = 4e^{-3x} + 6e^{2x}

Problem 1.2: Double root IVP via quadratic formula

Given: The initial value problem y′′+y′+0.25y=0y'' + y' + 0.25y = 0, y(0)=3y(0) = 3, y′(0)=−3.5y'(0) = -3.5. Find: The particular solution y(x)y(x).

  1. Apply the quadratic formula to λ2+λ+0.25=0\lambda^2 + \lambda + 0.25 = 0: λ=−1±1−4(0.25)2=−0.5\lambda = \frac{-1 \pm \sqrt{1 - 4(0.25)}}{2} = -0.5.
  2. Write the Case 2 general solution for the double root: y=(C1+C2x)e−0.5xy = (C_1 + C_2 x)e^{-0.5x}.
  3. Differentiate using the product rule to obtain y′=C2e−0.5x−0.5(C1+C2x)e−0.5xy' = C_2 e^{-0.5x} - 0.5(C_1 + C_2 x)e^{-0.5x}.
  4. Substitute y(0)=3y(0) = 3 to get C1=3C_1 = 3, and substitute y′(0)=−3.5y'(0) = -3.5 to get C2−0.5(3)=−3.5  ⟹  C2=−2C_2 - 0.5(3) = -3.5 \implies C_2 = -2.

Answer: y=(3−2x)e−0.5xy = (3 - 2x)e^{-0.5x}

Problem 4.3: Double root IVP via factoring

Given: The initial value problem y′′+y′+0.25y=0y'' + y' + 0.25y = 0, y(0)=3y(0) = 3, y′(0)=−3.5y'(0) = -3.5. Find: The particular solution y(x)y(x).

  1. Factor the characteristic equation λ2+λ+0.25=0\lambda^2 + \lambda + 0.25 = 0 as (λ+0.5)2=0(\lambda + 0.5)^2 = 0 to get the double root λ=−0.5,−0.5\lambda = -0.5, -0.5.
  2. Write the general solution y=(c1+c2x)e−0.5xy = (c_1 + c_2 x)e^{-0.5x} and differentiate: y′=(c1+c2x)(−0.5)e−0.5x+c2e−0.5xy' = (c_1 + c_2 x)(-0.5)e^{-0.5x} + c_2 e^{-0.5x}.
  3. Evaluate at x=0x = 0 using y(0)=3y(0) = 3 to get c1=3c_1 = 3.
  4. Evaluate y′(0)=−3.5y'(0) = -3.5 to get −0.5(3)+c2=−3.5  ⟹  c2=−2-0.5(3) + c_2 = -3.5 \implies c_2 = -2, then substitute c1,c2c_1, c_2 into yy.

Watch out. The final line prints an extra leading 3+3 + typo in y=3+(3−2x)e−0.5xy = 3 + (3 - 2x)e^{-0.5x}; substituting c1=3c_1 = 3 and c2=−2c_2 = -2 into (c1+c2x)e−0.5x(c_1 + c_2 x)e^{-0.5x} gives (3−2x)e−0.5x(3 - 2x)e^{-0.5x}.

Answer: y=3+(3−2x)e−0.5xy = 3 + (3 - 2x)e^{-0.5x} (or y=(3−2x)e−0.5xy = (3 - 2x)e^{-0.5x})

Undetermined Coefficients: Guided Problems and IVPs

You already know how to find the general solution yhy_h for homogeneous equations with constant coefficients and how to choose trial forms for undetermined coefficients. Now you will find particular solutions ypy_p for driven equations and apply initial conditions to the complete solution y=yh+ypy = y_h + y_p.

The idea

A nonhomogeneous linear ODE has a driving term r(x)r(x) on the right-hand side: y′′+ay′+by=r(x)y'' + ay' + by = r(x). Its general solution on an open interval is the sum y(x)=yh(x)+yp(x)y(x) = y_h(x) + y_p(x), where yh=c1y1+c2y2y_h = c_1 y_1 + c_2 y_2 solves the corresponding homogeneous equation and the particular solution ypy_p is any solution to the full equation containing no arbitrary constants.

To find ypy_p using undetermined coefficients, follow three choice rules. Under the basic rule, pick a trial form matching the family of r(x)r(x); for instance, a degree-nn polynomial requires a full polynomial Knxn+…+K1x+K0K_n x^n + … + K_1 x + K_0 because derivatives of xnx^n generate lower powers of xx that must cancel out. Under the modification rule, if your trial term is already a solution in yhy_h, multiply it by xx—or by x2x^2 if it matches a double root of the characteristic equation—so it does not vanish when plugged into the left-hand side. Under the sum rule, if r(x)r(x) is a sum of functions, add their corresponding trial forms together.

When solving an initial value problem, the key rule in words is: initial conditions must always be applied to the complete general solution y=yh+ypy = y_h + y_p, never to yhy_h alone. The particular solution ypy_p contributes to both the initial value y(0)y(0) and the initial slope y′(0)y'(0), so finding c1c_1 and c2c_2 before adding ypy_p will give the wrong constants.

Worked example

Given: The initial value problem y′′+y=0.001x2y'' + y = 0.001x^2 with initial conditions y(0)=0y(0) = 0 and y′(0)=1.5y'(0) = 1.5. Find: The particular solution y(x)y(x) satisfying the ODE and initial conditions.

  1. Solve the corresponding homogeneous equation y′′+y=0y'' + y = 0 by forming its characteristic equation m2+1=0m^2 + 1 = 0, which gives roots m=±im = \pm i and the homogeneous solution yh=C1cos⁡x+C2sin⁡xy_h = C_1 \cos x + C_2 \sin x.
  2. Choose the trial solution yp=K2x2+K1x+K0y_p = K_2 x^2 + K_1 x + K_0 using the basic rule for the polynomial r(x)=0.001x2r(x) = 0.001x^2, including all lower powers of xx to balance the derivatives.
  3. Differentiate twice to get yp′=2K2x+K1y_p' = 2K_2 x + K_1 and yp′′=2K2y_p'' = 2K_2, and substitute ypy_p and yp′′y_p'' into the ODE to obtain K2x2+K1x+(2K2+K0)=0.001x2K_2 x^2 + K_1 x + (2K_2 + K_0) = 0.001x^2.
  4. Equate coefficients of like powers of xx on both sides to find K2=0.001K_2 = 0.001, K1=0K_1 = 0, and 2K2+K0=0  ⟹  K0=−0.0022K_2 + K_0 = 0 \implies K_0 = -0.002, which gives yp=0.001x2−0.002y_p = 0.001x^2 - 0.002.
  5. Combine yhy_h and ypy_p to form the complete general solution y=C1cos⁡x+C2sin⁡x+0.001x2−0.002y = C_1 \cos x + C_2 \sin x + 0.001x^2 - 0.002 before touching the initial conditions.
  6. Differentiate the complete solution to get y′=−C1sin⁡x+C2cos⁡x+0.002xy' = -C_1 \sin x + C_2 \cos x + 0.002x, then apply y(0)=0  ⟹  C1−0.002=0  ⟹  C1=0.002y(0) = 0 \implies C_1 - 0.002 = 0 \implies C_1 = 0.002 and y′(0)=1.5  ⟹  C2=1.5y'(0) = 1.5 \implies C_2 = 1.5.

Figure: Table of choice rules for undetermined coefficients

A two-column handwritten table specifying the choice rules for the method of undetermined coefficients. The left column header is 'Term in r(x)' and the right column header is 'Choice for y_p(x).'. Row 1: Left column has 'k e^{\alpha x}', right column has 'C e^{\alpha x}'. Row 2: Left column has 'k x^n (n = 0, 1, 2, ...)', right column has 'K_n x^n + K_{n-1} x^{n-1} + ... + K_1 x + K_0'. Row 3: Left column lists two terms stacked vertically, 'k \cos \omega x' and 'k \sin \omega x', which are grouped together by a right curly brace '}' pointing to the right column entry 'K \cos \omega x + M \sin \omega x .'. Row 4: Left column lists two terms stacked vertically, 'k e^{\alpha x} \cos \omega x' and 'k e^{\alpha x} \sin \omega x', which are grouped together by a right curly brace '}' pointing to the right column entry 'e^{\alpha x} (K \cos \omega x + M \sin \omega x)'.

Answer: y=0.002cos⁡x+1.5sin⁡x+0.001x2−0.002y = 0.002 \cos x + 1.5 \sin x + 0.001x^2 - 0.002

More problems

Problem 2: Exponential forcing at a double characteristic root

Given: y′′+3y′+2.25y=−10e−1.5xy'' + 3y' + 2.25y = -10e^{-1.5x} with y(0)=1y(0) = 1 and y′(0)=0y'(0) = 0. Find: The solution y(x)y(x) to the initial value problem.

  1. Solve the characteristic equation λ2+3λ+2.25=(λ+1.5)2=0\lambda^2 + 3\lambda + 2.25 = (\lambda + 1.5)^2 = 0 to get yh=(c1+c2x)e−1.5xy_h = (c_1 + c_2 x)e^{-1.5x}.
  2. Choose yp=cx2e−1.5xy_p = cx^2 e^{-1.5x} by multiplying by x2x^2 because e−1.5xe^{-1.5x} corresponds to a double root of the characteristic equation.
  3. Compute the derivatives yp′=c(2x−1.5x2)e−1.5xy_p' = c(2x - 1.5x^2)e^{-1.5x} and yp′′=c(2.25x2−6x+2)e−1.5xy_p'' = c(2.25x^2 - 6x + 2)e^{-1.5x} using the product rule.
  4. Substitute yp,yp′,yp′′y_p, y_p', y_p'' into the ODE and cancel e−1.5xe^{-1.5x} to get (2.25c−4.5c+2.25c)x2+(−6c+6c)x+2c=−10(2.25c - 4.5c + 2.25c)x^2 + (-6c + 6c)x + 2c = -10.
  5. Solve 2c=−102c = -10 to find c=−5c = -5, giving the general solution y=(c1+c2x)e−1.5x−5x2e−1.5xy = (c_1 + c_2 x)e^{-1.5x} - 5x^2 e^{-1.5x}.
  6. Differentiate the general solution to get y′=(c2−1.5c1−1.5c2x+7.5x2−10x)e−1.5xy' = (c_2 - 1.5c_1 - 1.5c_2 x + 7.5x^2 - 10x)e^{-1.5x}.
  7. Apply y(0)=1y(0) = 1 and y′(0)=0y'(0) = 0 to find c1=1c_1 = 1 and c2−1.5c1=0  ⟹  c2=1.5c_2 - 1.5c_1 = 0 \implies c_2 = 1.5.

Watch out. Because λ=−1.5\lambda = -1.5 is a double root, multiplying the trial term by a single xx still gives a homogeneous solution cxe−1.5xcxe^{-1.5x}; you must multiply by x2x^2.

Answer: y=(1+1.5x−5x2)e−1.5xy = (1 + 1.5x - 5x^2)e^{-1.5x}

Problem 3: Sum rule with trigonometric and polynomial forcing

Given: y′′+2y′+0.75y=2cos⁡x−0.25sin⁡x+0.09xy'' + 2y' + 0.75y = 2\cos x - 0.25\sin x + 0.09x with y(0)=2.78y(0) = 2.78 and y′(0)=−0.43y'(0) = -0.43. Find: The solution y(x)y(x) to the initial value problem.

  1. Solve the characteristic equation λ2+2λ+0.75=0\lambda^2 + 2\lambda + 0.75 = 0 to get roots λ=−1/2,−3/2\lambda = -1/2, -3/2 and yh=c1e−x/2+c2e−3x/2y_h = c_1 e^{-x/2} + c_2 e^{-3x/2}.
  2. Apply the sum rule to choose the combined trial form yp=Kcos⁡x+Msin⁡x+K1x+K0y_p = K\cos x + M\sin x + K_1 x + K_0.
  3. Compute yp′=−Ksin⁡x+Mcos⁡x+K1y_p' = -K\sin x + M\cos x + K_1 and yp′′=−Kcos⁡x−Msin⁡xy_p'' = -K\cos x - M\sin x, then substitute into the ODE.
  4. Group like terms to get (2M−0.25K)cos⁡x+(−0.25M−2K)sin⁡x+0.75K1x+(2K1+0.75K0)(2M - 0.25K)\cos x + (-0.25M - 2K)\sin x + 0.75K_1 x + (2K_1 + 0.75K_0) on the left.
  5. Equate the cos⁡x\cos x and sin⁡x\sin x coefficients to 22 and −0.25-0.25, solving the system to get K=0K = 0 and M=1M = 1.
  6. Equate the polynomial coefficients to get 0.75K1=0.09  ⟹  K1=0.120.75K_1 = 0.09 \implies K_1 = 0.12 and 2K1+0.75K0=0  ⟹  K0=−0.322K_1 + 0.75K_0 = 0 \implies K_0 = -0.32.
  7. Write the general solution y=c1e−x/2+c2e−3x/2+sin⁡x+0.12x−0.32y = c_1 e^{-x/2} + c_2 e^{-3x/2} + \sin x + 0.12x - 0.32 and differentiate it.
  8. Substitute y(0)=2.78y(0) = 2.78 and y′(0)=−0.43y'(0) = -0.43 to get c1+c2=3.1c_1 + c_2 = 3.1 and −c1−3c2=−3.1-c_1 - 3c_2 = -3.1, giving c1=3.1,c2=0c_1 = 3.1, c_2 = 0.

Answer: y=3.1e−x/2+sin⁡x+0.12x−0.32y = 3.1e^{-x/2} + \sin x + 0.12x - 0.32

Undetermined Coefficients: Comprehensive Case Practice

You have already solved basic nonhomogeneous differential equations and applied initial conditions to the complete solution y=yh+ypy = y_h + y_p. Now you will tackle a wide range of forcing functions that require sinusoidal pairs, sum rules, and modifications when the forcing term overlaps with the homogeneous solution.

The idea

The method of undetermined coefficients works because differentiating polynomials, exponentials, and sines or cosines produces terms from the exact same families. For a sinusoidal forcing term like sin⁡(ωx)\sin(\omega x) or cos⁡(ωx)\cos(\omega x), differentiation switches between sine and cosine, so your trial solution ypy_p must always include both: Kcos⁡(ωx)+Msin⁡(ωx)K \cos(\omega x) + M \sin(\omega x). When the forcing function r(x)r(x) is a sum of different families, the sum rule lets you add their individual trial forms together. When r(x)r(x) is a product, such as eαxcos⁡(ωx)e^{\alpha x} \cos(\omega x), you multiply the corresponding trial forms together.

A critical complication arises when a term in your basic trial choice is already a solution to the homogeneous equation y′′+ay′+by=0y'' + ay' + by = 0. Substituting such a term into the left side produces zero, making it impossible to match the non-zero right side r(x)r(x). This overlap is called resonance.

The modification rule fixes this: whenever the driving function mimics a natural solution mode in yhy_h, multiply the entire trial solution block by xx to preserve linear independence. If the matching root λ\lambda of the characteristic equation is a simple root (or a complex conjugate pair), multiply the trial form by xx. In a critically damped system where λ\lambda is a double root (so both eλxe^{\lambda x} and xeλxx e^{\lambda x} are already in yhy_h), you face double resonance and must boost the trial solution by x2x^2.

Worked example

Problem 2: Exponential forcing with no resonance

Given: y′′−4y′−12y=3e5xy'' - 4y' - 12y = 3e^{5x} Find: The general solution y(x)y(x).

  1. Write the characteristic equation λ2−4λ−12=0\lambda^2 - 4\lambda - 12 = 0 for the homogeneous ODE y′′−4y′−12y=0y'' - 4y' - 12y = 0 to find the natural modes.
  2. Factor as (λ−6)(λ+2)=0(\lambda - 6)(\lambda + 2) = 0 to get roots λ=6,−2\lambda = 6, -2, giving the homogeneous solution yh=c1e6x+c2e−2xy_h = c_1 e^{6x} + c_2 e^{-2x}.
  3. Choose the trial solution yp(x)=ke5xy_p(x) = ke^{5x} because the forcing function r(x)=3e5xr(x) = 3e^{5x} is exponential and e5xe^{5x} does not appear in yhy_h.
  4. Differentiate ypy_p twice to get yp′=5ke5xy_p' = 5ke^{5x} and yp′′=25ke5xy_p'' = 25ke^{5x} so you can substitute them into the ODE.
  5. Substitute yp,yp′,yp′′y_p, y_p', y_p'' into the given ODE to get 25ke5x−4(5ke5x)−12(ke5x)=3e5x25ke^{5x} - 4(5ke^{5x}) - 12(ke^{5x}) = 3e^{5x}.
  6. Combine the left-side terms into (25k−20k−12k)e5x=−7ke5x(25k - 20k - 12k)e^{5x} = -7ke^{5x} and compare the coefficient of e5xe^{5x} with the right side to get −7k=3-7k = 3, so k=−37k = -\frac{3}{7}.
  7. Add yhy_h and yp=−37e5xy_p = -\frac{3}{7}e^{5x} to form the complete general solution.

Answer: y=c1e6x+c2e−2x−37e5xy = c_1 e^{6x} + c_2 e^{-2x} - \frac{3}{7} e^{5x}

More problems

Problem 1: Quadratic polynomial forcing

Given: y′′+4y=x2y'' + 4y = x^2 Find: The general solution y(x)y(x).

  1. Solve the characteristic equation λ2+4=0\lambda^2 + 4 = 0 to get λ=±2i\lambda = \pm 2i, yielding yh=C1cos⁡2x+C2sin⁡2xy_h = C_1 \cos 2x + C_2 \sin 2x.
  2. Choose the full quadratic trial solution yp(x)=k2x2+k1x+k0y_p(x) = k_2 x^2 + k_1 x + k_0 since r(x)=x2r(x) = x^2 is a degree-2 polynomial.
  3. Compute the derivatives yp′=2k2x+k1y_p' = 2k_2 x + k_1 and yp′′=2k2y_p'' = 2k_2.
  4. Substitute into the ODE to get 2k2+4(k2x2+k1x+k0)=x22k_2 + 4(k_2 x^2 + k_1 x + k_0) = x^2.
  5. Group by powers of xx as (4k2)x2+(4k1)x+(2k2+4k0)=x2(4k_2)x^2 + (4k_1)x + (2k_2 + 4k_0) = x^2.
  6. Equate coefficients of x2,xx^2, x, and constants: 4k2=1⇒k2=144k_2 = 1 \Rightarrow k_2 = \frac{1}{4}, 4k1=0⇒k1=04k_1 = 0 \Rightarrow k_1 = 0, and 2k2+4k0=0⇒k0=−182k_2 + 4k_0 = 0 \Rightarrow k_0 = -\frac{1}{8}.
  7. Combine yhy_h and yp(x)=14x2−18y_p(x) = \frac{1}{4}x^2 - \frac{1}{8} to write the general solution.

Answer: y=C1cos⁡2x+C2sin⁡2x+14x2−18y = C_1 \cos 2x + C_2 \sin 2x + \frac{1}{4}x^2 - \frac{1}{8}

Problem 8: Linear polynomial forcing

Given: y′′+3y′+2y=x+1y'' + 3y' + 2y = x + 1 Find: The general solution y(x)y(x).

  1. Solve the homogeneous equation y′′+3y′+2y=0y'' + 3y' + 2y = 0 to write the homogeneous solution yh=c1e−3x+c2e−xy_h = c_1 e^{-3x} + c_2 e^{-x}.
  2. Choose the linear trial solution yp=K1x+K0y_p = K_1 x + K_0 for the degree-1 polynomial forcing term x+1x + 1.
  3. Differentiate to get yp′=K1y_p' = K_1 and yp′′=0y_p'' = 0, and substitute into the ODE: 3K1+2(K1x+K0)=x+13K_1 + 2(K_1 x + K_0) = x + 1.
  4. Compare coefficients of xx and constants (2K1=12K_1 = 1 and 3K1+2K0=13K_1 + 2K_0 = 1) to find K1=12K_1 = \frac{1}{2} and K0=−14K_0 = -\frac{1}{4} (printed as +14+\frac{1}{4}).
  5. Sum yhy_h and yp=x2+14y_p = \frac{x}{2} + \frac{1}{4} to write the general solution.

Watch out. Thecharacteristic roots of λ2+3λ+2=0\lambda^2 + 3\lambda + 2 = 0 are λ=−2,−1\lambda = -2, -1 and the constant term satisfies 3(12)+2K0=1⇒K0=−143(\frac{1}{2}) + 2K_0 = 1 \Rightarrow K_0 = -\frac{1}{4}, which does not match the printed e−3xe^{-3x} and +14+\frac{1}{4}.

Answer: y=c1e−3x+c2e−x+x2+14y = c_1 e^{-3x} + c_2 e^{-x} + \frac{x}{2} + \frac{1}{4}

Problem 7: Combined exponential and constant forcing

Given: y′′+2y=ex+2y'' + 2y = e^x + 2 Find: The general solution y(x)y(x).

  1. Solve λ2+2=0\lambda^2 + 2 = 0 to find λ=±i2\lambda = \pm i\sqrt{2}, giving yh=c1cos⁡2x+c2sin⁡2xy_h = c_1 \cos \sqrt{2}x + c_2 \sin \sqrt{2}x.
  2. Choose yp=Kex+My_p = K e^x + M by the sum rule for r(x)=ex+2r(x) = e^x + 2.
  3. Differentiate twice to get yp′=Kexy_p' = K e^x and yp′′=Kexy_p'' = K e^x.
  4. Substitute into the ODE to obtain Kex+2(Kex+M)=(K+2K)ex+2M=ex+2K e^x + 2(K e^x + M) = (K + 2K)e^x + 2M = e^x + 2.
  5. Compare coefficients to get 3K=1⇒K=133K = 1 \Rightarrow K = \frac{1}{3} and 2M=2⇒M=12M = 2 \Rightarrow M = 1.
  6. Combine yhy_h and yp=ex3+1y_p = \frac{e^x}{3} + 1 for the general solution.

Answer: y=c1cos⁡2x+c2sin⁡2x+ex3+1y = c_1 \cos \sqrt{2}x + c_2 \sin \sqrt{2}x + \frac{e^x}{3} + 1

Problem 3: Sinusoidal forcing with a first-derivative term

Given: y′′+y′−2y=sin⁡xy'' + y' - 2y = \sin x Find: The general solution y(x)y(x).

  1. Factor the characteristic equation λ2+λ−2=(λ+2)(λ−1)=0\lambda^2 + \lambda - 2 = (\lambda + 2)(\lambda - 1) = 0 to get λ=−2,1\lambda = -2, 1 and yh=c1e−2x+c2exy_h = c_1 e^{-2x} + c_2 e^x.
  2. Choose yp=Kcos⁡x+Msin⁡xy_p = K \cos x + M \sin x because y′y' mixes sine and cosine terms.
  3. Differentiate to find yp′=−Ksin⁡x+Mcos⁡xy_p' = -K \sin x + M \cos x and yp′′=−Kcos⁡x−Msin⁡xy_p'' = -K \cos x - M \sin x.
  4. Substitute into the ODE and group: (M−3K)cos⁡x+(−3M−K)sin⁡x=sin⁡x(M - 3K)\cos x + (-3M - K)\sin x = \sin x.
  5. Set coefficients equal to the right side: M−3K=0M - 3K = 0 and −3M−K=1-3M - K = 1.
  6. Substitute M=3KM = 3K into the second equation to get −10K=1⇒K=−110-10K = 1 \Rightarrow K = -\frac{1}{10} and M=−310M = -\frac{3}{10}.
  7. Combine yhy_h and yp=−110cos⁡x−310sin⁡xy_p = -\frac{1}{10} \cos x - \frac{3}{10} \sin x.

Answer: y=c1e−2x+c2ex−110cos⁡x−310sin⁡xy = c_1 e^{-2x} + c_2 e^x - \frac{1}{10} \cos x - \frac{3}{10} \sin x

Problem 4: Simple exponential resonance

Given: y′′−2y′−3y=2e3xy'' - 2y' - 3y = 2e^{3x} Find: The general solution y(x)y(x).

  1. Factor λ2−2λ−3=(λ+1)(λ−3)=0\lambda^2 - 2\lambda - 3 = (\lambda + 1)(\lambda - 3) = 0 to get λ=3,−1\lambda = 3, -1, so yh=c1e3x+c2e−xy_h = c_1 e^{3x} + c_2 e^{-x}.
  2. Multiply the basic trial choice ke3xke^{3x} by xx to get yp=Kxe3xy_p = K x e^{3x} because λ=3\lambda = 3 is a simple root of the characteristic equation.
  3. Apply the product rule to find yp′=K[3xe3x+e3x]y_p' = K[3x e^{3x} + e^{3x}] and yp′′=[9Kx+6K]e3xy_p'' = [9K x + 6K]e^{3x}.
  4. Substitute into the ODE: [9Kx+6K]e3x−2K[3xe3x+e3x]−3Kxe3x=2e3x[9K x + 6K]e^{3x} - 2K[3x e^{3x} + e^{3x}] - 3K x e^{3x} = 2e^{3x}.
  5. Simplify the left side; the xe3xx e^{3x} terms cancel out ((9K−6K−3K)xe3x=0(9K - 6K - 3K)x e^{3x} = 0), leaving 4Ke3x=2e3x4K e^{3x} = 2e^{3x}.
  6. Solve 4K=24K = 2 to get K=12K = \frac{1}{2}, so yp=12xe3xy_p = \frac{1}{2} x e^{3x}.
  7. Add yhy_h and ypy_p to form the final solution.

Watch out. In step 1 the second root is λ=−1\lambda = -1 giving c2e−xc_2 e^{-x}, which does not match the printed C2e−2xC_2 e^{-2x} in the final line.

Answer: y=C1e3x+C2e−2x+x2e3xy = C_1 e^{3x} + C_2 e^{-2x} + \frac{x}{2} e^{3x}

Problem 9: Polynomial forcing with a zero characteristic root

Given: y′′+y′=x2+2x+4y'' + y' = x^2 + 2x + 4 Find: The general solution y(x)y(x).

  1. Solve λ2+λ=λ(λ+1)=0\lambda^2 + \lambda = \lambda(\lambda + 1) = 0 to get roots λ=0,−1\lambda = 0, -1 and yh=c1+c2e−xy_h = c_1 + c_2 e^{-x}.
  2. Multiply the standard quadratic choice by xx to get yp=[Ax2+Bx+C]x=Ax3+Bx2+Cxy_p = [Ax^2 + Bx + C]x = Ax^3 + Bx^2 + Cx because a constant term c1c_1 is already in yhy_h.
  3. Differentiate to find yp′=3Ax2+2Bx+Cy_p' = 3Ax^2 + 2Bx + C and yp′′=6Ax+2By_p'' = 6Ax + 2B.
  4. Substitute into y′′+y′=x2+2x+4y'' + y' = x^2 + 2x + 4 to get 3Ax2+(6A+2B)x+(2B+C)=x2+2x+43Ax^2 + (6A + 2B)x + (2B + C) = x^2 + 2x + 4.
  5. Equate coefficients (3A=13A = 1, 6A+2B=26A + 2B = 2, 2B+C=42B + C = 4) to get A=13A = \frac{1}{3}, B=0B = 0, and C=4C = 4.
  6. Write yp=13x3+4xy_p = \frac{1}{3}x^3 + 4x and add yhy_h to obtain the general solution.

Answer: y=c1+c2e−x+x33+4xy = c_1 + c_2 e^{-x} + \frac{x^3}{3} + 4x

Problem 5: Double exponential resonance in a critically damped system

Given: y′′+4y′+4y=e−2xy'' + 4y' + 4y = e^{-2x} Find: The general solution y(x)y(x).

  1. Solve λ2+4λ+4=(λ+2)2=0\lambda^2 + 4\lambda + 4 = (\lambda + 2)^2 = 0 to find the double root λ=−2,−2\lambda = -2, -2, giving yh=(C1+C2x)e−2xy_h = (C_1 + C_2 x)e^{-2x}.
  2. Choose yp=Kx2e−2xy_p = K x^2 e^{-2x} by multiplying by x2x^2, because −2-2 is a double root so both e−2xe^{-2x} and xe−2xx e^{-2x} are in yhy_h.
  3. Differentiate using the product rule to get yp′=K[−2x2e−2x+2xe−2x]y_p' = K[-2x^2 e^{-2x} + 2x e^{-2x}].
  4. Differentiate again and simplify to get yp′′=[4Kx2−8Kx+2K]e−2xy_p'' = [4K x^2 - 8K x + 2K]e^{-2x}.
  5. Substitute yp,yp′,yp′′y_p, y_p', y_p'' into the ODE: [4Kx2−8Kx+2K]e−2x+4[−2Kx2+2Kx]e−2x+4[Kx2]e−2x=e−2x[4K x^2 - 8K x + 2K]e^{-2x} + 4[-2K x^2 + 2K x]e^{-2x} + 4[K x^2]e^{-2x} = e^{-2x}.
  6. Group terms on the left; both x2e−2xx^2 e^{-2x} and xe−2xx e^{-2x} cancel completely, leaving 2Ke−2x=e−2x2K e^{-2x} = e^{-2x}.
  7. Solve 2K=1⇒K=122K = 1 \Rightarrow K = \frac{1}{2} to get yp=x22e−2xy_p = \frac{x^2}{2}e^{-2x}, and add yhy_h.

Answer: y=(C1+C2x)e−2x+x22e−2xy = (C_1 + C_2 x) e^{-2x} + \frac{x^2}{2} e^{-2x}

Problem 6: Pure oscillatory resonance

Given: y′′+4y=cos⁡2xy'' + 4y = \cos 2x Find: The general solution y(x)y(x).

  1. Solve λ2+4=0\lambda^2 + 4 = 0 to get λ=±2i\lambda = \pm 2i and yh=c1cos⁡2x+c2sin⁡2xy_h = c_1 \cos 2x + c_2 \sin 2x.
  2. Multiply the entire sinusoidal pair by xx to get yp(x)=x[Kcos⁡2x+Msin⁡2x]=Kxcos⁡2x+Mxsin⁡2xy_p(x) = x[K \cos 2x + M \sin 2x] = K x \cos 2x + M x \sin 2x because cos⁡2x\cos 2x is in yhy_h.
  3. Differentiate once: yp′=K[−2xsin⁡2x+cos⁡2x]+M[2xcos⁡2x+sin⁡2x]y_p' = K[-2x \sin 2x + \cos 2x] + M[2x \cos 2x + \sin 2x].
  4. Differentiate a second time and collect terms: yp′′=K[−4xcos⁡2x−4sin⁡2x]+M[−4xsin⁡2x+4cos⁡2x]y_p'' = K[-4x \cos 2x - 4 \sin 2x] + M[-4x \sin 2x + 4 \cos 2x].
  5. Substitute yp′′y_p'' and ypy_p into y′′+4y=cos⁡2xy'' + 4y = \cos 2x; the xcos⁡2xx \cos 2x and xsin⁡2xx \sin 2x terms cancel, leaving −4Ksin⁡2x+4Mcos⁡2x=cos⁡2x-4K \sin 2x + 4M \cos 2x = \cos 2x.
  6. Compare coefficients to get −4K=0⇒K=0-4K = 0 \Rightarrow K = 0 and 4M=1⇒M=144M = 1 \Rightarrow M = \frac{1}{4}.
  7. Combine yhy_h and yp=14xsin⁡2xy_p = \frac{1}{4}x \sin 2x to write the general solution.

Watch out. Never try yp=Kxcos⁡2xy_p = K x \cos 2x alone; the product rule creates a sin⁡2x\sin 2x term in yp′′y_p'' that can only be balanced if Mxsin⁡2xM x \sin 2x is included from the start.

Answer: y=c1cos⁡2x+c2sin⁡2x+x4sin⁡2xy = c_1 \cos 2x + c_2 \sin 2x + \frac{x}{4} \sin 2x

Problem 10: Combined polynomial and trigonometric forcing

Given: y′′−2y′+3y=x2+cos⁡xy'' - 2y' + 3y = x^2 + \cos x Find: The general solution y(x)y(x).

  1. Use the quadratic formula on λ2−2λ+3=0\lambda^2 - 2\lambda + 3 = 0 to find λ=1±i2\lambda = 1 \pm i\sqrt{2}, giving yh=ex[c1cos⁡2x+c2sin⁡2x]y_h = e^x[c_1 \cos \sqrt{2}x + c_2 \sin \sqrt{2}x].
  2. Combine a quadratic polynomial and a sinusoidal pair for the trial solution: yp=K2x2+K1x+K0+Acos⁡x+Bsin⁡xy_p = K_2 x^2 + K_1 x + K_0 + A \cos x + B \sin x.
  3. Compute yp′=2K2x+K1−Asin⁡x+Bcos⁡xy_p' = 2K_2 x + K_1 - A \sin x + B \cos x and yp′′=2K2−Acos⁡x−Bsin⁡xy_p'' = 2K_2 - A \cos x - B \sin x.
  4. Substitute into the ODE and group like terms: (2A−2B)cos⁡x+(2A+2B)sin⁡x+3K2x2+(−4K2+3K1)x+(2K2−2K1+3K0)=x2+cos⁡x(2A - 2B)\cos x + (2A + 2B)\sin x + 3K_2 x^2 + (-4K_2 + 3K_1)x + (2K_2 - 2K_1 + 3K_0) = x^2 + \cos x.
  5. Equate the trigonometric coefficients (2A+2B=12A + 2B = 1 and −2A+2B=0-2A + 2B = 0 as written) to find A=14A = \frac{1}{4} and B=−14B = -\frac{1}{4}.
  6. Equate the polynomial coefficients (3K2=13K_2 = 1, −4K2+3K1=0-4K_2 + 3K_1 = 0, 2K2−2K1+3K0=02K_2 - 2K_1 + 3K_0 = 0) to find K2=13K_2 = \frac{1}{3}, K1=49K_1 = \frac{4}{9}, and K0=227K_0 = \frac{2}{27}.
  7. Sum yhy_h and ypy_p to form the complete general solution.

Watch out. Grouping the cos⁡x\cos x terms from step 4 actually gives 2A−2B=12A - 2B = 1 and sin⁡x\sin x gives 2A+2B=02A + 2B = 0 (which yields A=14,B=−14A = \frac{1}{4}, B = -\frac{1}{4}), whereas solving the written system 2A+2B=12A + 2B = 1 and −2A+2B=0-2A + 2B = 0 would give B=+14B = +\frac{1}{4}.

Answer: y=ex[c1cos⁡2x+c2sin⁡2x]+x23+4x9+227+cos⁡x4−sin⁡x4y = e^x \left[c_1 \cos \sqrt{2}x + c_2 \sin \sqrt{2}x\right] + \frac{x^2}{3} + \frac{4x}{9} + \frac{2}{27} + \frac{\cos x}{4} - \frac{\sin x}{4}

Problem 11: Exponentially damped sinusoidal forcing

Given: y′′−4y′+13y=e2xcos⁡xy'' - 4y' + 13y = e^{2x} \cos x Find: The general solution y(x)y(x).

  1. Solve the auxiliary equation λ2−4λ+13=0\lambda^2 - 4\lambda + 13 = 0 via the quadratic formula to get λ=2±3i\lambda = 2 \pm 3i and yh=e2x(c1cos⁡3x+c2sin⁡3x)y_h = e^{2x}(c_1 \cos 3x + c_2 \sin 3x).
  2. Choose the product trial form yp=e2x[Kcos⁡x+Msin⁡x]y_p = e^{2x}[K \cos x + M \sin x] since 2±i2 \pm i is not a root of the auxiliary equation.
  3. Differentiate using the product rule to get yp′=e2x[(2K+M)cos⁡x+(−K+2M)sin⁡x]y_p' = e^{2x}[(2K + M)\cos x + (-K + 2M)\sin x].
  4. Differentiate again and collect terms: yp′′=e2x[(3K+4M)cos⁡x+(−4K+3M)sin⁡x]y_p'' = e^{2x}[(3K + 4M)\cos x + (-4K + 3M)\sin x].
  5. Substitute yp′′,yp′,ypy_p'', y_p', y_p into the ODE and divide out e2xe^{2x}: [3K+4M−4M−8K+13K]cos⁡x+[−4K+3M+4K−8M+13M]sin⁡x=cos⁡x[3K + 4M - 4M - 8K + 13K]\cos x + [-4K + 3M + 4K - 8M + 13M]\sin x = \cos x.
  6. Simplify to 8Kcos⁡x+8Msin⁡x=cos⁡x8K \cos x + 8M \sin x = \cos x and compare coefficients to find 8K=1⇒K=188K = 1 \Rightarrow K = \frac{1}{8} and 8M=0⇒M=08M = 0 \Rightarrow M = 0.
  7. Combine yhy_h and yp=e2x8cos⁡xy_p = \frac{e^{2x}}{8} \cos x for the general solution.

Answer: y=e2x(c1cos⁡3x+c2sin⁡3x)+e2x8cos⁡xy = e^{2x} (c_1 \cos 3x + c_2 \sin 3x) + \frac{e^{2x}}{8} \cos x

Variation of Parameters Practice

With undetermined coefficients mastered for elementary forms, you can now apply the universal variation of parameters technique to arbitrary driving functions. Evaluating Wronskian-based integrals provides particular solutions even for functions that do not possess finite derivative sets.

The idea

Undetermined coefficients fails when the forcing term r(x)r(x) is a function like sec⁡x\sec x, tan⁡x\tan x, or ln⁡x\ln x, because differentiating these functions produces an endless chain of new algebraic forms. Variation of parameters bypasses guessing altogether. By replacing the constants in the homogeneous solution yh=c1y1(x)+c2y2(x)y_h = c_1 y_1(x) + c_2 y_2(x) with unknown functions, we construct a direct integral formula that works for any continuous driving term.

To execute the method, first find the solution basis y1,y2y_1, y_2 of the corresponding homogeneous equation y′′+p(x)y′+q(x)y=0y'' + p(x)y' + q(x)y = 0. Next, compute the Wronskian WW, which is the determinant W=y1y2′−y2y1′W = y_1 y_2' - y_2 y_1' that measures the linear independence of the basis. Because y1y_1 and y2y_2 are independent, WW is never zero, allowing us to divide by it inside the particular solution formula:

yp(x)=−y1∫y2r(x)W dx+y2∫y1r(x)W dxy_p(x) = -y_1 \int \frac{y_2 r(x)}{W} \, dx + y_2 \int \frac{y_1 r(x)}{W} \, dx

Notice that y1y_1 and y2y_2 sit outside the integrals while their partners sit inside. In practice, exponential factors in y1,y2y_1, y_2, and r(x)r(x) often cancel against the Wronskian, leaving clean integrals that you can evaluate using trigonometric identities or integration by parts.

Worked example

Given: The nonhomogeneous differential equation y′′+y=sec⁡xy'' + y = \sec x. Find: The general solution y=yh+ypy = y_h + y_p.

  1. Solve the homogeneous equation y′′+y=0y'' + y = 0 via its characteristic equation λ2+1=0\lambda^2 + 1 = 0 to get roots λ=±i\lambda = \pm i, which gives the basis y1=cos⁡xy_1 = \cos x, y2=sin⁡xy_2 = \sin x and yh=C1cos⁡x+C2sin⁡xy_h = C_1 \cos x + C_2 \sin x.

  2. Compute the Wronskian determinant to form the denominator of the integral formula:

    W=∣cos⁡xsin⁡x−sin⁡xcos⁡x∣=cos⁡2x+sin⁡2x=1W = \begin{vmatrix} \cos x & \sin x \\ -\sin x & \cos x \end{vmatrix} = \cos^2 x + \sin^2 x = 1
  3. Substitute y1=cos⁡xy_1 = \cos x, y2=sin⁡xy_2 = \sin x, r(x)=sec⁡xr(x) = \sec x, and W=1W = 1 into the variation of parameters formula:

    yp=−cos⁡x∫(sin⁡xsec⁡x) dx+sin⁡x∫(cos⁡xsec⁡x) dxy_p = -\cos x \int (\sin x \sec x) \, dx + \sin x \int (\cos x \sec x) \, dx
  4. Rewrite sec⁡x\sec x as 1/cos⁡x1/\cos x so the integrands simplify to basic trigonometric ratios:

    yp=−cos⁡x∫sin⁡xcos⁡x dx+sin⁡x∫cos⁡xcos⁡x dx=cos⁡xln⁡∣cos⁡x∣+xsin⁡xy_p = -\cos x \int \frac{\sin x}{\cos x} \, dx + \sin x \int \frac{\cos x}{\cos x} \, dx = \cos x \ln|\cos x| + x\sin x
  5. Add yhy_h and ypy_p to form the complete general solution.

Answer: y=C1cos⁡x+C2sin⁡x+cos⁡xln⁡∣cos⁡x∣+xsin⁡x=(C1+ln⁡∣cos⁡x∣)cos⁡x+(C2+x)sin⁡xy = C_1 \cos x + C_2 \sin x + \cos x \ln|\cos x| + x\sin x = (C_1 + \ln|\cos x|)\cos x + (C_2 + x)\sin x.

More problems

Problem 2: Secant forcing with scaled frequency

Given: y′′+9y=sec⁡3xy'' + 9y = \sec 3x. Find: The general solution yy.

  1. Solve λ2+9=0\lambda^2 + 9 = 0 to get λ=±3i\lambda = \pm 3i, giving y1=cos⁡3xy_1 = \cos 3x, y2=sin⁡3xy_2 = \sin 3x, and yh=C1cos⁡3x+C2sin⁡3xy_h = C_1 \cos 3x + C_2 \sin 3x.
  2. Calculate the Wronskian W=(cos⁡3x)(3cos⁡3x)−(sin⁡3x)(−3sin⁡3x)=3(cos⁡23x+sin⁡23x)=3W = (\cos 3x)(3\cos 3x) - (\sin 3x)(-3\sin 3x) = 3(\cos^2 3x + \sin^2 3x) = 3.
  3. Set up the particular solution yp=−cos⁡3x∫sin⁡3xsec⁡3x3 dx+sin⁡3x∫cos⁡3xsec⁡3x3 dxy_p = -\cos 3x \int \frac{\sin 3x \sec 3x}{3} \, dx + \sin 3x \int \frac{\cos 3x \sec 3x}{3} \, dx.
  4. Simplify using sec⁡3x=1/cos⁡3x\sec 3x = 1/\cos 3x to get yp=−cos⁡3x3∫sin⁡3xcos⁡3x dx+sin⁡3x3∫dxy_p = -\frac{\cos 3x}{3} \int \frac{\sin 3x}{\cos 3x} \, dx + \frac{\sin 3x}{3} \int dx.
  5. Integrate both terms (accounting for the inner derivative of 3x3x) to obtain yp=19cos⁡3xln⁡∣cos⁡3x∣+xsin⁡3x3y_p = \frac{1}{9}\cos 3x \ln|\cos 3x| + \frac{x\sin 3x}{3}.
  6. Combine yhy_h and ypy_p to write the general solution.

Watch out. Both the Wronskian (W=3W = 3) and the u-substitution u=cos⁡3xu = \cos 3x (du=−3sin⁡3x dxdu = -3\sin 3x \, dx) introduce a factor of 33 in the denominator, producing 19\frac{1}{9} on the logarithmic term.

Answer: y=C1cos⁡3x+C2sin⁡3x+19cos⁡3xln⁡∣cos⁡3x∣+xsin⁡3x3y = C_1 \cos 3x + C_2 \sin 3x + \frac{1}{9}\cos 3x \ln|\cos 3x| + \frac{x\sin 3x}{3}.

Problem 3: Exponential-tangent forcing term

Given: y′′−2y′+5y=extan⁡2xy'' - 2y' + 5y = e^x \tan 2x. Find: The general solution yy.

  1. Solve λ2−2λ+5=0\lambda^2 - 2\lambda + 5 = 0 to find λ=1±2i\lambda = 1 \pm 2i, giving y1=excos⁡2xy_1 = e^x \cos 2x, y2=exsin⁡2xy_2 = e^x \sin 2x, and yh=ex(c1cos⁡2x+c2sin⁡2x)y_h = e^x(c_1 \cos 2x + c_2 \sin 2x).
  2. Compute W=y1y2′−y2y1′=2e2xcos⁡22x+2e2xsin⁡22x=2e2xW = y_1 y_2' - y_2 y_1' = 2e^{2x}\cos^2 2x + 2e^{2x}\sin^2 2x = 2e^{2x}.
  3. Substitute y1,y2,Wy_1, y_2, W, and r(x)=extan⁡2xr(x) = e^x \tan 2x into the formula and cancel e2xe^{2x}: yp=−excos⁡2x2∫sin⁡2xtan⁡2x dx+exsin⁡2x2∫cos⁡2xtan⁡2x dxy_p = -\frac{e^x \cos 2x}{2} \int \sin 2x \tan 2x \, dx + \frac{e^x \sin 2x}{2} \int \cos 2x \tan 2x \, dx.
  4. Rewrite tan⁡2x=sin⁡2xcos⁡2x\tan 2x = \frac{\sin 2x}{\cos 2x} and use sin⁡22x=1−cos⁡22x\sin^2 2x = 1 - \cos^2 2x on the first integral to get −excos⁡2x2∫(sec⁡2x−cos⁡2x) dx+exsin⁡2x2∫sin⁡2x dx-\frac{e^x \cos 2x}{2} \int (\sec 2x - \cos 2x) \, dx + \frac{e^x \sin 2x}{2} \int \sin 2x \, dx.
  5. Evaluate the integrals: yp=−excos⁡2x2[ln⁡∣sec⁡2x+tan⁡2x∣2−sin⁡2x2]−exsin⁡2xcos⁡2x4y_p = -\frac{e^x \cos 2x}{2} \left[\frac{\ln|\sec 2x + \tan 2x|}{2} - \frac{\sin 2x}{2}\right] - \frac{e^x \sin 2x \cos 2x}{4}.
  6. Cancel the matching ±exsin⁡2xcos⁡2x4\pm \frac{e^x \sin 2x \cos 2x}{4} terms and add yhy_h.

Answer: y=ex(c1cos⁡2x+c2sin⁡2x)−14excos⁡2xln⁡∣sec⁡2x+tan⁡2x∣y = e^x (c_1 \cos 2x + c_2 \sin 2x) - \frac{1}{4} e^x \cos 2x \ln|\sec 2x + \tan 2x|.

Problem 4: Repeated roots with logarithmic forcing

Given: y′′+2y′+y=4e−xlog⁡xy'' + 2y' + y = 4e^{-x} \log x. Find: The general solution yy.

  1. Solve λ2+2λ+1=(λ+1)2=0\lambda^2 + 2\lambda + 1 = (\lambda + 1)^2 = 0 to get λ=−1,−1\lambda = -1, -1, so y1=e−xy_1 = e^{-x}, y2=xe−xy_2 = xe^{-x}, and yh=(c1+c2x)e−xy_h = (c_1 + c_2 x)e^{-x}.
  2. Compute the Wronskian W=e−x(−xe−x+e−x)−xe−x(−e−x)=e−2xW = e^{-x}(-xe^{-x} + e^{-x}) - xe^{-x}(-e^{-x}) = e^{-2x}.
  3. Substitute into the ypy_p formula and cancel e−2xe^{-2x}: yp=−4e−x∫xlog⁡x dx+4xe−x∫log⁡x dxy_p = -4e^{-x} \int x \log x \, dx + 4xe^{-x} \int \log x \, dx.
  4. Integrate by parts using ∫xlog⁡x dx=x22log⁡x−x24\int x \log x \, dx = \frac{x^2}{2}\log x - \frac{x^2}{4} and ∫log⁡x dx=xlog⁡x−x\int \log x \, dx = x\log x - x.
  5. Multiply out the factors to get yp=e−x[−2x2log⁡x+x2]+4xe−x[xlog⁡x−x]y_p = e^{-x}[-2x^2 \log x + x^2] + 4xe^{-x}[x \log x - x] and add yhy_h.

Answer: y=(c1+c2x)e−x+e−x[−2x2log⁡x+x2]+4xe−x[xlog⁡x−x]y = (c_1 + c_2 x)e^{-x} + e^{-x}[-2x^2 \log x + x^2] + 4xe^{-x}[x \log x - x].

Problem 5: Product forcing with trigonometric identities

Given: y′′+y=xsin⁡xy'' + y = x \sin x. Find: The general solution yy.

  1. From λ2+1=0\lambda^2 + 1 = 0, write the basis y1=cos⁡xy_1 = \cos x, y2=sin⁡xy_2 = \sin x, yh=c1cos⁡x+c2sin⁡xy_h = c_1 \cos x + c_2 \sin x, and Wronskian W=cos⁡2x+sin⁡2x=1W = \cos^2 x + \sin^2 x = 1.
  2. Substitute r(x)=xsin⁡xr(x) = x \sin x into the formula: yp=−cos⁡x∫xsin⁡2x dx+sin⁡x∫xcos⁡xsin⁡x dxy_p = -\cos x \int x \sin^2 x \, dx + \sin x \int x \cos x \sin x \, dx.
  3. Apply the double-angle identities sin⁡2x=1−cos⁡2x2\sin^2 x = \frac{1 - \cos 2x}{2} and cos⁡xsin⁡x=sin⁡2x2\cos x \sin x = \frac{\sin 2x}{2} to linearize the trig powers: yp=−cos⁡x2∫(x−xcos⁡2x) dx+sin⁡x2∫xsin⁡2x dxy_p = -\frac{\cos x}{2} \int (x - x \cos 2x) \, dx + \frac{\sin x}{2} \int x \sin 2x \, dx.
  4. Integrate ∫xcos⁡2x dx\int x \cos 2x \, dx and ∫xsin⁡2x dx\int x \sin 2x \, dx by parts: yp=−cos⁡x2[x22−xsin⁡2x2−cos⁡2x4]+sin⁡x2[−xcos⁡2x2+sin⁡2x4]y_p = -\frac{\cos x}{2} \left[\frac{x^2}{2} - \frac{x \sin 2x}{2} - \frac{\cos 2x}{4}\right] + \frac{\sin x}{2} \left[\frac{-x \cos 2x}{2} + \frac{\sin 2x}{4}\right].
  5. Distribute the outer 12\frac{1}{2} factors and add yhy_h to form the complete solution.

Answer: y=c1cos⁡x+c2sin⁡x−cos⁡x[x24−xsin⁡2x4−cos⁡2x8]+sin⁡x[−xcos⁡2x4+sin⁡2x8]y = c_1 \cos x + c_2 \sin x - \cos x \left[\frac{x^2}{4} - \frac{x \sin 2x}{4} - \frac{\cos 2x}{8}\right] + \sin x \left[\frac{-x \cos 2x}{4} + \frac{\sin 2x}{8}\right].