A second order linear differential equation with constant coefficients, a·y″ + b·y′ + c·y = f(x), is solved in two parts: the complementary function y_c from the characteristic equation ar² + br + c = 0, and a particular integral y_p that produces f(x). The general solution is y = y_c + y_p, and the two constants are fixed last, from the initial conditions. Below are the three root cases, the trial-function method for y_p, an engineering spring example and a practice set, all with full working.
Why the answer always has this shape
The operator L[y] = ay″ + by′ + cy is linear: L[u + v] = L[u] + L[v]. So if L[y_c] = 0 and L[y_p] = f, then L[y_c + y_p] = f. The homogeneous equation has a two-dimensional family of solutions (two independent functions y₁, y₂), which is why y_c = c₁y₁ + c₂y₂ and why a second order problem needs two conditions, usually y(0) and y′(0).
Trying y = e^(rx) in ay″ + by′ + cy = 0 gives e^(rx)(ar² + br + c) = 0, and since e^(rx) is never zero, r must solve the characteristic equation. If you have worked through first order linear equations, this is the same "general solution, then constants" pattern with one extra constant. For help applying it to your own course, our differential equations tutoring online page explains how sessions with Ajay Vatsyayan work.
The three root cases
| Roots of ar² + br + c = 0 | Discriminant b² − 4ac | Complementary function y_c |
|---|---|---|
| Two real roots r₁ ≠ r₂ | positive | c₁e^(r₁x) + c₂e^(r₂x) |
| One repeated root r | zero | (c₁ + c₂x)e^(rx) |
| Complex pair α ± βi | negative | e^(αx)(c₁cos βx + c₂sin βx) |
Example 1: distinct real roots
Solve y″ − y′ − 6y = 0 with y(0) = 1, y′(0) = 8.
Characteristic equation: r² − r − 6 = 0, so (r − 3)(r + 2) = 0 and r = 3 or r = −2.
y = Ae^(3x) + Be^(−2x), so y′ = 3Ae^(3x) − 2Be^(−2x).
At x = 0: A + B = 1 and 3A − 2B = 8. Adding twice the first to the second: 5A = 10, so A = 2 and B = −1.
Answer: y = 2e^(3x) − e^(−2x).
Example 2: a repeated root
Solve y″ + 6y′ + 9y = 0 with y(0) = 2, y′(0) = −1.
r² + 6r + 9 = (r + 3)² = 0, so r = −3 twice. The second solution is x·e^(−3x).
y = (A + Bx)e^(−3x), and by the product rule y′ = Be^(−3x) − 3(A + Bx)e^(−3x).
At x = 0: A = 2 and B − 3A = −1, so B = 5.
Answer: y = (2 + 5x)e^(−3x).
Example 3: complex roots
Solve y″ + 2y′ + 10y = 0 with y(0) = 3, y′(0) = 0.
r = (−2 ± √(4 − 40))/2 = (−2 ± 6i)/2 = −1 ± 3i. So α = −1, β = 3.
y = e^(−x)(A cos 3x + B sin 3x).
y′ = −e^(−x)(A cos 3x + B sin 3x) + e^(−x)(−3A sin 3x + 3B cos 3x).
At x = 0: A = 3, and −A + 3B = 0, so B = 1.
Answer: y = e^(−x)(3 cos 3x + sin 3x).
The real part α controls growth or decay and β sets the angular frequency. Writing complex exponentials such as e^((−1+3i)x) in a final answer usually costs a mark when a real solution is expected.
Finding y_p by undetermined coefficients
Guess a y_p of the same family as f(x), with unknown coefficients, substitute, and match terms.
| Forcing f(x) | Trial y_p |
|---|---|
| polynomial of degree n | full polynomial of degree n: A₀ + A₁x + … + Aₙxⁿ |
| k·e^(mx) | A·e^(mx) |
| k·cos ωx or k·sin ωx | A cos ωx + B sin ωx (always both) |
| e^(mx)·cos ωx | e^(mx)(A cos ωx + B sin ωx) |
| sum of the above | sum of the trials |
Modification rule: if any term of the trial already appears in y_c, multiply that part of the trial by x (by x² if the root is repeated).
Example 4: polynomial plus exponential
Find the general solution of y″ − y′ − 6y = 12x + 2 + 12e^x.
From Example 1, y_c = c₁e^(3x) + c₂e^(−2x). Neither e^x nor a polynomial appears in y_c.
Trial: y_p = ax + b + de^x. Then y_p′ = a + de^x and y_p″ = de^x.
Substitute:
de^x − (a + de^x) − 6(ax + b + de^x) = −6ax + (−a − 6b) − 6de^x
Match: −6a = 12 gives a = −2. Then −a − 6b = 2 gives 2 − 6b = 2, so b = 0. Finally −6d = 12 gives d = −2.
Answer: y = c₁e^(3x) + c₂e^(−2x) − 2x − 2e^x.
Note that the constant term mattered: dropping b from the trial would have left the equation 2 = 2 by luck here, but in general the trial must be the full polynomial.
Example 5: when the trial clashes with y_c
Find the general solution of y″ − y′ − 6y = 10e^(3x).
The natural trial Ae^(3x) is already in y_c, so substituting it gives 0 = 10e^(3x), which is impossible. Apply the modification rule: y_p = Axe^(3x).
y_p′ = Ae^(3x)(1 + 3x), y_p″ = Ae^(3x)(6 + 9x).
Substitute: Ae^(3x)[(6 + 9x) − (1 + 3x) − 6x] = 5Ae^(3x) = 10e^(3x), so A = 2.
Answer: y = c₁e^(3x) + c₂e^(−2x) + 2xe^(3x).
Engineering example: a damped spring driven by a force
A 1 kg mass hangs on a spring of stiffness 5 N/m, with a damper of 2 N·s/m. From rest at equilibrium it is driven by a force 10 cos t newtons. Newton's second law gives
x″ + 2x′ + 5x = 10 cos t, with x(0) = 0 and x′(0) = 0.
Step 1, free motion. r² + 2r + 5 = 0 gives r = −1 ± 2i, so x_c = e^(−t)(A cos 2t + B sin 2t). The discriminant 4 − 20 is negative: the system is underdamped.
Step 2, forced motion. cos t is not in x_c, so try x_p = a cos t + b sin t:
x_p″ + 2x_p′ + 5x_p = (4a + 2b) cos t + (4b − 2a) sin t
Match: 4a + 2b = 10 and 4b − 2a = 0. The second gives a = 2b, then 10b = 10, so b = 1 and a = 2.
Step 3, initial conditions on the full solution. x = e^(−t)(A cos 2t + B sin 2t) + 2 cos t + sin t.
x(0) = A + 2 = 0, so A = −2.
x′(0) = −A + 2B + 1 = 0, so 2 + 2B + 1 = 0 and B = −3/2.
Answer: x(t) = −e^(−t)(2 cos 2t + 1.5 sin 2t) + 2 cos t + sin t.
The e^(−t) part (the transient) dies away, leaving the steady state 2 cos t + sin t, an oscillation of amplitude √(2² + 1²) = √5 ≈ 2.24 m at the driving frequency. Exam questions often ask for exactly this split.
The same equation describes a series RLC circuit, so one method covers both:
| Spring–mass–damper | Series RLC circuit |
|---|---|
| m x″ + c x′ + k x = F(t) | L q″ + R q′ + q/C = E(t) |
| mass m | inductance L |
| damping c | resistance R |
| stiffness k | 1/C (C = capacitance) |
| underdamped when c² is less than 4mk | underdamped when R² is less than 4L/C |
Mistakes that cost marks
- Fixing constants before adding y_p. Initial conditions apply to y_c + y_p, never to y_c alone. In the spring example, using x_c only would give A = 0, B = 0 and a wrong transient.
- Trial that duplicates y_c. Always write y_c first, then compare. If the trial term is already there, multiply by x (Example 5).
- Only cos in the trial. For 10 cos t you need a cos t + b sin t, because the damping term turns cosines into sines.
- Forgetting the x in the repeated-root case. c₁e^(rx) + c₂e^(rx) is really one function, so it cannot fit two conditions.
- Product rule slips in y′(0). In Examples 2 and 3 the derivative has two parts. Write y′ in full before substituting x = 0.
- Using undetermined coefficients where it fails. It only works for polynomials, exponentials, sines, cosines and their products. For f(x) = tan x or 1/x, the method you need is variation of parameters.
Practice problems
- Solve y″ − 5y′ + 4y = 0 with y(0) = 2, y′(0) = 5.
- Solve y″ − 8y′ + 16y = 0 with y(0) = 1, y′(0) = 6.
- Find the general solution of y″ + 9y = 18x.
- Find the general solution of y″ + 4y = 8 sin 2x (watch for resonance).
- A series circuit has L = 1 H, R = 6 Ω, C = 1/25 F and a constant 50 V supply. With q(0) = 0 and q′(0) = 0, solve q″ + 6q′ + 25q = 50 for the charge.
Answers
- y = e^x + e^(4x).
- y = (1 + 2x)e^(4x).
- y = c₁cos 3x + c₂sin 3x + 2x.
- sin 2x is in y_c, so try x(a cos 2x + b sin 2x): y = c₁cos 2x + c₂sin 2x − 2x cos 2x. The −2x cos 2x term grows without bound: this is resonance.
- q = 2 − e^(−3t)(2 cos 4t + 1.5 sin 4t); the charge settles at 2 coulombs and the current is q′ = 12.5e^(−3t) sin 4t.
Where it goes next
The characteristic equation is the same calculation as finding eigenvalues of a matrix, and that link becomes explicit when a second order equation is rewritten as a system of two first order equations. With a periodic but non-sinusoidal force (a square wave, say), you expand the force using Fourier series and apply the trial method term by term. Many engineering courses then solve the same initial value problems with the Laplace transform, which handles switched and impulsive forces neatly; see our Laplace transform exam guide.
How Maths Bodhi helps
Sessions use your own syllabus, problem sets and past papers, and we review your working step by step so the root case and trial choice become routine. B.Tech students can see how this fits engineering mathematics M1, M2 and M3, and students moving from JEE to first-year courses can see our IIT first-year maths support. We explain and practise; we don't do graded work for you.
Home tuition is available in Gurgaon (Gurugram). Students elsewhere in India and abroad learn with us online. You can book a free demo class.
Written and checked by the Maths Bodhi team (November 2026).
Frequently asked questions
- How do you solve a second order differential equation with constant coefficients?
- Solve the characteristic equation for y_c, find a particular integral y_p for the right-hand side, add them, then use the initial conditions.
- What do you do when the characteristic equation has complex roots?
- For roots α ± βi, write y_c = e^(αx)(c₁cos βx + c₂sin βx).
- What if the characteristic equation has a repeated root?
- Use (c₁ + c₂x)e^(rx), since e^(rx) alone gives only one independent solution.
- When does the method of undetermined coefficients not work?
- When the forcing is not a polynomial, exponential, sine, cosine or a product of these, such as tan x or 1/x; use variation of parameters instead.
- What is resonance in a second order differential equation?
- It happens when the forcing frequency matches a natural frequency in y_c, so the trial needs an extra factor x and the response grows.
- How are second order differential equations used in engineering?
- They model vibrating springs, beams and suspension systems and the charge in RLC circuits.
