Skip to content

Nonhomogeneous Equations - Undetermined Coefficients

You will learn how to solve nonhomogeneous second-order linear differential equations by finding the general solution to the homogeneous equation and a particular solution using the method of undetermined coefficients.

A nonhomogeneous second-order linear equation looks like:

ay+by+cy=g(x)ay'' + by' + cy = g(x)

The general solution is:

y=yh+ypy = y_h + y_p

where yhy_h is the solution to the homogeneous equation (which we already know how to find), and ypy_p is a particular solution to the full nonhomogeneous equation.

The method of undetermined coefficients works when g(x)g(x) is a polynomial, exponential, sine, cosine, or a product of these. We guess the form of ypy_p based on g(x)g(x), multiply by xx if necessary (when it overlaps with yhy_h), and solve for the unknown coefficients.

The visual shows how the particular solution (blue, steady-state) and the homogeneous solution (red, transient decay) combine to form the full solution (green). The transient dies out, leaving only the forced response.

Example 1: Polynomial Right-Hand Side

Solve y+3y+2y=6xy'' + 3y' + 2y = 6x.

Solution: Homogeneous solution: yh=C1ex+C2e2xy_h = C_1 e^{-x} + C_2 e^{-2x}

Guess for ypy_p: yp=Ax+By_p = Ax + B

Plug in, solve: A=3A = 3, B=92B = -\frac{9}{2}

Full solution: y=C1ex+C2e2x+3x92y = C_1 e^{-x} + C_2 e^{-2x} + 3x - \frac{9}{2}

Example 2: Exponential Right-Hand Side

Solve y4y+4y=8e2xy'' - 4y' + 4y = 8e^{2x}.

Solution: Homogeneous solution has repeated root r=2r = 2, so yh=(C1+C2x)e2xy_h = (C_1 + C_2 x)e^{2x}

Guess: yp=Ax2e2xy_p = Ax^2 e^{2x} (multiplied by x2x^2 due to overlap)

Solving gives A=4A = 4.

Full solution: y=(C1+C2x+4x2)e2xy = (C_1 + C_2 x + 4x^2) e^{2x}

Example 3: Trigonometric Right-Hand Side

Solve y+y=4cos3xy'' + y = 4\cos 3x with y(0)=0y(0) = 0, y(0)=1y'(0) = 1.

Solution: Homogeneous: yh=C1cosx+C2sinxy_h = C_1 \cos x + C_2 \sin x

Guess: yp=Acos3x+Bsin3xy_p = A\cos 3x + B\sin 3x

Substituting: 9Acos3x9Bsin3x+Acos3x+Bsin3x=4cos3x-9A\cos 3x - 9B\sin 3x + A\cos 3x + B\sin 3x = 4\cos 3x

So 8A=4    A=12-8A = 4 \implies A = -\frac{1}{2}, B=0B = 0.

yp=12cos3xy_p = -\frac{1}{2}\cos 3x

Apply ICs: C1=12C_1 = \frac{1}{2}, C2=1C_2 = 1

Final: y=12cosx+sinx12cos3xy = \frac{1}{2}\cos x + \sin x - \frac{1}{2}\cos 3x

Undetermined coefficients is heavily used in electrical engineering to find the steady-state response of circuits to sinusoidal inputs (AC voltage), in mechanical engineering to analyze forced vibrations (e.g., a car driving over a bumpy road), and in control systems to predict how systems respond to external forces or signals. It helps engineers design systems that don’t shake apart or overheat under normal operating conditions.

The general solution to a nonhomogeneous equation is:
When guessing $y_p$ for a polynomial $g(x)$, we use:
We multiply our guess by $x$ (or $x^2$) when:
The method of undetermined coefficients works when $g(x)$ is:
In the solution $y = y_h + y_p$, the $y_h$ part typically: