ODE when the nonhomogeneity is complex How should I use the method of undetermined coefficients to solve the following differential equation? I know how to do it when the nonhomogeneity is real, such as polynomial(t) * Sin(t), but I am not sure what to do when the right-hand side is complex.
$${\frac {d^{2}y}{dt^{2}}}+2{\frac {dy}{dt}}+4y= \sqrt{3} e^{-t+\sqrt{3}it}$$
 A: Let us split this ODE into two real ODEs by setting $y(t) = a(t) + \text{i}\, b(t)$, where $a$ is the real part of $y$ and $b$ its imaginary part. Thus, we solve
\begin{aligned}
& \frac{d^2 a}{dt^2} + 2\frac{d a}{dt} + 4a = \sqrt{3}\, \text{e}^{-t} \cos\left(\sqrt{3}\, t\right) ,\\ \\
& \frac{d^2 b}{dt^2} + 2\frac{d b}{dt} + 4b = \sqrt{3}\, \text{e}^{-t} \sin\left(\sqrt{3}\, t\right) ,
\end{aligned}
which are two classical ODEs that can be solved with the method of undetermined coefficients. An ansatz of the form
$$ a_p(t) = \alpha t\, \text{e}^{-t} \sin\left(\sqrt{3}\, t\right) \qquad\text{and}\qquad b_p(t) = \beta t\, \text{e}^{-t} \cos\left(\sqrt{3}\, t\right)\, , $$
where $a_p$ and $b_p$ denote particular solutions of the ODEs, yields $\alpha=\frac{1}{2}$ and $\beta={-\frac{1}{2}}$.
The final solutions of the differential equations are therefore
\begin{aligned}
& a(t) = \left( \frac{1}{2}\left(\alpha_1 + t \right)\sin\left(\sqrt{3}\, t\right) + \alpha_2 \cos\left(\sqrt{3}\, t\right) \right) \text{e}^{-t}\, ,\\ \\
& b(t) = \left( \beta_1\sin\left(\sqrt{3}\, t\right) - \frac{1}{2}\left(\beta_2 + t \right)\cos\left(\sqrt{3}\, t\right) \right) \text{e}^{-t}\, ,
\end{aligned}
where $\alpha_i$ and $\beta_i$ are real coefficients.

Alternatively, an ansatz of the form
$$ y_p(t) = \left(\alpha + \text{i}\,\beta\right) t\, \text{e}^{-t + \text{i}\sqrt{3}\, t} \, , $$
where $\alpha$ and $\beta$ are reals may be used. If $y_p$ is a particular solution of the initial ODE, then $\alpha=0$ and $\beta={-\frac{1}{2}}$. Thus, the final solution of the differential equation is
$$ y(t) = \left( \lambda_1\, \text{e}^{- \text{i}\sqrt{3}\, t} - \frac{\text{i}}{2}\left(\lambda_2 + t\right)\text{e}^{\text{i}\sqrt{3}\, t} \right) \text{e}^{-t} \, , $$
where $\lambda_1$ and $\lambda_2$ are complex coefficients.

Otherwise, one can work on the corresponding differential system. If $Y = (y,dy/dt)^\top$, then
$$
\frac{d}{dt}Y +
\underbrace{\left(\begin{array}{cc}
0 & -1\\
4 & 2
\end{array}\right)}_{A}
Y =
\left(\begin{array}{c}
0 \\
\sqrt{3}\, \text{e}^{-t + \text{i}\sqrt{3}\, t}
\end{array}\right) .
$$
The solutions are
$$
Y(t) = \text{e}^{- t A}\, Y_0 + Y_1(t) \, ,
$$
where $Y_1$ is a particular solution, which can be obtained by variation of constants:
$$
\frac{d}{dt}Y_1 = \text{e}^{t A}
\left(\begin{array}{c}
0 \\
\sqrt{3}\, \text{e}^{-t + \text{i}\sqrt{3}\, t}
\end{array}\right) .
$$
When using this technique, one must compute the matrix exponential $\text{e}^{\pm t A}$ carefully.
