# Linear system of differential equations

Hi!
My task is to solve this system:
$$\frac{\mathrm{d} x}{\mathrm{d} t}=-x+y-2z$$
$$\frac{\mathrm{d} y}{\mathrm{d} t}=4x+y$$
$$\frac{\mathrm{d} z}{\mathrm{d} t}=2x+y-z$$
My first equation (1) is $$\frac{\mathrm{d} y}{\mathrm{d} t}=4x+y$$.
Derivative of (1) is $$\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t})=4\frac{\mathrm{d} x}{\mathrm{d} t}+\frac{\mathrm{d} y}{\mathrm{d} t}=...=5y-8z$$ and this is my second equation.
Derivative of my second equation is $$\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t}))=5\frac{\mathrm{d} y}{\mathrm{d} t}-8\frac{\mathrm{d} z}{\mathrm{d} t}=...=4x-3y+8z$$ and this my third equation. So, my three equations are:
$$\frac{\mathrm{d} y}{\mathrm{d} t}=4x+y . . . (1)$$
$$\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t})=5y-8z . . . (2)$$
$$\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t}))=4x-3y+8z . . . (3)$$
From equation (1) we get $$4x=\frac{\mathrm{d} y}{\mathrm{d} t}-y$$ and we substitute it in equation (3):
$$\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t}))=4x-3y+8z=\frac{\mathrm{d} y}{\mathrm{d} t}-y-3y+8z$$
$$\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t}))=\frac{\mathrm{d} y}{\mathrm{d} t}-4y+8z . . . (4)$$
From equation (2) we get $$8z=5y-\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t})$$ and we substitute it in equation (4) so equation (4) becomes:
$$\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t}))+\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t})-\frac{\mathrm{d} y}{\mathrm{d} t}-y=0$$. This is Linear homogeneous differential equation and it has general solution $$y(t)=C1e^{t}+C2te^{-t}+C3t^2e^{-t}.$$
Now we can calculate $$x$$ from equation (1), $$x=\frac{1}{4}(\frac{\mathrm{d} y}{\mathrm{d} t}-y)$$.
We get $$x(t)=\frac{1}{4}C2(e^{-t}-2te^{-t})+\frac{1}{4}C3(2te^{-t}-2t^2e^{-t}).$$
From first equation of our system we get:
$$z(t)=-\frac{1}{2}\frac{\mathrm{d} x}{\mathrm{d} t}-\frac{1}{2}x+\frac{1}{2}y=...=\frac{1}{2}C1e^{t}+C2(\frac{1}{4}e^{-t}+\frac{1}{2}te^{-t})-C3(\frac{1}{4}e^{-t}-\frac{1}{2}te^{-t}-\frac{1}{2}t^2e^{-t})$$
I checked it and I couldn't figure out whats wrong with my solution. I used Matlab to check my solution. I used simplify(diff(x,t)+x-y+2*z) and simplify(diff(y,t)-4*x-y)to check my solution. I got 0 result for both commands and I thought everything is fine but I tried simplify(diff(z,t)-2*x-y+z) and I got (C3*exp(-t))/2

Last edited:

This is how my teacher told me to solve systems of D.E. I will take a look at your method.

verty
Homework Helper
1 person
ehild
Homework Helper
$$\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t}))+\frac{\mathrm{d} }{\mathrm{d} t}(\frac{\mathrm{d} y}{\mathrm{d} t})-\frac{\mathrm{d} y}{\mathrm{d} t}-y=0$$. This is Linear homogeneous differential equation and it has general solution $$y(t)=C1e^{t}+C2te^{-t}+C3t^2e^{-t}.$$

No, the general solution is not that.

Try solutions in the form eλt. Substitute into the differential equation, you get an algebraic equation for λ. If two roots are the same, (λ1) and the third one different, (λ2) then one solution belonging to λ1 is eλ1t and the other is teλ1t. But the solution that belongs to λ2 is eλ2t.

So the general solution for y is y(t)=C1e-t+C2te-t+C3et.

ehild

Last edited:
1 person
@ehild,
you saved me! :) thanks a lot!!

ehild
Homework Helper
You are welcome.

It would be really much less work if you start with the trial solution from the beginning. Assume all variables in the form Ceλt, but with different constant coefficients:

##x(t)=X_0 e^{λt}##; ##y(t)=Y_0 e^{λt}##; ##z(t)=Z_0 e^{λt}##.

Substitute into the original system of equations. You get a linear homogeneous system for X0, Y0, Z0. I think, you are familiar with such equations and you know that it has non-zero solutions if the determinant of the coefficients is zero. Solving the determinant equation, you get the values for λ. Substituting the roots back, you can determine X0, Y0, Z0 (one of them free) for each of them.

ehild

1 person
I have one more question. Here is my system:

$$\\\frac{\mathrm{d} x}{\mathrm{d} t}=5x+6y-6z$$
$$\\\frac{\mathrm{d} y}{\mathrm{d} t}=-2x-3y+4z$$
$$\\\frac{\mathrm{d} z}{\mathrm{d} t}=x+y$$

Here is my solution:
$$\\z'=x+y...(1)$$
$$\\z''=x'+y'=5x+6y-6z-2x-3y+4z=3x+3y-2z$$
$$\\z''=3x+3y-2z...(2)$$
$$\\z'''=3x'+3y'-2z'=...$$
$$\\z'''=7x+7y-6z...(3)$$

From equation (1) we get:
$$\\x=z'-y$$
We substitute it in equation (2) and we get:
$$\\z''=3x+3y-2z=3z'-3y+3y-2z$$
$$\\z''-3z'+2z=0\\$$
This is linear homogeneous D.E. with solution $$\\z(t)=C1e^{2t}+C2e^{t}$$.
We multiply last equation from our system of equations with (-6) and we add it to our first equation (also from our system). We get:
$$\\x'-6z'=-6x+5x-6y+6y-6z$$
$$\\x'+x=6z'-6z=6(2C1e^{2t}+C2e^{t})-6C1e^{2t}-6C2e^{t}$$
$$\\x'+x=6C1e^{2t}$$
We will solve this linear D.E. using method of variation of constant.
$$\\x'+x=0$$
$$\\\frac{\mathrm{d} x}{\mathrm{d} t}=-x/*\frac{dt}{x}$$
$$\\\frac{dx}{x}=-dt$$
$$\\lnx-lnC=-t$$
$$\\ln\frac{x}{C}=-t$$
$$\\x=Ce^{-t}$$
$$\\C=\varphi (t) \rightarrow x=\varphi (t)e^{-t}$$
$$\\x'=\varphi (t)'e^{-t}-\varphi (t)e^{-t}$$
$$\\\varphi (t)'e^{-t}-\varphi (t)e^{-t}+\varphi (t)e^{-t}=6C1e^{2t}$$
$$\\\varphi (t)'e^{-t}=6C1e^{2t}$$
$$\\\varphi (t)'=6C1e^{3t}$$
$$\\\varphi (t)=2C1e^{3t}+C3$$
Now we can calculate x(t):
$$\\x(t)=Ce^{-t}=\varphi (t)e^{-t}=(2C1e^{3t}+C3)e^{-t}$$
It is easy now to calculate y(t) as y(t)=z'-x. I checked my solution and it's ok but my question is, why it is necessary to add constant C3 when solving for $$\varphi(t)$$ (IT MUST BE C3, NO C1 or C2) ??? If I use C1 or C2 instead of C3 I GOT WRONG SOLUTION

Last edited:
Simon Bridge
Homework Helper
why it is necessary to add constant C3 when solving for
φ(t)
(IT MUST BE C3, NO C1 or C2) ??? If I use C1 or C2 instead of C3 I GOT WRONG SOLUTION
... because someone didn't program the computer properly, probably.
It does not matter what you call the arbitrary constant - but a computer marking program does not know that unless someone tells it.

Sometimes a human marker will use the variable name as an indicator to how you are thinking - but that would be poor teaching.

ehild
Homework Helper
You have used C1 and C2 for z(t). A new integration constant is needed for φ(t).

The method you are forced to follow is terribly complicated with respect to the standard method, which gives the three roots (2, 1,-1) in two lines.

ehild

Last edited:
It is possible that I made some mistake while i transcripted solution here from my papers... Here is how i tested my solution in Matlab:
>> syms t C1 C2 C3
>> z=C1*exp(2*t)+C2*exp(t);
>> x=2*C1*exp(2*t)+C3*exp(-t);
>> y=diff(z,t)-x;
>> simplify(diff(x,t)-5*x-6*y+6*z)

ans =

0

>> simplify(diff(y,t)+2*x+3*y-4*z)

ans =

0

>> simplify(diff(z,t)-x-y)

ans =

0

Last edited:
ehild
Homework Helper
It is possible that I made some mistake while i transcripted solution here from my papers... Here is how i tested my solution in Matlab:
>> syms t C1 C2 C3
>> z=C1*exp(2*t)+C2*exp(t);
>> x=2*C1*exp(2*t)+C3*exp(-t);
>> y=diff(z,t)-x;

So y(t)=C2 *exp(t)-C3*exp(-t).

To complete a solution, you have to give all functions : x(t), y(t), z(t).