Solving an initial value problem with addition: $\frac {dy}{dx}=(4+y)\cos x + 4x(4+y),\ y(0)=0$. I am to solve the following initial value problem:
$$\frac {dy}{dx}=(4+y)\cos x + 4x(4+y),\ y(0)=0$$
I am aware that the general formula for an ODE/IVP is:
$$\frac {dy}{dx}+p(x)\cdot y=q(x),$$
and the integrating factor is:
$$I(x)=e^{\int p(x)\ dx}$$
However, do I expand the terms and solve like this:
$$\frac {dy}{dx}-\cos\ x\cdot y=4\cos x+4x(4+y)$$
so there are $p(x)$ and $y$ terms on the left and a $q(x)$ term on the right?
Integrating that is proving difficult and I think I have gone about arranging the equation wrong.
Thank you.

EDIT:
This allows me to have:
$$e^{\int -\cos(x)\ dx}$$
which is:
$$e^{-\sin(x)}$$
 A: \begin{align}
\dfrac{dy}{dx}&=(4+y)\cos x + 4x(4+y)\\
\implies\dfrac{dy}{dx}&=y(\cos x+4x)+4(\cos x+4x)\\
\implies\dfrac{dy}{dx}-y(\cos x+4x)&=4(\cos x+4x)\hspace{25pt}\cdots\text{(i)}\\
\end{align}
Now (i) is in the form of $\dfrac{dy}{dx}+y\cdotp(x)=q(x)$.
So, Integrating Factor, $I.F.=e^{-\int(\cos x+4x)\:dx}=e^{-(\sin x+2x^2)}$ .
Therefore, (i) can be written as:
\begin{align}
\dfrac{d}{dx}\left[y\cdot e^{-(\sin x+2x^2)}\right]&=4(\cos x+4x)\cdot e^{-(\sin x+2x^2)}\\
\int d\left[y\cdot e^{-(\sin x+2x^2)}\right]&=4\int(\cos x+4x)\cdot e^{-(\sin x+2x^2)}\ dx+c\hspace{25pt} [c=\text{integration const.]}\\
y\cdot e^{-(\sin x+2x^2)}&=-4e^{-(\sin x+2x^2)}+c
\end{align}
Now, as $y(0)=0\implies c=4$.
Therefore solution is, $y\cdot e^{-(\sin x+2x^2)}=4\left[1-e^{-(\sin x+2x^2)}\right]$.
A: If you want to solve it as a linear ODE, you would have to arrange it in the form you mentioned. However, note that your integrating factor is incorrect, because you did not put in in the form you mentioned:
$$\frac{dy}{dx}+p(x)y=q(x) \tag{1}$$
This is because you still have $y$ on the RHS. To do it correctly, do this instead:
$$\begin{align} \frac {dy}{dx}&=(4+y)\cos x + 4x(4+y) \\ &=4\cos{x}+y\cos{x}+16x+4xy \\ &=4\cos{x}+16x+y(\cos{x}+4x) \end{align}$$
Hence:
$$\frac{dy}{dx}+(-4x-\cos{x})\cdot y=4\cos{x}+16x$$
It is now in the form of $(1)$. Hence, your integrating factor should be:
$$\mu(x)=e^{\int p(x)~dx}=e^{\int (-4x-\cos{x})~dx}=e^{-2x^2-\sin{x}}$$
Applying the reverse product rule and integrating both sides should now not be a problem.

However, note that an easier method to solve it is to realize that you can factor it as:
$$\frac{dy}{dx}=(y+4)(4x+\cos{x})$$
And then solve it as a separable ODE:
$$\int \frac{1}{y+4}~dy=\int (4x+\cos{x})~dx$$
