# Set of ODE: how can I solve it?

I want to solve this system, but I have never solved a system of ODE, can you help me?

$$\begin{cases} \frac{dA}{dt}=-aA\\ \frac{dB}{dt}=aA-bB\\ \frac{dC}{dt}=bB \end{cases}$$

I have solved the first equation: $$A(t)=A_0e^{-a t}$$ Thanks for any help!

-
then put the solution in the second equation, solve for $B$ and then, by substituting $B$ in the third you should be able to find $C$. – user67133 Jun 23 '13 at 8:47
@user01123581321345589144... sure.. but I can't find B(t)... could you help me? – sunrise Jun 23 '13 at 9:00

After putting solution of first equation in 2nd, we get, $$\frac{dB}{dt}+bB=aA_0e^{-at}$$

This is a linear differential equation in $B$ which can be solved by multiplying integrating factor$(e^{bt})$ on both sides.

EDIT: $$e^{bt}\frac{dB}{dt}+be^{bt}B=aA_0e^{(b-a)t}$$

Now L.H.S. is equal to $\frac{d(Be^{bt})}{dt}$

Hence, $$Be^{bt}=aA_0\int e^{(b-a)t}dt=aA_0\frac{e^{(b-a)t}}{(b-a)}+k\tag{k is some constant}$$ which gives $B=aA_0\frac{e^{-at}}{(b-a)}+ke^{-bt}$

Now, if we add three ODE's, we have, $$\frac{d(A+B+C)}{dt}=0\implies A+B+C=c_0\tag{c_0 is some constant}$$

Now put $A,B$ to get $C$

-
$\frac{dB}{dt}e^{bt}+bBe^{bt}=aA_oe^{-at}e^{bt}$? and then? thanks for your help! – sunrise Jun 23 '13 at 8:59
good answer, +1 but "put it in 3rd equation to get $C(t)$" is not the best way to find $C$. – user67133 Jun 23 '13 at 9:11
Thanks a lot!! Could you tell me why the result seems to be $B=A_0\frac{a}{b-a}[e^{-at}-e^{-bt}]$? – sunrise Jun 23 '13 at 9:18
@user01123581321345589144... is this the best way?? :) – Aang Jun 23 '13 at 9:22
yes, it's exactly what I wrote in the comment below :D – user67133 Jun 23 '13 at 9:35

If you solve the first two equations as Avatar suggested you don't really need to substitute into $(3)$ to find $C$ since $(1) + (2) + (3)$ gives $$\frac{d}{dt}(A+B+C) = \frac{dA}{dt} + \frac{dB}{dt} + \frac{dC}{dt} = 0 \Longleftrightarrow A + B + C = \text{const} \Longleftrightarrow C = \text{const} - A - B.$$

-

In general, when you have a generic set of $N$ linear differential equation of $N$ independent variables, there is a standard methods to solve it. As said before, this method work, even in those situation in which there is no evidence of suitable simplification (i.e. $\dot{A}+\dot{B}+\dot{C}=0$).

First of all, you have to pass to a matricial description of your system.

Let $X(t) = [A(t) ~ B(t) ~ C(t)]^T$ the solution vector. Then $\dot{X}(t) = [\dot{A}(t) ~ \dot{B}(t) ~ \dot{C}(t)]^T$. We want to find a matricial (linear) relationship between $X(t)$ and $\dot{X}(t)$. This relationship is represented by matrix $F$ defined as follows: $$F = \left[\begin{array}{ccc}-a & 0 & 0\\a & -b & 0\\0 & b & 0\end{array}\right]$$

So we can write that $\dot{X} = FX$. An important result in this field, is that the solution is the following: $$X(t) = e^{Ft}X(0)$$ where $e^{Ft}$ is the exponential of the matrix $Ft$.

Calculation of $e^{Ft}$ is based upon the eigenvalues-eigenvectors calculus of matrix $F$. In particular, let $F = VDV^{-1}$ the diagonalisation of $F$, where $D$ is a diagonal matrix which diagonal entries are the eigenvalues of $F$, and $V$ is constructed, by column, with the eigenvectors of $F$. For the particular $F$, we have that:

$$D = \left[\begin{array}{ccc}0 & 0 & 0\\0 & -b & 0\\0 & 0 & -a\end{array}\right]$$

$$V = \left[\begin{array}{ccc}0 & 0 & \frac{a-b}{b}\\0 & -1 & -\frac{a}{b}\\1 & 1 & 1\end{array}\right]$$

We know that $e^{Ft} = Ve^{Dt}V^{-1}$. Since $D$ is diagonal, then

$$e^{Dt} = \left[\begin{array}{ccc}e^{0\cdot t} & 0 & 0\\0 & e^{-bt} & 0\\0 & 0 & e^{-at}\end{array}\right] = \left[\begin{array}{ccc}1 & 0 & 0\\0 & e^{-bt} & 0\\0 & 0 & e^{-at}\end{array}\right]$$

Finally, solution is obtained by calculating $X(t) = e^{Ft}X(0) = Ve^{Dt}V^{-1}X(0)$

Solution is the following: $$X(t) = \left[\begin{array}{c} A(0)e^{-at}\\ B(0)e^{-bt} - \frac{aA(0)}{a-b}(e^{-at} - e^{-bt})\\ A(0) + C(0) - B(0)(e^{-bt} - 1) + \frac{A(0)}{a-b}\left( be^{-at}-ae^{-bt}\right) \end{array}\right]$$

(Hope that results are good, sorry for calculus mistakes!!!)

-