Inhomogeneous 2nd order differential equation - beats

I have to determine the inhomogeneous and homogeneous equations of the equation below $$my''+ky=\cos(\omega_2 t)$$ I found the inhomogeneous below where $\omega_1=\sqrt\frac{k}{m}$ (unsure if it's correct) $$c_2 \sin(\omega_1t) + c_1\cos(\omega_1t)$$ but I'm having difficulty finding the homogeneous equation. This is my working out $$y_p(t)=a\cos(\omega_2t)+b\sin(\omega_2t)$$ $$y_p'(t)=\omega_2(-a\sin(\omega_2t)+b\cos(\omega_2t))$$ $$y_p''(t)=-\omega_2^2(a\cos(\omega_2t)+b\sin(\omega_2t))$$ I substituted $y''$ and $y$ into the original equation, rearranged to put the equation in terms of cos and sine and then solved for a and b ending up with values $$a=\frac{-1}{m\omega_2^2+k}, b=0$$ I'm pretty sure this is incorrect as I need to end up with a $\omega_1$ term and the next question asks to find initial conditions so that the inhomogeneous equation can be written in the form $$y(t)=\cos(\omega_1t)+\cos(\omega_2t)$$

• Is $\omega_2$ given? – Chee Han Oct 7 '17 at 8:26
• Also, $a$ should be $\dfrac{1}{k - m\omega_2^2}$, provided $\omega_2\neq\omega_1$. – Chee Han Oct 7 '17 at 8:31
• $\omega_2$ is not given, how does $a = \dfrac{1}{k - m\omega_2^2}$? – randb Oct 7 '17 at 8:55
• When you substitute your $y_p''(t)$ into the given differential equation and equate the coefficient of $\cos(\omega_2 t)$, you get $m(-\omega_2^2a) + ka = 1$, or $a\left(-m\omega_2^2 + k\right) = 1$. – Chee Han Oct 7 '17 at 8:57
• So I end up with a general solution of $A\cos(\omega_1t)+B\sin(\omega_1t)+\frac{1}{k-m\omega_2^2}\cos(\omega_2t)$? – randb Oct 7 '17 at 9:00

The general solution to nonhomogeneous second order ODE is obtained by adding the solution to the homogeneous equation $y_c$ and the particular solution $y_p$, i.e. $$y = y_c + y_p.$$
First, you're mixing up "homogeneous" and "inhomogeneous." Your second displayed line is the homogeneous solution. When you try to find the non-homogeneous particular solution $y_p$, there are two cases. If $\omega_1 \neq \omega_2$, then what you did was correct (up to the correction given by @Chee Han.) But if $\omega_1=\omega_2$, then you have to multiply your form for $y_p$ by $t$ before you plug it into the DE to find $a$ and $b$.