Home » Blog » Determine the general solution of y′′ + y = cos x

Determine the general solution of y′′ + y = cos x

Determine the general solution of the second-order differential equation

    \[ y'' + y = \cos x. \]


The homogeneous equation related to this is an equation of the form y'' + ay' + by = 0 with a = 0 and b = 1. This gives us d = a^2 - 4b = -4 and k = \frac{1}{2} \sqrt{-d} = 1. So, the general solution of the homogeneous equation y'' + y = 0 is given by

    \[ y = c_1 \cos x + c_2 \sin x. \]

Then by a previous exercise (Section 8.17, Exercise #19) we know that a particular solution y_1 for the non-homogeneous equation is given by

    \begin{align*}  y_1 &= \frac{1}{k} \int_0^x R(t) \sin (k(x-t)) \, dt\\  &= \int_0^x (\cos t)(\sin (x-t)) \, dt \\  &= \int_0^x (\cos t)(\sin x \cos t - \sin t \cos x) \, dt \\  &= \sin x \int_0^x \cos^2 t \, dt - \cos x \int_0^x \cos t \sin t \, dt\\  &= \sin x \left( \frac{1}{2} (x + \sin x \cos x) \right) - \cos x \left( -\frac{1}{2} \cos^2 x + \frac{1}{2} \right) \\  &= \frac{1}{2} x \sin x + \frac{1}{2}\sin^2 x \cos x + \frac{1}{2} \cos^3 x - \frac{1}{2} \cos x \\  &= \frac{1}{2} x \sin x + \frac{\cos x}{2} \left( \sin^2 x + \cos^2 x - 1 \right) \\  &= \frac{1}{2} x \sin x. \end{align*}

Therefore, the general solution of the given equation is

    \begin{align*}  y &= c_1 \cos x + c_2 \sin x + \frac{1}{2} x \sin x \\  &= c_1 \cos x + \left( c_2 + \frac{x}{2} \right) \sin x. \end{align*}

Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):