I want to find a basis for the set of solutions of the following system of ODEs.

DSolve[{x'[t] == x[t]/t - y[t], y'[t] == x[t] + y[t]/t}, {y[t], x[t]}, t]

I get very unexpected result when I evaluate the above expression. Mathematica returns my input.

Of course, I know the answer.


From Wolfram Technical Support:

Thank you for contacting Wolfram Technical Support. I have confirmed that DSolve is not able to find the solution to the equation you provided. I found a workaround by introducing an arbitrary variable 'a' then setting a=-1 at the end of the calculation. This can be done as follows:

X[t_]:={x[t],y[t]} A={{1/t,a},{-a,1/t}}; system=X'[t]==A.X[t]; sol=DSolve[system,{x,y},t] sol/.{a-> -1}

DSolve should be able to sole the equation in the original form you provided. I will file a report with our developers regarding this issue. Thank you for bringing this to our attention. [CASE:3808703]

  • $\begingroup$ Does the answer that you know work when t==0? When it can be justified, eliminating denominators seems to almost always give better results. $\endgroup$
    – Bill
    Commented Jan 1, 2017 at 3:44

3 Answers 3


Fixed in version 11.1 Now DSolve can solve it directly


11.1.0 for Microsoft Windows (64-bit) (March 13, 2017)


 {{x[t]->t C[1] Cos[t]-t C[2] Sin[t],y[t]->t C[2] Cos[t]+t C[1] Sin[t]}}

I'm not sure why this doesn't work. Until someone finds the reason, here is a workaround to solve the system of equations:

ode={x'[t] == x[t]/t - y[t], y'[t] == x[t] + y[t]/t}

Using the change of variables $x(t)=t X(t)$ and $y(t)=tY(t)$,

ode /. {x -> ((# X[#]) &), y -> ((# Y[#]) &)}
(* X[t] + t X'[t] == X[t] - t Y[t], Y[t] + t Y'[t] == t X[t] + Y[t] *)

which is now easily solved by DSolve:

DSolve[%, {X[t], Y[t]}, {t}]
(* X[t] -> C[1] Cos[t] - C[2] Sin[t], Y[t] -> C[2] Cos[t] + C[1] Sin[t] *)
  • 1
    $\begingroup$ I would read this post as a proof that there is nothing intrinsically wrong with the system of ODE's; the problem seems to be with MM, not with the equations themselves. I would be very happy if someone finds the reason for MM to dislike the equations in their initial form. $\endgroup$ Commented Jan 1, 2017 at 12:53

Here is another way to solve in Mathematica.

\begin{align*} x^{\prime}\left( t\right) & =\frac{x\left( t\right) }{t}-y\left( t\right) \\ y^{\prime}\left( t\right) & =x\left( t\right) -\frac{y\left( t\right) }{t} \end{align*}

Write as

$$ \dot{X}=AX $$

Where $A= \begin{pmatrix} \frac{1}{t} & -1\\ 1 & \frac{-1}{t} \end{pmatrix} $. Let us assume the solution is $X\left( t\right) =X\left( 0\right) e^{\int_{0}^{t}A\left( \tau\right) d\tau}$. However, this only works (since this is matrix time varying system) if $A$ commutes with $e^{\int_{0}^{t}A\left( \tau\right) d\tau}$. i.e. if $$ A\left( t\right) e^{\int_{0}^{t}A\left( \tau\right) d\tau}=e^{\int_{0} ^{t}A\left( \tau\right) d\tau}A\left( t\right) $$

If it does not commute, things get little more complicated. We can check, using Mathematica, that it does indeed commute in this example, so we are lucky

(mat = {{1/t, -1}, {1, 1/t}}) // MatrixForm
(bmat = MatrixExp[Integrate[mat, t]]) // MatrixForm

Mathematica graphics

 mat.bmat == bmat.mat

Mathematica graphics

Therefore, we can ask Mathematica now to solve it, using MatrixExp

x0 = {c1, c2}; (*constant of integration*)
(sol = x0.bmat) // MatrixForm

Mathematica graphics

The above is the solution. First row is $x(t)$ and second row is $y(t)$.

Why did Mathematica not solve it? I do not know.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.