Solving linear differential equations: Easy steps
Illustrative Example 01:
Solution:
At first, we apply \mathscr{L} to the differential equation:
\mathscr{L}\{y'-y\}=\mathscr{L}\{1\}
And since \mathscr{L} is linear, then
\mathscr{L}\{y'\}-\mathscr{L}\{y\}=\mathscr{L}\{1\}
If \mathscr{L}\{y(t)\}=Y(s), then from Laplace transform of derivatives, we have:
\mathscr{L}\{y'\}s=Y(s)-y(0)
and
\displaystyle\mathscr{L}\{1\}=\frac{1}{s}
as proven in this post. So, the equation becomes:
\begin{aligned} & sY(s)-\overbrace{y(0)}^{0}-Y(s)=\frac{1}{s} \\ & sY(s)-Y(s)=\frac{1}{s} \end{aligned}
i.e., we now have an algebric equation in Y(s):
\begin{aligned} & (s-1)Y(s)=\frac{1}{s} \\ & Y(s)=\frac{1}{s(s-1)} \end{aligned}
Thus, the solution of the differential equation y(t) is such that its Laplace transform is
\displaystyle Y(s)=\frac{1}{s(s-1)}
However, we realize we are not able to find in the table any function that satisfies it. The idea is to turn Y(s) into a sum/difference of two (or more) functions. To do so, we decompose it into partial fractions.
Since s and s-1 are both linear, there are unique real constants A and B such that:
\displaystyle\frac{1}{s(s-1)}=\frac{A}{s}+\frac{B}{s-1}
which gives us
\displaystyle\frac{1}{s(s-1)}=\frac{A(s-1)+Bs}{s(s-1)}
Once the denominators are identical, and so are the numerators:
\begin{aligned} & 1=A(s-1)+Bs \\ & 1=As-A+Bs \\ & 1=(A+B)s-A \end{aligned}
When we compare the coefficients of powers of s, we get the linear system in A and B:
\left\{\begin{array}{l} A+B=0 \\ -A=1 \end{array}\right.
From the last equation
A=-1
and when we substitute A in the first equation, we have
-1+B=0\Rightarrow B=1
Hence
\displaystyle Y(s)=\frac{1}{s(s-1)}=-\frac{1}{s}+\frac{1}{s-1}
and then
\displaystyle y(t)=\mathscr{L}^{-1}\left\{-\frac{1}{s}+\frac{1}{s-1}\right\}=-\mathscr{L}^{-1}\left\{\frac{1}{s}\right\}+\mathscr{L}^{-1}\left\{\frac{1}{s-1}\right\}
As
\displaystyle\mathscr{L}^{-1}\left\{\frac{1}{s}\right\}=1
and since
\displaystyle\mathscr{L}^{-1}\left\{\frac{1}{s-a}\right\}=e^{at}
so, for a=1, we get
\displaystyle\mathscr{L}^{-1}\left\{\frac{1}{s-1}\right\}=e^{1t}
Therefore, the solution of the initial-value problem:
\left\{\begin{array}{l} y'-y=1 \\ y(0)=0 \end{array}\right.
is the function:
y(t)=-1+e^{t}
Illustrative Example 02:
Solution:
Since
\displaystyle\mathscr{L}\{\cos(at)\}=\frac{s}{s^{2}+a^{2}}
then for a=1, we have
\displaystyle\mathscr{L}\{\cos(t)\}=\frac{s}{s^{2}+1^{2}}=\frac{s}{s^{2}+1}
Now, applying \mathscr{L}:
\begin{aligned} & \mathscr{L}\{y''-2y'+2y\}=\mathscr{L}\{\cos(t)\} \\ & \mathscr{L}\{y''\}-2\mathscr{L}\{y'\}+2\mathscr{L}\{y\}=\mathscr{L}\{\cos(t)\} \\ & s^{2}Y(s)-sy(0)-y'(0)-2(sY(s)-y(0))+2Y(s)=\frac{s}{s^{2}+1} \end{aligned}
From the initial values:
\begin{aligned} & s^{2}Y(s)-s\cdot1-0-2(sY(s)-1)+2Y(s)=\frac{s}{s^{2}+1} \\ & s^{2}Y(s)-s-2sY(s)+2+2Y(s)=\frac{s}{s^{2}+1} \end{aligned}
And solving the algebraic equation for Y(s), we get:
\begin{aligned}& s^{2}Y(s)-2sY(s)+2Y(s)=\frac{s}{s^{2}+1}+s-2 \\ & (s^{2}-2s+2)Y(s)=\frac{s}{s^{2}+1}+s-2 \\ & Y(s)=\frac{s}{(s^2-2s+2)(s^2+1)}+\frac{s-2}{s^{2}-2s+2} \end{aligned}
We have to decompose Y(s) via partial fractions. As
s^{2}-2s+2\qquad\text{and}\qquad s^{2}+1
cannot be factored into binomials, there are then unique A,B,C,D\in\mathbb{R} such that
\displaystyle\frac{s}{(s^2-2s+2)(s^2+1)}=\frac{As+B}{s^{2}-2s+2}+\frac{Cs+D}{s^{2}+1}
which gives us
\begin{aligned} \frac{s}{(s^2-2s+2)(s^2+1)} & = \frac{(As+B)(s^{2}+1)+(Cs+D)(s^{2}-2s+2)}{(s^{2}-2s+2)(s^2+1)} \\ & = \frac{As^{3}+As+Bs^{2}+B}{(s^{2}-2s+2)(s^{2}+1)} \\ & +\frac{Cs^{3}-2Cs^{2}+2Cs+Ds^{2}-2Ds+2D}{(s^{2}-2s+2)(s^{2}+1)} \end{aligned}As we combine the powers of s, we may rearrange as follows
\begin{aligned} \frac{s}{(s^{2}-2s+2)(s^{2}+1)} &=\frac{(A+C)s^{3}+(B-2C+D)s^{2}}{(s^{2}-2s+2)(s^{2}+1)} \\ &+\frac{(A+2C-2D)s+(B+2D)}{(s^{2}-2s+2)(s^{2}+1)} \end{aligned}
And like we did in the last example, the numerators must be equal. From this, we have the linear system:
\left\{\begin{array}{l} A+C=0 \\ B-2C+D=0 \\ A+2C-2D=1 \\ B+2D=0 \end{array}\right.
In the first equation:
A+C=0\Rightarrow A+C+C=C\Rightarrow A+2C=C
and substituting it in the third equation, we have
\begin{aligned} & A+2C-2D=1 \\ & C-2D=1 \end{aligned}
As we subtract the fourth equation from the second one, we get
-2C-D=0
Thus, now there is a linear system in C and D:
\left\{\begin{array}{l} C-2D=1 \\ -2C-D=0 \end{array}\right.
From the last equation:
D=-2C
and when we substitute it in the other one, we are able to find the value of C:
\displaystyle C+4C=1\Rightarrow C=\frac{1}{5}
So
\displaystyle D=-\frac{2}{5}
In the equality
A+C=0
we may conclude
\displaystyle A=-C\Rightarrow A=-\frac{1}{5}
Also
\displaystyle B=-2D\Rightarrow B=\frac{4}{5}
Thus
\displaystyle \frac{s}{(s^{2}-2s+2)}=\dfrac{-\dfrac{1}{5}s+\dfrac{4}{5}}{s^{2}-2s+2}+\dfrac{\dfrac{1}{5}s-\dfrac{2}{5}}{s^{2}+1}
which may be written as
\begin{aligned} \frac{s}{(s^{2}-2s+2)} & =\frac{1}{5}\left(\frac{-s+4}{s^{2}-2s+2}+\frac{s-2}{s^{2}+1}\right) \\ & =\frac{1}{5}\left(\frac{-s+4}{s^2-2s+2}+\frac{s}{s^{2}+1}-\frac{2}{s^2+1}\right) \end{aligned}
The second fraction in the expression of Y(s) above cannot be decomposed via partial fractions. Then, we have:
\displaystyle Y(s)=\frac{1}{5}\left(\frac{-s+4}{s^2-2s+2}+\frac{s}{s^{2}+1}-\frac{2}{s^2+1}\right)+\frac{s-2}{s^2-2s+2}
i.e.,
\displaystyle y(t)=\mathscr{L}^{-1}\left\{\frac{1}{5}\left(\frac{-s+4}{s^2-2s+2}+\frac{s}{s^{2}+1}-\frac{2}{s^2+1}\right)+\frac{s-2}{s^2-2s+2}\right\}
and from the linearity of the inverse Laplace transform
\begin{aligned} y(t) &=\frac{1}{5}\mathscr{L}^{-1}\left\{\frac{-s+4}{s^2-2s+2}\right\}+\frac{1}{5}\mathscr{L}^{-1}\left\{\frac{s}{s^{2}+1}\right\} \\ &-\frac{1}{5}\mathscr{L}^{-1}\left\{\frac{2}{s^{2}+1}\right\}+\mathscr{L}^{-1}\left\{\frac{s-2}{s^{2}-2s+2}\right\} \end{aligned}
As
\displaystyle \mathscr{L}^{-1}\left\{\frac{s-a}{(s-a)^{2}+b^{2}}\right\}=e^{at}\cos(bt)
we have to rewrite the first and the fourth fractions such that it appears a square of sum/difference of two terms. Note that
s^{2}-2s+2=s^{2}-2\cdot s\cdot1+2
and since 2=1+1 and clearly, 1=1^{2}, we get
s^{2}-2s+2=s^{2}-2\cdot s\cdot1+1^{2}+1=(s-1)^{2}+1^{2}
Comparing the last result with the formula of Laplace inverse above, we have
a=1,\qquad b=1
Hence, we may rewrite the fractions as follows
\begin{aligned} \frac{-s+4}{s^2-2s+2} & =-\frac{s-4}{s^2-2s+2} \\ & =-\frac{s-1-3}{(s-1)^{2}+1^{2}} \\ & =-\frac{s-1}{(s-1)^{2}+1^{2}}-\frac{-3}{(s-1)^{2}+1^{2}} \\ & =-\frac{s-1}{(s-1)^{2}+1^{2}}+\frac{3}{(s-1)^{2}+1^{2}} \end{aligned}
and
\begin{aligned} \frac{s-2}{s^2-2s+2} &=\frac{s-1-1}{s^2-2s+2} \\ &=\frac{s-1}{(s-1)^{2}+1^{2}}-\frac{1}{(s-1)^{2}+1^{2}} \end{aligned}
We also know
\displaystyle \mathscr{L}^{-1}\left\{\frac{b}{(s-a)^{2}+b^{2}}\right\}=e^{at}\sin(bt)
then
\begin{aligned} \mathscr{L}^{-1}\left\{\frac{-s+4}{s^2-2s+2}\right\} & =-\mathscr{L}^{-1}\left\{\frac{s-1}{(s-1)^{2}+1^{2}}\right\}+3\cdot\mathscr{L}^{-1}\left\{\frac{1}{(s-1)^{2}+1^{2}}\right\} \\ & =-e^{1t}\cos(1t)+3e^{1t}\sin(1t) \end{aligned}
and
\begin{aligned} \mathscr{L}^{-1}\left\{\frac{s-2}{s^2-2s+2}\right\} & =\mathscr{L}^{-1}\left\{\frac{s-1}{(s-1)^{2}+1^{2}}\right\}-\mathscr{L}^{-1}\left\{\frac{1}{(s-1)^{2}+1^{2}}\right\} \\ & =e^{1t}\cos(1t)-e^{1t}\sin(1t) \end{aligned}
From the table of Laplace transforms:
\displaystyle \mathscr{L}^{-1}\left\{\frac{s}{s^{2}+b^{2}}\right\}=\cos(bt),\quad\mathscr{L}^{-1}\left\{\frac{b}{s^{2}+b^{2}}\right\}=\sin(bt)
Therefore, for b=1
\displaystyle \mathscr{L}^{-1}\left\{\frac{s}{s^2+1}\right\}=\cos(1t)
and also
\begin{aligned} \mathscr{L}^{-1}\left\{\frac{2}{s^2+1}\right\} & =2\cdot\mathscr{L}^{-1}\left\{\frac{1}{s^2+1^2}\right\} \\ & =2\cdot\sin(1t) \end{aligned}
Thus
\begin{aligned} & y(t)=\frac{1}{5}(-e^{t}\cos(t)+3e^{t}\sin(t))+\frac{1}{5}\cos(t)-\frac{1}{5}\cdot2\sin(t)+e^{t}\cos(t)-e^{t}\sin(t) \\ & y(t)=-\frac{e^{t}\cos(t)}{5}+\frac{3e^{t}\sin(t)}{5}+\frac{\cos(t)}{5}-\frac{2\sin(t)}{5}+e^{t}\cos(t)-e^{t}\sin(t) \end{aligned}
Hence, the solution of the 2nd order differential equation:
\left\{\begin{array}{l} y''-2y'+2y=\cos(t), \\ y(0)=1, \\ y'(0)=0 \end{array}\right.
is given by:
\displaystyle y(t)=\frac{4e^{t}\cos(t)}{5}-\frac{2e^{t}\sin(t)}{5}+\frac{\cos(t)}{5}-\frac{2\sin(t)}{5}