Change of variables for a linear ODE system Given the solution $\vec x$ to a system of $n$ linear equations $$\dot x_i=f_i(\vec x)$$ for $i=1,\dots,n$, where each $f_i$ is known to be linear in $\vec x$ but is otherwise not known, is there a simple way to obtain the solution $\vec y$ to the system of $n$ linear equations $$\dot y_i=f_i(\vec y)+r_i y_i$$ in terms of $\vec x$ but not $f$, presumably via some change of variables with exponential scaling?
 A: We consider the vector ${\bf x} = (x_1\dots x_n)^\top$ which satisfies the ordinary differential equation (ODE)
$$
\dot{\bf x} = {\bf A}\, {\bf x} + {\bf b}
$$
where ${\bf A}$ is an invertible $n$-by-$n$ matrix, ${\bf b}$ is a vector, and the initial conditions are ${\bf x}(0) = {\bf 0}$. The solution is expressed by
$$
{\bf x}(t) = \left(\exp(t{\bf A}) - {\bf I}\right) {\bf A}^{-1}\,{\bf b} \, ,
$$
where $\exp(t{\bf A})$ is the matrix exponential of $t{\bf A}$. Now, we consider the vector ${\bf y} = (y_1\dots y_n)^\top$ which satisfies
$$
\dot{\bf y} = {\bf A}\, {\bf y} + {\bf b} + {\bf R}\, {\bf y}
$$
where ${\bf R} = \text{diag}(r_1\dots r_n)$ is a diagonal matrix, and the initial conditions are ${\bf y}(0) = {\bf 0}$. Similarly, the solution is expressed by
$$
{\bf y}(t) = \left(\exp(t ({\bf A}+{\bf R})) - {\bf I}\right) ({\bf A}+{\bf R})^{-1}\,{\bf b} \, .
$$
Since ${\bf A}$ and ${\bf R}$ commute, one has the relation
$$
{\bf y}(t) = \left(\exp(t {\bf A})\exp(t{\bf R}) - {\bf I}\right) ({\bf A}+{\bf R})^{-1}\,{\bf A}\, \left(\exp(t {\bf A}) - {\bf I}\right)^{-1}\, {\bf x}(t) \, ,
$$
which may not be very useful in practice. If ${\bf A}$ is diagonal too, e.g. ${\bf A} = \text{diag}(s_1\dots s_n)$, then
$$
{\bf y}(t) = \text{diag}\left(\frac{s_1}{s_1 + r_1} \frac{\exp(r_1 t) - \exp(-s_1 t)}{1 - \exp(-s_1 t)}, \dots ,\frac{s_n}{s_n + r_n} \frac{\exp(r_n t) - \exp(-s_n t)}{1 - \exp(-s_n t)}\right) {\bf x}(t) \, .
$$

Note: I tried to use the superposition principle, but was not successful in this approach for the moment.
