The ODE is linear. Multiplying both sides by \(e^{7t}\) allows you to condense the left hand side as the derivative of a product.
\(x'+7x=5\cos2t\)
\(e^{7t}x'+7e^{7t}x=5e^{7t}\cos2t\)
\(\dfrac{\mathrm d}{\mathrm dt}\left[e^{7t}x\right]=5e^{7t}\cos2t\)
Integrating both sides with respect to \(t\) yields
\(e^{7t}x=5\displaystyle\int e^{7t}\cos2t\,\mathrm dt\)
The integral can be done by parts. You should get
\(e^{7t}x=\dfrac5{53}e^{7t}(7\cos2t+2\sin2t)+C\)
\(x=\dfrac5{53}(7\cos2t+2\sin2t)+Ce^{-7t}\)
With the given initial condition, you have
\(0=\dfrac5{53}(7+0)+C\implies C=-\dfrac{35}{53}\)
So the particular solution to the ODE is
\(x=\dfrac5{53}(7\cos2t+2\sin2t)-\dfrac{35}{53}e^{-7t}\)