Assignment Statement
given $$ y^{\prime} + p(t)y = q(t) $$ a general linear equation where $q(t)$ is not zero everywhere,
I'm asked to find $C(t)$ form $$ C^{\prime}(t)= q(t)e^{\int p(t) \ dt}$$ then substitute in $$ y(t) = C(t)e^{-\int p(t) \ dt}$$ to extract the y(t) solution.
Attempt at solution
I'm having trouble at the first step if I integrate both sides I get $$ C(t) = \int\left( q(t) e^{\int p(t) \ dt}\right) \ dt$$
I feel like I have to do integration by parts on the right-hand side but both substitutions give me very odd expressions involving integrals of integrals and I'm genuinely confused how to start.
I also tough that maybe I just substitute everything and do something on the final expression which is: $$ y(t) = \frac{\int\left( q(t) e^{\int p(t) \ dt}\right) \ dt}{e^{\int p(t) \ dt}}$$ I notice there's a common factor $e^{\int p(t) \ dt}$ maybe I have to do something with that ?
When you apply the method of $\textrm{variation of parameters}$ you firstly have to solve the homogeneous equation $$ y^{\prime} + p(t)\cdot y =0 $$
$$y^{\prime} =- p(t)\cdot y $$
$$\frac{dt}{y}=-p(t) \, dt$$
$$ \ln(y)=-\int p(t) \, dt$$
$$y_h=C\cdot e^{-\int p(t) \, dt}$$
Then the non-homogeneous solution is $y_p=C(t)\cdot e^{-\int p(t) \, dt}$. Differentiating the function gives
$y'_p=C'(t)\cdot e^{-\int p(t) \, dt}-C(t)\cdot p(t) \cdot e^{-\int p(t) \, dt}$.
Plugging into the non-homogeneous equation.
$C'(t)\cdot e^{-\int p(t) \, dt}\underbrace{-C(t)\cdot p(t) \cdot e^{-\int p(t) \, dt}+p(t)\cdot C(t)\cdot e^{-\int p(t) \, dt}}_{=0}=q(t)$
$C'(t)\cdot e^{-\int p(t) \, dt}=q(t)$
$C'(t)=q(t)\cdot e^{\int p(t) \, dt}\Rightarrow C(t)=\int q(t)\cdot e^{\int p(t) \, dt} \, dt$. Using this result to obtain $y_p$.
$y_p=e^{-\int p(t) \, dt} \cdot \int q(t)\cdot e^{\int p(t) \, dt} \, dt$. It total we get
$$y=y_h+y_p=C\cdot e^{-\int p(t) \, dt}+e^{-\int p(t) \, dt} \cdot \int q(t)\cdot e^{\int p(t) \, dt} \, dt$$
$$=\left(C+\int q(t)\cdot e^{\int p(t) \, dt} \, dt\right)\cdot e^{-\int p(t) \, dt}$$