ODEHard

2nd order ODE — harmonic oscillator

Solve the differential equation y″ + 4y = 0 with initial conditions y(0) = 2, y′(0) = 0.
Given data
y″ + 4y = 0y(0) = 2y'(0) = 0
Review the theory: ODE
Steps
0 / 4
  1. Write the associated characteristic equation.
  2. Solve the characteristic equation: λ² = −4.
  3. Apply y(0) = 2 to find C₁.
  4. Calculate y′(x) and apply y′(0) = 0 to find C₂.
Full worked solution
  1. Write the associated characteristic equation.
    λ2+4=0\lambda^2 + 4 = 0
    The characteristic equation is λ2+4=0\lambda^2 + 4 = 0. Obtained by substituting y=eλxy = e^{\lambda x}, which gives λ2eλx+4eλx=0\lambda^2 e^{\lambda x} + 4e^{\lambda x} = 0.
  2. Solve the characteristic equation: λ² = −4.
    λ=±2i\lambda = \pm 2i
    λ2=−4→λ=±2i\lambda^2 = -4 \rightarrow \lambda = \pm 2i. Complex conjugate roots λ=±iω\lambda = \pm i\omega with ω=2\omega = 2 give the general solution y=C1cos⁡(2x)+C2sin⁡(2x)y = C_1\cos(2x) + C_2\sin(2x).
  3. Apply y(0) = 2 to find C₁.
    y(0)=C1⋅cos⁡(0)+C2⋅sin⁡(0)=C1=2y(0) = C_1 \cdot \cos(0) + C_2 \cdot \sin(0) = C_1 = 2
    y(0)=C1cos⁡(0)+C2sin⁡(0)=C1=2y(0) = C_1\cos(0) + C_2\sin(0) = C_1 = 2. Using cos⁡(0)=1\cos(0)=1, sin⁡(0)=0\sin(0)=0, we find C1=2C_1 = \mathbf{2}.
  4. Calculate y′(x) and apply y′(0) = 0 to find C₂.
    y′(0)=−2C1sin⁡(0)+2C2cos⁡(0)=2C2=0y'(0) = -2C_1\sin(0) + 2C_2\cos(0) = 2C_2 = 0
    y′(x)=−2C1sin⁡(2x)+2C2cos⁡(2x)y'(x) = -2C_1\sin(2x) + 2C_2\cos(2x). At x=0x=0: y′(0)=2C2=0→C2=0y'(0) = 2C_2 = 0 \rightarrow C_2 = \mathbf{0}. The solution is y(x)=2cos⁡(2x)\mathbf{y(x) = 2\cos(2x)}.
Result:y(x) = 2·cos(2x).