DE Systems

Solve the homogeneous eqn x'=Ax.

Use the eigen method.

Clear[A]
A = {{1, Sqrt[3]}, {Sqrt[3],-1}}

Note that A is Hermitian, so we are guaranteed a full set of linearly independent eigenvectors.  Therefore, we'll have a full set of linearly independent solutions to the DE from this eigen method.

Clear[eval1,eval2,evec1, evec2]
{{eval1,eval2},{evec1,evec2}} = 
Eigensystem[A]

Get the T and D matrices.

Clear[T]
T = Transpose[{evec1,evec2}]

MatrixForm[T]

Clear[Tinv]
Tinv = Inverse[T]

Tinv=Simplify[Tinv]

Clear[D2]
D2 = Tinv.A.T

(We used “D2” because Mathematica knows “D” as the derivative operator.)  Note that D2 is the diagonal matrix of the eigenvalues in the same order that the eigenvectors were placed as columns in T. This is the matrix that can describe an equivalent diagonalized system.

Get the fundamental matrices.

General ones

Any matrix whose columns are linearly independent solutions of the homogenous equation is a fundamental matrix.  There are a lot of them.  In some sources, these are designated as psi, the trident, Ψ.  Other sources may use a capital X.  The easiest one to state is the following.

Clear[Xmat]
Xmat = Transpose[{  evec1 Exp[eval1 t],evec2 Exp[ eval2 t]}]

MatrixForm[Xmat]

Let's check.
Does our matrix satisfy the DE?

D[Xmat,t] - A.Xmat

Are the columns of our matrix linearly independent?  That is true provided our determinant is not 0.

Det[Xmat]

Thus, our solutions are linearly independent.

"THE" fundamental matrix

THE fundamental matrix is one whose initial value is the identity matrix.  Some sources use the capital Greek letter phi, Φ.  If we're not given an initial value, we usually use 0.  The easiest way to find phi is the product of the matrix whose columns are solutions from the eigen method, with the inverse of that matrix evaluated at t0.

Clear[Xmat2]
Xmat2 = Xmat/.t->0

Clear[Xmat2Inv]
Xmat2Inv = Inverse[Xmat2]

Xmat2Inv = Simplify[Xmat2Inv]

Clear[phi]
phi = Xmat . Xmat2Inv

We can double-check the criteria for phi.  (This is not always necessary.)

Does phi satisfy the DE?

D[phi,t] - A.phi

Simplify[%]

Are the columns of phi linearly independent?  It's true provided det(phi) is not 0.

Det[phi]

Further, is the value of phi at 0 the identity?

phi /. t-> 0

Equivalent Decoupled system

Clear[y,y1,y2]
y={y1,y2}

D2.y

So, y' = D2.y is just 
y1' = -2 y1, y2' = 2 y2; it's a decoupled system.  We can solve each independently.

DSolve[y1'[t] == -2 y1[t],y1[t],t]

DSolve[y2'[t] == 2 y2[t],y2[t],t]

y = {E^(-2 t) C[1],(E^(2 t)) C[2]}

Clear[x]
x = T.y

Let's check if it works.

D[x,t] - A.x

Simplify[%]

Note the Q matrix

Clear[Q]
Q = DiagonalMatrix[ {Exp[ eval1 t],Exp[eval2 t]} ]

T.Q

Note that this is Xmat.

Xmat

Solve the nonhomogeneous eqn x'=Ax + g.

Decoupling.

Clear[g]
g = {Exp[t],Sqrt[3] Exp[-t]}

Clear[h]
h = T1.g

Simplify[h]

D2.{y1,y2} + h

Since y' = D2 y + h, we once again have decoupled equations.

DSolve[y1'[t] ==-((3 E^-t)/(-(1/Sqrt[3])-Sqrt[3]))+E^t/(-(1/Sqrt[3])-Sqrt[3]) - 2*y1[t],y1[t],t]

DSolve[y2'[t] == -(E^-t/(-(1/Sqrt[3])-Sqrt[3]))-E^t/(-(1/Sqrt[3])-Sqrt[3]) + 2*y2[t],y2[t],t]

Clear[y]
y = {-(1/4) Sqrt[3] E^(-2 t) (-3 E^t+E^(3 t)/3)+E^(-2 t) C[1],
1/4 Sqrt[3] E^(2 t) (-(1/3) E^(-3 t)-E^-t)+E^(2 t) C[2]}

The general solution to the original nonhomogeneous equation.

x = T.y

Simplify[x]

Undetermined Coefficients.

Examine g and form yp; modify if necessary.

Note that g has 2 linearly independent functions:  e^t and e^(-t), each multiplied by constant vectors.

Clear[a]
a ={1,0} Exp[t] + {0,Sqrt[3]} Exp[-t]

a-g

Thus, our initial guess for a particular solution to the nonhomogeneous equation is a general linear combination:

Clear[a1,a2,b1,b2,yp1]
yp1 = {a1,a2} Exp[t] + {b1,b2} Exp[-t]

Recall the complementary solution:

Clear[yc]
yc = c1 evec1 Exp[eval1 t] + c2 evec2 Exp[eval2 t]

Since the functions in yp1 are linearly independent of those in yc, we do not need to modify our initial guess.  Substitute yp1 into the DE and collect terms.  

Consider the left hand side.

Use the DE to obtain conditions on the coefficients.

D[yp1,t]

Now the right hand side.

A . yp1 + g

Expand[%]

Collect[%,Exp[t]]

% - D[yp1,t]

Collect[%,Exp[t]]

Solve for the coefficients.

Clear[UCsoln]
{UCsoln} = Solve[{2 b1+Sqrt[3] b2 ==0, 1+Sqrt[3] a2 ==0, 
 
  Sqrt[3]+Sqrt[3] b1 ==0, Sqrt[3] a1-2 a2 ==0}]

Clear[yp2]
yp2 = yp1 /. UCsoln

State the general solution.

Clear[ygen]
ygen = yp2+yc

Here is the general solution to the nonhomogenous equation.

Let's check.

D[ygen,t] - A.ygen - g

Simplify[%]

Variation of Parameters.

Clear[XmatInv]
XmatInv = Inverse[Xmat]

XmatInv = Simplify[ XmatInv]

XmatInv.g

Clear[ufcns]
ufcns = Integrate[XmatInv.g,t]

Xmat.ufcns

Clear[yp3]
yp3 = Simplify[Xmat.ufcns]

The general solution.

yc + yp3