# How to solve this diffrential equation using parts formula?

$$\frac{\mathrm dy}{\mathrm dx} + \frac{y}{20} = 50(1+\cos x)$$

I tried solving it using the linear differential equation formula for $$\frac{\mathrm dy}{\mathrm dx} + P_y = Q$$, where integrating factor comes to be $$e^{0.05x}$$. Now, if I use the formula I am stuck with the term $$\int e^{0.05x} \cos x\,\mathrm dx,$$ which is just repeating when using parts.

• Not quite “just repeating.” Careful bookkeeping is required. Nov 27 '21 at 5:22

$$\int e^{ax}\cos(bx)dx = \dfrac{e^{ax}}{a^2+b^2}\left[a\cos(bx)+b\sin(bx)\right]+c$$
\begin{align}&I =\int \underbrace{e^{ax}}_u\underbrace{\cos(bx)dx}_{dv} = uv - \int vdu\\\\ \Rightarrow&I = e^{ax}\left[\dfrac1b\sin(bx)\right]-\dfrac ab\int e^{ax}\sin(bx)dx \\&= e^{ax}\left[\dfrac1b\sin(bx)\right] -\left( \dfrac abe^{ax}\left[-\dfrac1b\cos(bx)\right] - \dfrac {a^2}{b^2}\int e^{ax}\sin(bx)dx \right)\\\\ \Rightarrow&I = \dfrac{e^{ax}(a\cos (bx)+b\sin(bx)}{b^2}+\dfrac{a^2}{b^2}I\\\\ \Rightarrow&I\left(1+\dfrac{a^2}{b^2}\right) = \dfrac{e^{ax}(a\cos (bx)+b\sin(bx)}{b^2} \\\\ \Rightarrow&\boxed{I =\dfrac{e^{ax}}{a^2+b^2}\left[a\cos(bx)+b\sin(bx)\right]} \end{align}