Limit Behavior of Differential Equation I have a differential equation of the form
$$r(t)f(t,x) + \frac{\partial}{\partial t}f(t,x) = g(t,x)$$
where $r(t),g(t,x)$ are given and I want to solve for $f(\cdot,\cdot)$. I also know that there exist a constant $r$ and a function $g(x)$ such that $\lim_{t \to \infty} r(t) = r^{\ast}$ and  $\lim_{t \to \infty} g(t,x) = g^{\ast}(x)$ uniformly over $x$.
In the limit as $t \to \infty$, the differential equation would become $r^{\ast} f(x) = g^{\ast}(x)$, so that $f(x) = g^{\ast}(x)/r^{\ast}$. If $f(t,x)$ is a solution to the original differential equation, under what conditions do we have that
$$\lim_{t \to \infty} f(t,x) = \frac{g^{\ast}(x)}{r^{\ast}}$$
 A: The variable $x$ is actually a parameter here in your ODE. So you need an initial conditions $f(0,x) = f|_{t=0}$
$$\partial_t f = -r(t)f + g(t,x)$$
You can use an integrating factor here and set
$$u(t,x) = e^{\int_0^tr(s)ds}f(t,x)$$
Then
\begin{align}
\partial_t u &= [r(t) f(t,x) - r(t)f(t) + g(t,x)]e^{\int_0^tr(s)ds}
\\
&=g(t,x)e^{\int_0^tr(s)ds}
\end{align}
Then assume that $r(t) >0$ for all $t\in[0,\infty)$, which implies
\begin{align}
u(t,x) &= u(0,x) + \int_0^te^{\int_0^sr(s')ds'}g(s,x)ds
\\
&=u(0,x) + \int_0^t \frac{1}{r(s)}\frac{d}{ds}\bigg(e^{\int_0^sr(s')ds'}\bigg)g(s,x)ds
\\
&=u(0,x) + \frac{g(t,x)}{r(t)}e^{\int_0^tr(s)ds} - \frac{g(0,x)}{r(0)} - \int_0^te^{\int_0^sr(s')ds'}\frac{d}{ds}\bigg(\frac{g(s,x)}{r(s)}\bigg)ds
\end{align}
hence
\begin{align}
f(t,x) &= e^{-\int_0^tr(s)ds}u(t,x)
\\
&= e^{-\int_0^tr(s)ds}f(0,x) + \frac{g(t,x)}{r(t)} - \frac{g(0,x)}{r(0)}e^{-\int_0^tr(s)ds} - e^{-\int_0^tr(s)ds}\int_0^te^{\int_0^sr(s')ds'}\frac{d}{ds}\bigg(\frac{g(s,x)}{r(s)}\bigg)ds
\end{align}
Therefore you just need
$$\lim_{t\rightarrow \infty}\bigg(\int_0^tr(s)ds\bigg) = +\infty$$
and
$$ \lim_{t\rightarrow \infty}\bigg(e^{-\int_0^tr(s)ds}\int_0^te^{\int_0^sr(s')ds'}\frac{d}{ds}\bigg(\frac{g(s,x)}{r(s)}\bigg)ds\bigg) = 0$$
which will give
$$\lim_{t\rightarrow \infty}f(t,x) = \frac{g^*(x)}{r^*}$$
