Answer
See below
Work Step by Step
Given $\frac{dy}{dx}+p(x)y=q(x)$
where $p(x), q(x)$ are continuous functions
a) Rewrite the given equation:
$(p(x)y-q(x))dx+dy=0$
With $Mdx+Ndy=1$ we have $\frac{M_y-N_x}{N}=p(x)$
Hence, the integrating factor must be: $I(x)=e^{\int p(x)dx}$
b) Multiply the given equation by integrating factor:
$I(x)(p(x)y-q(x))dx+I(x)dy=0$
Let $\phi$ be the potential function for above equation, then we have:
$\frac{\partial \phi}{\partial x}=I(x)=(p(x)y-q(x))\\\rightarrow \phi=\int I(x)(p(x)y-q(x))dx+f(y)\\
\rightarrow \phi=I(x)y-\int I(x)q(x)dx+f(y)$
Since $\frac{\partial \phi}{\partial y}=\frac{\partial }{\partial y}\int I(x)(p(x)y-q(x))dx+f'(y)=N=I(x)\\
\rightarrow \frac{\partial \phi}{\partial y}=I(x)+f'(y)=I(x)$
then $f'(y)=0 \rightarrow f(y)=C$
Hence, the solution to the differential equation is
$I(x)y-\int I(x)q(x)dx+C=0\\
\rightarrow y=I^{-1}(\int I(x)q(x)+C)$
where $C$ is an arbitrary constant.