What is the solution to linear ODE $\dot x = Ax + b$?

As an alternative approach, we can use a technique that you might have seen for solving the inhomogeneous scalar differential equation $\dot x= kx+b(t)$: guess that a particular solution is of the form $\mathbf x(t) = \exp(tA)\mathbf w(t)$. Substituting this into the differential equation gives $$A e^{tA}\mathbf w(t)+e^{tA}\dot{\mathbf w}(t) = Ae^{tA}\mathbf w(t)+\mathbf b(t)$$ so that $$\dot{\mathbf w}(t) = e^{-tA}\mathbf b(t).$$ Integrating, we get $$\mathbf w(t) = \int_0^t e^{-sA}\mathbf b(s)\,ds$$ and $$\mathbf x(t) = e^{tA}\mathbf w(t) = \int_0^t e^{(t-s)A}\mathbf b(s)\,ds.$$ This obviously satisfies $\mathbf x(0)=0$, so the general solution is $$\mathbf x(t) = e^{tA}\mathbf x_0+\int_0^t e^{(t-s)A}\mathbf b(s)\,ds.$$

When $\mathbf b$ is constant and $A$ invertible, the above integral is equal to $(\exp(tA)-I)A^{-1}\mathbf b$.


The convolution integral in amd's answer should work as well, but I would just like to add two other methods of solving for $x(t)$.

The first method uses a coordinate transformation $z = x + a$, with $a\in\mathbb{R}^n$ similar to $b$ a constant vector. Differentiation the new coordinates gives

\begin{align} \dot{z} &= \dot{x}, \\ &= A\,x + b, \\ &= A\,(z - a) + b. \end{align}

If one can solve $A\,a=b$ for $a$ then $z=0$ would be an equilibrium point of $z$ and would have the solution $z(t) = e^{A\,t}\,z(0)$. And from the definition of $z$ it follows that

$$ x(t) = e^{A\,t}\,(x(0) + a) - a. $$

It can be noted that $A\,a=b$ can always be solved for $a$ if $A$ has full rank ($\det(A)\neq0$).

The other option that would always work is to extend the state space by one and set its initial condition to one $w = \begin{bmatrix}x^\top & 1\end{bmatrix}^\top$. Namely the differential equation $x$ is equivalent to

$$ \dot{w} = \begin{bmatrix}A & b \\ 0 & 0\end{bmatrix} w. $$

So the solution for $x(t)$ can also be found with

$$ x(t) = \begin{bmatrix}I & 0\end{bmatrix} e^{\begin{bmatrix}A & b \\ 0 & 0\end{bmatrix}t} \begin{bmatrix}x(0) \\ 1\end{bmatrix}. $$