# General solution of a system of linear differential equations with multiple generalized eigenvectors

I am looking for general solutions for the linear sODE's $$\textbf{x}'(t) = A\textbf{x}(t)$$ with $t \geq 0$ and $A \in \mathbb{R}^{n \times n}$

Let focus on just real eigenvalues and eigenvectors. For the case of $n=2$, where we have one eigenvalue, $\lambda \in \mathbb{R}$, such that $am(\lambda)=2, gm(\lambda)=1$ I know that the general solution is $$\textbf{x}(t) = e^{\lambda t}(c_1 \textbf{v} + c_2\textbf{w}) + te^{\lambda t}(c_2 \textbf{w})$$ where $c_1,c_2 \in \mathbb{R}$, $\textbf{v}$ is the eigenvector corresponding to $\lambda$ and $\textbf{w}$ is a generalized eigenvector of $A$.

But what would be the general solution be in the case $n = 3$ with one eigenvalue, $\lambda \in \mathbb{R}$, such that $am(\lambda)=3, gm(\lambda)=1$ or in the case of two eigenvalues $\lambda_1,\lambda_2$ with $am(\lambda_1)=2, gm(\lambda_1) = 1, am(\lambda_2)=1, gm(\lambda_2) = 1$?

So, all in all, how would one find the general solution to such systems of linear differential equations?

Full answers are appreciated, but I prefer some hints to find the solution myself.

Bonus: The same question but then with difference equations.

2. For each eigenvalue $\lambda$, find a basis of the eigenspace, i.e., of the null space of $A-\lambda I$.
3. Each basis element $v$ yields a solution $e^{\lambda t}v$.
4. If the dimension of the eigenspace is equal to the algebraic multiplicity of $\lambda$, we are done with $\lambda$.
5. Otherwise look for generalized eigenvectors on top of each $v$ as in step 3. These come from equations $(A-\lambda I)w_1=v$, $(A-\lambda I)w_2=w_1$, etc.
6. The generalized eigenvectors contribute solutions $$e^{\lambda t} (tv+w_1),\quad e^{\lambda t} \left(\frac{t^2}2 v+tw_1+w_2\right), \dots$$ where the coefficients are of the form $t^k/k!$
7. The number of solutions obtained in this way is $n$. Since they are linearly independent by construction, their linear combinations yield the general solution of the system.