In class we are solving the linear differential equation with driving given by $$ \frac{dx}{dt} = -\gamma x + f(t) $$ The professor first transformed to a new variable $y$, $$ y(t) := x(t) e^{\gamma t} $$ and then calculate the differential equation for $y$: $$ \frac{dy}{dt} = \frac{\partial y}{\partial x}\frac{dx}{dt} + \frac{\partial y}{\partial t} = e^{\gamma t} f(t) $$ Problem: I don't understand how he reached the last step, i.e., how it equals $e^{\gamma t} f(t)$.
Attempt: Here is what I get for the differentials: $$ \frac{\partial y}{\partial x} = e^{\gamma t} \\ \frac{dx}{dt} = -\gamma x + f(t) \\ \frac{\partial y}{\partial t} = e^{\gamma t}\frac{dx}{dt} + x(t)\gamma e^{\gamma t} $$ Given these, I get $$ \frac{\partial y}{\partial x}\frac{dx}{dt} + \frac{\partial y}{\partial t} = -\gamma x e^{\gamma t} + 2fe^{\gamma t} $$ which is incorrect. It's probably my differentials that are incorrect, but what am I doing wrong here?
By calculating $\frac{dy}{dt}$ as $$\frac{dy}{dt} = \color{blue}{\frac{\partial y}{\partial x}\frac{dx}{dt} }+ \color{red}{\frac{\partial y}{\partial t}}$$ you have already taken the $x$, and $t$ through $x$, dependency into account (blue). That leaves:
$$\frac{\partial y}{\partial t} = x\gamma e^{\gamma t}$$ and so: $$\frac{dy}{dt} = e^{\gamma t} \bigl( -\gamma x + f(t) \bigr) + x\gamma e^{\gamma t} = e^{\gamma t}f(t)$$