Nonhomogeneous ODEs: y'' + y' + y = 1 and y'' + y' + y = x

Brain Teaser · Easy · Free problem

Find the general solution of each nonhomogeneous equation.

(a) $y'' + y' + y = 1$

(b) $y'' + y' + y = x$

You may use that the homogeneous equation $y'' + y' + y = 0$ has general solution $y_h = e^{-x/2}\left(c_1\cos\frac{\sqrt3}{2}x + c_2\sin\frac{\sqrt3}{2}x\right)$.

Hints

  1. For a linear equation, general solution $=$ (general solution of the homogeneous equation) $+$ (any one particular solution). You already have the homogeneous part, so only a particular solution is needed.
  2. Method of undetermined coefficients: when the forcing term is a polynomial and $0$ is not a characteristic root, try a polynomial of the same degree. For (a) try a constant $y_p = A$.
  3. For (b) try $y_p = Ax + B$. Substituting gives $A + (Ax + B) = x$; match the coefficients of $x$ and of $1$.

Worked Solution

How to Think About It: Because the operator $L[y] = y'' + y' + y$ is linear, the general solution is $y = y_h + y_p$: the full homogeneous family plus a single particular solution. With polynomial forcing and $0$ not a root of $r^2 + r + 1$, a polynomial of matching degree always works as $y_p$.

Quick Estimate: For large $x$ the homogeneous part $e^{-x/2}(\cdots)$ dies out, so the particular solution is the long-run behavior. For (a) the long-run level must satisfy $y = 1$ (all derivatives zero). For (b), if $y \approx x + b$ then $y' = 1$, $y'' = 0$, and $1 + x + b = x$ forces $b = -1$.

Formal Solution:

Part (a): $y'' + y' + y = 1$

*Step 1 -- Particular solution.* Try $y_p = A$ (constant). Then $y_p'' = y_p' = 0$ and the equation gives $A = 1$. So $y_p = 1$.

*Step 2 -- General solution.* $$y = e^{-x/2}\left(c_1\cos\tfrac{\sqrt3}{2}x + c_2\sin\tfrac{\sqrt3}{2}x\right) + 1.$$

Part (b): $y'' + y' + y = x$

*Step 1 -- Particular solution.* Try $y_p = Ax + B$. Then $y_p' = A$, $y_p'' = 0$, and $$0 + A + (Ax + B) = x \quad \Longrightarrow \quad Ax + (A + B) = x.$$ Matching coefficients: $A = 1$ and $A + B = 0$, so $B = -1$. Thus $y_p = x - 1$.

*Step 2 -- Check.* $y_p'' + y_p' + y_p = 0 + 1 + (x - 1) = x$. $\checkmark$

*Step 3 -- General solution.* $$y = e^{-x/2}\left(c_1\cos\tfrac{\sqrt3}{2}x + c_2\sin\tfrac{\sqrt3}{2}x\right) + x - 1.$$

*Remark.* Why does a polynomial ansatz work? $L$ maps polynomials of degree $n$ to polynomials of degree $n$ (the $y$ term preserves the degree because $0$ is not a characteristic root), so matching coefficients is a solvable triangular system.

Answer: (a) $y = e^{-x/2}\left(c_1\cos\frac{\sqrt3}{2}x + c_2\sin\frac{\sqrt3}{2}x\right) + 1$. (b) $y = e^{-x/2}\left(c_1\cos\frac{\sqrt3}{2}x + c_2\sin\frac{\sqrt3}{2}x\right) + x - 1$.

Intuition

Linear superposition splits every forced linear ODE into a transient (the decaying homogeneous oscillation) plus a steady response shaped like the forcing: constant forcing gives a constant, linear forcing gives a line with a lag. That lag ($y_p = x - 1$ trails the input $x$ by one unit) is the same phenomenon as the phase lag of an exponentially weighted moving average or a filtered signal: a system with memory responds to a ramp with a delayed ramp.

Open the full interactive solver →