Find the general solution of y'' + 2(λ-1)y' + (λ^2+λ-1)y =…
Find the general solution of $y'' + 2(\lambda-1)y' + (\lambda^2+\lambda-1)y = (3\lambda-2)\cos(\lambda x)$, and classify by the parameter $\lambda$.
Explanation of Method
A parameter-dependent forced linear equation, classified by the discriminant of its characteristic equation, with a single non-resonant particular-solution formula valid everywhere except the one genuine resonance at $\lambda=1$.
Step 1: The homogeneous equation and its characteristic roots
The characteristic equation of the homogeneous part is
\[ r^2 + 2(\lambda-1)r + (\lambda^2+\lambda-1) = 0. \]
Its discriminant is
\[ \Delta = 4(\lambda-1)^2 - 4(\lambda^2+\lambda-1) = 4\bigl[(\lambda^2-2\lambda+1)-(\lambda^2+\lambda-1)\bigr] = 4(2-3\lambda). \]
and the roots are
\[ r = (1-\lambda) \pm \sqrt{2-3\lambda}. \]
The sign of $2-3\lambda$ — equivalently, the position of $\lambda$ relative to $2/3$ — governs whether these roots are real or complex, so the classification below is organized around that threshold.
Step 2: The particular solution for $\lambda \ne 1$
Try $y_p = A\cos(\lambda x) + B\sin(\lambda x)$. Then $y_p'=-A\lambda\sin(\lambda x)+B\lambda\cos(\lambda x)$ and $y_p''=-\lambda^2y_p$. Substituting into the left side and collecting coefficients of $\cos(\lambda x)$ and $\sin(\lambda x)$ yields the linear system
\[ A(\lambda-1) + 2B\lambda(\lambda-1) = 3\lambda-2, \qquad B(\lambda-1) - 2A\lambda(\lambda-1) = 0. \]
For $\lambda\ne1$, the second equation divides through by $(\lambda-1)$ to give $B=2A\lambda$. Substituting into the first equation: \[A(\lambda-1) + 2(2A\lambda)\lambda(\lambda-1) = 3\lambda-2 \;\Longrightarrow\; A(\lambda-1)(1+4\lambda^2) = 3\lambda-2.\]
Hence, for every $\lambda\ne1$: \[A = \frac{3\lambda-2}{(\lambda-1)(1+4\lambda^2)}, \qquad B = \frac{2\lambda(3\lambda-2)}{(\lambda-1)(1+4\lambda^2)}.\]
This single formula for $y_p=A\cos(\lambda x)+B\sin(\lambda x)$ is valid uniformly across every $\lambda\ne1$ — it requires no modification anywhere else in its domain, including at $\lambda=2$ and $\lambda=2/3$, since the denominator $(\lambda-1)(1+4\lambda^2)$ never vanishes except at $\lambda=1$ (the factor $1+4\lambda^2$ is always positive).
Step 3: Case classification by the discriminant
Case A — $\lambda < 2/3$ (real distinct roots).
Here $\Delta>0$, and since $\lambda<2/3<1$ the non-resonant formula for $y_p$ automatically applies. With $\mu=\sqrt{2-3\lambda}>0$: \[y_h = e^{(1-\lambda)x}\Bigl[C_1e^{\mu x} + C_2e^{-\mu x}\Bigr], \qquad y = y_h + A\cos(\lambda x) + B\sin(\lambda x),\]
with $A,B$ as in Step 2.
Case B — $\lambda = 2/3$ (double root).
Here $\Delta=0$ and the repeated root is $r=1-\lambda=1/3$, giving
\[ y_h = e^{x/3}(C_1+C_2x). \]
At this value, $3\lambda-2=0$, so the right-hand side of the original equation vanishes identically and $y_p=0$. This is consistent with the general $A,B$ formula: the numerator $3\lambda-2$ vanishes while the denominator $(\lambda-1)(1+4\lambda^2)$ at $\lambda=2/3$ equals $(-\tfrac13)(\tfrac{25}{9})=-\tfrac{25}{27}\ne0$, so $A=B=0$ exactly. Hence
\[ y = e^{x/3}(C_1+C_2x). \]
Case C — $2/3 < \lambda$, $\lambda \ne 1$ (complex roots, non-resonant).
Here $\Delta<0$ and the roots are $r=(1-\lambda)\pm i\sqrt{3\lambda-2}$, giving
\[ y_h = e^{(1-\lambda)x}\Bigl[C_1\cos\bigl(\sqrt{3\lambda-2}\,x\bigr) + C_2\sin\bigl(\sqrt{3\lambda-2}\,x\bigr)\Bigr]. \]
Since $\lambda\ne1$ throughout this range, the same non-resonant formula for $y_p$ from Step 2 applies without modification: $y = y_h + A\cos(\lambda x) + B\sin(\lambda x)$.
This single description covers the entire range $\lambda>2/3$, $\lambda\ne1$ — including, for instance, $\lambda=2$, where the roots are $r=-1\pm2i$ (real part $1-\lambda=-1\ne0$) and the forcing frequency $\lambda=2$ does not coincide with the free oscillation frequency $\sqrt{3\lambda-2}=\sqrt4=2$ in the way that matters: since $1-\lambda\ne0$, the homogeneous solutions $e^{-x}\cos2x,\,e^{-x}\sin2x$ decay and are not proportional to the undamped forcing term $\cos2x$. No resonance occurs, and no special ansatz is needed anywhere in Case C.
Case D — $\lambda = 1$ (genuine resonance).
At $\lambda=1$, both the real part $1-\lambda$ and the check $\sqrt{3\lambda-2}=\sqrt1=1=\lambda$ hold simultaneously: the roots reduce to $r=0\pm i\cdot1=\pm i$, exactly matching the undamped forcing frequency $\lambda=1$ in $\cos(\lambda x)=\cos x$. This is the only value of $\lambda$ where both conditions for true resonance — a purely imaginary root and a matching oscillation frequency — hold together. The equation itself reduces to
\[ y'' + y = \cos x. \]
The standard resonant ansatz $y_p = \dfrac{x}{2}\sin x$ applies: differentiating twice, \[y_p' = \frac12\sin x + \frac{x}{2}\cos x, \qquad y_p'' = \cos x - \frac{x}{2}\sin x,\]
so that $y_p''+y_p = \left(\cos x - \tfrac{x}{2}\sin x\right) + \tfrac{x}{2}\sin x = \cos x$, confirmed exactly. So
\[ y = C_1\cos x + C_2\sin x + \frac{x}{2}\sin x. \]
Step 4: Summary
For $\lambda=1$, the equation reduces to $y''+y=\cos x$ and
\[ y = C_1\cos x + C_2\sin x + \frac{x}{2}\sin x. \]
For $\lambda\ne1$,
\[ y = e^{(1-\lambda)x}\bigl[C_1e^{\mu x}+C_2e^{-\mu x}\text{ or }C_1\cos\omega x+C_2\sin\omega x\bigr] + \frac{3\lambda-2}{(\lambda-1)(1+4\lambda^2)}\bigl[\cos\lambda x+2\lambda\sin\lambda x\bigr], \]
with $\mu=\sqrt{2-3\lambda}$ used when $\lambda\lt 2/3$, $\omega=\sqrt{3\lambda-2}$ used when $\lambda\gt 2/3$ (with $y_p=0$ at the boundary $\lambda=2/3$).
Step 5: Verification
For the resonant case $\lambda=1$: as computed in Step 3, $y_p=\tfrac{x}{2}\sin x$ has $y_p''=\cos x-\tfrac{x}{2}\sin x$, so $y_p''+y_p=\cos x$ identically. $\checkmark$
For the general non-resonant formula: substituting $y_p=A\cos\lambda x+B\sin\lambda x$ with the boxed $A,B$ back into $y_p''+2(\lambda-1)y_p'+(\lambda^2+\lambda-1)y_p$ reproduces $(3\lambda-2)\cos\lambda x$ identically as a rational identity in $\lambda$, confirmed symbolically for the whole family $\lambda\ne1$ — including explicitly at $\lambda=2$, where $A=\dfrac{4}{1\cdot17}=\dfrac{4}{17}$, $B=\dfrac{16}{17}$, and direct substitution gives residual $0$.
Result
Final answer:
\[\boxed{\,y'' + y = \cos x \ \ (\lambda=1):\quad y = C_1\cos x + C_2\sin x + \tfrac{x}{2}\sin x;\\[6pt] \lambda\ne1:\quad y = e^{(1-\lambda)x}\bigl[C_1e^{\mu x}+C_2e^{-\mu x}\text{ or }C_1\cos\omega x+C_2\sin\omega x\bigr] + \dfrac{3\lambda-2}{(\lambda-1)(1+4\lambda^2)}\bigl[\cos\lambda x+2\lambda\sin\lambda x\bigr]\,}\]
Remark
On the case boundaries. The discriminant threshold $\lambda=2/3$ and the resonance threshold $\lambda=1$ are logically independent conditions: the first concerns whether the homogeneous roots are real or complex, the second concerns whether those roots collide with the forcing frequency. It is only at $\lambda=1$ that the real part of the roots vanishes and the imaginary part matches $\lambda$ simultaneously — a coincidence that does not recur elsewhere on the curve $2/3<\lambda$, including at $\lambda=2$, where the roots $-1\pm2i$ have matching imaginary part but nonzero (damping) real part, so the non-resonant particular-solution formula continues to apply there unmodified.