# DSolve problem with system of linear ODEs

I encounter a rather strange problem in Mathematica when trying to solve the following system of linear differential equations:

M:={{0,1,0},{0,-1,1},{2,0,-4}}
ODESys := X'[t] == M.X[t]
InCond := X[0] == {5,0,5/2}
DSolve[{ODESys, InCond}, X[t], {t, 0, 1000}]


Despite the fact that the system should have an existing and unique solution (the eigenvalues of M are all nondegenerate and the eigenvectors are linearly independent), the ouput from the above code is empty, giving the warning

DSolve::bvnul: "For some branches of the general solution, the given boundary conditions lead to an empty solution".


However, there should not exist different branches. Also when using NDSolve instead of DSolve, the code works like a charm. Any ideas why the above code does not work for DSolve will be highly appreciated.

• You need to define X: X[t_] = {x[t], y[t], z[t]}. Aug 11, 2014 at 12:09
• Thank you very much. Now it is working. As in NDSolve there is no need to define the vector X explicitly (its dimensions are taken from the initial conditions), I assumed the same for DSolve, which was obviously wrong.
– Alex
Aug 11, 2014 at 12:27
• I have to admit that I find it an odd syntactical difference that NDSolve works while DSolve does not. I don't think I'd call it a bug, though. Aug 11, 2014 at 12:30

## 1 Answer

mat = {{0, 1, 0}, {0, -1, 1}, {2, 0, -4}};
xm = {x[t], y[t], z[t]};
sol = First[
DSolve[{D[xm, t] == mat.xm, (xm /. t -> 0) == {5, 0, 5/2}}, xm,
t]];
Plot[Evaluate[{x[t], y[t], z[t]} /. sol], {t, 0, 5},
PlotLegends -> xm, Frame -> True]


yields:

• Your code is clear. Thanks! Jan 9, 2017 at 15:14