---
title: "Solve y''−y=x² cos x"
subject: "Mathematics I"
chapter: 4
key: "semester_1/mathematics_i:de-d2-y-x2-cosx"
source: https://www.bctengineer.com/q/semester_1/mathematics_i/de-d2-y-x2-cosx
site: BCT Engineering
---

# Solve y''−y=x² cos x

Mathematics I · Chapter 4: Ordinary Differential Equations and their Applications

- Asked in: 2069 Asar
- Video: [Solve: (D⁴+2D²+1)y= x²cosx](https://www.youtube.com/watch?v=CHd-9J5yxqc) — RK Eduworld (Classic)
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/mathematics_i/de-d2-y-x2-cosx
- Whole chapter: https://www.bctengineer.com/md/semester_1/mathematics_i/chapter-4

## Question

Solve: d²y/dx² − y = x² cos x.

## Short answer

The complementary function is c₁eˣ + c₂e^(-x). The particular integral is ½(1 - x²) cos x + x sin x, giving y = c₁eˣ + c₂e^(-x) + ½(1 - x²) cos x + x sin x.

## Answer

The equation is (D² − 1)y = x² cos x.

#### Complementary function
m² − 1 = 0, so m = ±1.

CF = c₁eˣ + c₂e^(−x)

#### Particular integral
Write x² cos x as the real part of x²e^(ix):

PI = Re [ 1/(D² − 1) · x²e^(ix) ] = Re [ e^(ix) · 1/((D + i)² − 1) · x² ]

(D + i)² − 1 = D² + 2iD − 2 = −2[1 − iD − D²/2], so

PI = Re [ e^(ix) · (−1/2)(1 − iD − D²/2)⁻¹ x² ]

Expand (1 − u)⁻¹ = 1 + u + u² with u = iD + D²/2:

(1 + iD + D²/2 + (iD)² + …) = 1 + iD + (1/2 − 1)D² = 1 + iD − D²/2

Apply to x²: x² + 2ix − 1.

PI = Re [ −(1/2) e^(ix)(x² − 1 + 2ix) ]
 = −(1/2) [(x² − 1) cos x − 2x sin x]
 = ½(1 − x²) cos x + x sin x

#### General solution
**y = c₁eˣ + c₂e^(−x) + ½(1 − x²) cos x + x sin x**

(Check: with y_p = ½(1 − x²) cos x + x sin x, differentiating twice gives y_p'' − y_p = x² cos x.)

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. m^2 - 1 = 0 gives CF:
   A. c1 e^(x) only
   B. (c1 + c2 x)e^x
   C. c1 e^x + c2 e^(-x)
   D. c1 cos x + c2 sin x
   Answer: C. m = ±1. (Key point: Complementary function)

2. x^2 cos x is treated as:
   A. The real part of x^2 e^(ix)
   B. A polynomial
   C. The imaginary part of x^2 e^x
   D. x^2 times e^x
   Answer: A. Then the shift D -> D + i applies. (Key point: Method)

3. (D + i)^2 - 1 equals:
   A. D^2 + 2iD
   B. D^2 - 2iD - 2
   C. D^2 + 2iD - 2
   D. D^2 + 2D
   Answer: C. (D+i)^2 = D^2 + 2iD - 1. (Key point: Shifted operator)

4. The PI is:
   A. x^2 cos x
   B. (1/2)(x^2 - 1)cos x + x sin x
   C. (1/2)(1 - x^2)cos x + x sin x
   D. (1/2)(1 - x^2)cos x - x sin x
   Answer: C. Taking the real part of -(1/2)e^(ix)(x^2 - 1 + 2ix). (Key point: Final PI)

## Related in Mathematics I

- [Solve sin x dy/dx + y cos x = x sin x](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Ade-sinx-dy-dx-y-cosx) — Mathematics I, chapter 4
- [Gamma function: ∫ sin⁶(x/2) cos⁶(x/2) dx](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Agamma-sin6-cos6-half-x) — Mathematics I, chapter 2, asked 3×
- [DUIS: ∫ dx/(a²sin²x+b²cos²x)²](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Aduis-dx-over-a2sin2-b2cos2-squared) — Mathematics I, chapter 2, asked 2×
- [Beta-Gamma: ∫ sin⁴x cos²x dx = (3π−4)/192](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Abeta-gamma-sin4-cos2-pi4) — Mathematics I, chapter 2, asked 2×
- [Show ∫ x sin x/(1+cos²x) dx = π²/4](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Aintegral-x-sinx-over-1-cos2) — Mathematics I, chapter 2
- [Show ∫ x/(sin x+cos x) dx](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Aintegral-x-over-sin-plus-cos) — Mathematics I, chapter 2

## Related in other subjects

- [Solve an integral equation](https://www.bctengineer.com/question.md?key=semester_3%2Fmathematics_iii%3Asolve-an-integral-equation) — Mathematics III, chapter 4
- [RK-4: dy/dx = (1+x²)y](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark4-y-1-x2) — Numerical Method, chapter 6
- [Gauss 3-point: sin x³ + cos x²](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Agauss-3pt-sin-x3-cos-x2) — Numerical Method, chapter 5, asked 2×
- [Change order of integration: cos y/√((a−x)(a−y))](https://www.bctengineer.com/question.md?key=semester_2%2Fmathematics%3Achange-order-integration-cos-y) — Mathematics, chapter 2
