For

𝑑𝑦𝑑𝑡+𝑝(𝑡)𝑦(𝑡)=𝑔(𝑡)

consider a 𝜇(𝑡) that

𝜇𝑑𝑦𝑑𝑡+𝜇𝑝(𝑡)𝑦(𝑡)=𝜇𝑔(𝑡)

take 𝑑𝜇𝑑𝑡=𝜇𝑝(𝑡)𝜇=𝐶𝑒𝑝(𝑡)𝑡
therefore, we can turn the equation above to

𝑑𝑑𝑡(𝜇𝑦)=𝜇𝑔(𝑡)𝑦=𝜇𝑔(𝑡)𝑑𝑡+𝐶𝜇

then plug 𝑚𝑢 in as the solution.