Krista King Math | Online math help

View Original

Solving differential equation initial value problems with step functions as forcing functions

Four steps to solve an initial value problem when the forcing function is a step function

Sometimes we’ll be given a differential equation in which the forcing function is a step function or includes a step function, and we’ll be asked to solve an initial value problem with the differential equation.

Solving the initial value problem

In general, to solve the initial value problem, we’ll follow these steps:

  1.  Make sure the forcing function is being shifted correctly, and identify the function being shifted.

  2.  Apply a Laplace transform to each part of the differential equation, substituting initial conditions to simplify.

  3.  Solve for ???Y(s)???.

  4.  Apply an inverse transform to find ???y(t)???.

As a reminder, when we apply the Laplace transform to the equation in step 2, we’ll often need these transform formulas:

???\mathcal{L}(u_c(t))=\mathcal{L}(u(t-c))=\frac{e^{-cs}}{s}??? (Heaviside function)

???\mathcal{L}(u_c(t)f(t-c))=e^{-cs}F(s)???

???\mathcal{L}(u_c(t)g(t))=e^{-cs}\mathcal{L}(g(t+c))???

Let’s do an example so that we can see how to apply this process to solve an initial value problem when we have a step function in the forcing function.

Solving second-order differential equation initial value problems with step functions as the forcing function


Take the course

Want to learn more about Differential Equations? I have a step-by-step course for that. :)


Example where we rewrite the forcing function

Example

Solve the initial value problem, given ???y(0)=1??? and ???y'(0)=0???.

???y''+4y'=(\sin{t})u(t-2\pi)???

The forcing function could also be written as

???g(t)=\begin{cases}0 \quad\quad 0\le t<2\pi\\ \sin{t} \quad t\ge 2\pi\end{cases}???

Because the step function shows ???c=2\pi???, we need ???f(t)=\sin{t}??? to include a shift of ???2\pi??? as well. We can fix the shift using

???\mathcal{L}(u_c(t)g(t))=e^{-cs}\mathcal{L}(g(t+c))???

So we’ll find

???g(t+2\pi)???

???\sin{(t+2\pi)}???

By the trigonometric identity ???\sin(\theta+\alpha)=\sin\theta\cos\alpha+\cos\theta\sin\alpha???, we can rewrite our sine function as

???\sin{t}\cos{(2\pi)}+\cos{t}\sin{(2\pi)}???

???\sin{t}(1)+\cos{t}(0)???

???\sin{t}???

Then using the Laplace transforms of ???\sin{t}??? and the step function on the right side, the transformed equation becomes

???\mathcal{L}(y'')+4\mathcal{L}(y')=\mathcal{L}(\sin{t}(u(t-2\pi)))???

???s^2Y(s)-sy(0)-y'(0)+4(sY(s)-y(0))=\frac{1}{s^2+1}e^{-2\pi s}???

Substitute the initial conditions ???y(0)=1??? and ???y'(0)=0???, then solve for ???Y(s)???.

???s^2Y(s)-s+4sY(s)-4=\frac{1}{s^2+1}e^{-2\pi s}???

???(s^2+4s)Y(s)-s-4=\frac{1}{s^2+1}e^{-2\pi s}???

???(s^2+4s)Y(s)=s+4+\frac{1}{s^2+1}e^{-2\pi s}???

???Y(s)=\frac{s+4}{s^2+4s}+\frac{1}{(s^2+1)(s^2+4s)}e^{-2\pi s}???

???Y(s)=\frac{s+4}{s(s+4)}+\frac{1}{s(s^2+1)(s+4)}e^{-2\pi s}???

???Y(s)=\frac{1}{s}+\frac{1}{s(s^2+1)(s+4)}e^{-2\pi s}???

Let’s apply a partial fractions decomposition.

???\frac{1}{s(s^2+1)(s+4)}=\frac{A}{s}+\frac{B}{s+4}+\frac{Cs+D}{s^2+1}???

To solve for ???A???, we’ll remove the factor of ???s??? from the denominator on the left side, then set ???s=0???.

???\frac{1}{(s^2+1)(s+4)}???

???\frac{1}{(0^2+1)(0+4)}=\frac{1}{(1)(4)}=\frac{1}{4}???

To solve for ???B???, we’ll remove the factor of ???s+4??? from the denominator on the left side, then set ???s=-4???.

???\frac{1}{s(s^2+1)}???

???\frac{1}{-4((-4)^2+1)}=\frac{1}{-4(17)}=-\frac{1}{68}???

To find ???C??? and ???D???, we’ll expand multiply through both sides of the decomposition equation by the denominator from the left side.

???1=A(s^2+1)(s+4)+Bs(s^2+1)+(Cs+D)s(s+4)???

???1=As^3+4As^2+As+4A+Bs^3+sB+Cs^3+4Cs^2+Ds^2+4Ds???

Substitute the values ???A=1/4??? and ???B=-1/68??? that we already found.

???1=\left(\frac14-\frac{1}{68}+C\right)s^3+\left(4\left(\frac14\right)+4C+D\right)s^2+\left(\frac14-\frac{1}{68}+4D\right)s+4\left(\frac14\right)???

???1=\left(\frac{4}{17}+C\right)s^3+\left(1+4C+D\right)s^2+\left(\frac{4}{17}+4D\right)s+1???

Then equating coefficients gives 

???\frac{4}{17}+C=0??? so ???C=-\frac{4}{17}???

???D=-\frac{1}{17}???

Plugging ???A=1/4???, ???B=-1/68???, ???C=-4/17???, and ???D=-1/17??? into the decomposition gives

???\frac{1}{s(s^2+1)(s+4)}=\frac14\left(\frac{1}{s}\right)-\frac{1}{68}\left(\frac{1}{s+4}\right)+\frac{-\frac{4}{17}s-\frac{1}{17}}{s^2+1}???

???\frac{1}{s(s^2+1)(s+4)}=\frac14\left(\frac{1}{s}\right)-\frac{1}{68}\left(\frac{1}{s+4}\right)-\frac{1}{17}\left(\frac{4s+1}{s^2+1}\right)???

So ???Y(s)??? is

???Y(s)=\frac{1}{s}+\left(\frac14\left(\frac{1}{s}\right)-\frac{1}{68}\left(\frac{1}{s+4}\right)-\frac{1}{17}\left(\frac{4s+1}{s^2+1}\right)\right)e^{-2\pi s}???

???Y(s)=\frac{1}{s}+\frac14\left(\frac{1}{s}\right)e^{-2\pi s}-\frac{1}{68}\left(\frac{1}{s+4}\right)e^{-2\pi s}-\frac{1}{17}\left(\frac{4s+1}{s^2+1}\right)e^{-2\pi s}???

???Y(s)=\frac{1}{s}+\frac14\left(\frac{1}{s}\right)e^{-2\pi s}-\frac{1}{68}\left(\frac{1}{s+4}\right)e^{-2\pi s}-\frac{1}{17}\left(\frac{4s}{s^2+1}+\frac{1}{s^2+1}\right)e^{-2\pi s}???

???Y(s)=\frac{1}{s}+\frac14\left(\frac{1}{s}\right)e^{-2\pi s}-\frac{1}{68}\left(\frac{1}{s+4}\right)e^{-2\pi s}???

???-\frac{4}{17}\left(\frac{s}{s^2+1}\right)e^{-2\pi s}-\frac{1}{17}\left(\frac{1}{s^2+1}\right)e^{-2\pi s}???

Then with the inverse transform formula ???\mathcal{L}^{-1}{(e^{-cs}F(s))}=f(t-c)u(t-c)??? that we looked at earlier, the inverse transform is

???y(t)=1+\frac14(1)u(t-2\pi)-\frac{1}{68}(e^{-4(t-2\pi)})u(t-2\pi)???

???-\frac{4}{17}\cos{(t-2\pi)}u(t-2\pi)-\frac{1}{17}\sin{(t-2\pi)}u(t-2\pi)???

???y(t)=1+\frac14u(t-2\pi)-\frac{1}{68}e^{-4t+8\pi}u(t-2\pi)???

???-\frac{4}{17}\cos{(t-2\pi)}u(t-2\pi)-\frac{1}{17}\sin{(t-2\pi)}u(t-2\pi)???


Let’s do another example with an initial value problem.


Example

Solve the initial value problem, given ???y(0)=0??? and ???y'(0)=-1???.

???y''+2y'=1+(t-1)u_3(t)???

Remember that each function must be shifted by the appropriate amount. Getting things set up for the proper shifts gives us

???f(t)=1+(t-1)u_3(t)???

???f(t)=1+(t-3+3-1)u_3(t)???

???f(t)=1+(t-3+2)u_3(t)???

So for the Heaviside function, it looks like ???g(t)=t+2??? is the function being shifted. Then the transformed equation will be

???\mathcal{L}(y'')+2\mathcal{L}(y')=\mathcal{L}(1)+\mathcal{L}((t-3+2)u_3(t))???

???s^2Y(s)-sy(0)-y'(0)+2(sY(s)-y(0))=\frac{1}{s}+e^{-3s}\left(\frac{1}{s^2}+\frac2s\right)???

Substitute the initial conditions ???y(0)=0??? and ???y'(0)=-1???, then solve for ???Y(s)???.

???s^2Y(s)+1+2sY(s)=\frac{1}{s}+e^{-3s}\left(\frac{1}{s^2}+\frac2s\right)???

???(s^2+2s)Y(s)+1=\frac{1}{s}+e^{-3s}\left(\frac{1}{s^2}+\frac2s\right)???

???(s^2+2s)Y(s)=\frac{1}{s}+e^{-3s}\frac{1}{s^2}+e^{-3s}\frac2s-1???

???Y(s)=\frac{1}{s(s^2+2s)}+e^{-3s}\frac{1}{s^2(s^2+2s)}+e^{-3s}\frac{2}{s(s^2+2s)}-\frac{1}{s^2+2s}???

???Y(s)=\frac{1}{s^2(s+2)}+2e^{-3s}\frac{1}{s^2(s+2)}+e^{-3s}\frac{1}{s^3(s+2)}-\frac{1}{s(s+2)}???

Apply a partial fractions decomposition to the first fraction, which is the same decomposition we’ll use for the second fraction.

???\frac{1}{s^2(s+2)}=\frac{A}{s}+\frac{B}{s^2}+\frac{C}{s+2}???

To find ???C???, remove the factor of ???s+2??? from the left side, then substitute ???s=-2???.

???\frac{1}{s^2}\to\frac{1}{(-2)^2}\to\frac{1}{4}???

To find ???B???, remove the factor of ???s^2??? from the left side, then substitute ???s=0???.

???\frac{1}{s+2}\to\frac{1}{0+2}\to\frac{1}{2}???

To find ???A???, substitute ???B=1/2??? and ???C=1/4???, and any value we haven’t already used for ???s???. We’ve already used ???s=-2,\ 0???, so we’ll choose ???s=1???.

???\frac{1}{1^2(1+2)}=\frac{A}{1}+\frac{\frac12}{1^2}+\frac{\frac14}{1+2}???

???\frac{1}{3}=A+\frac12+\frac{1}{12}???

???A=\frac{4}{12}-\frac{6}{12}-\frac{1}{12}???

???A=-\frac14???

So the decomposition is

???\frac{1}{s^2(s+2)}=\frac{-\frac14}{s}+\frac{\frac12}{s^2}+\frac{\frac14}{s+2}???

Replacing the first and second fractions in ???Y(s)??? with this decomposition gives

???Y(s)=\frac{-\frac14}{s}+\frac{\frac12}{s^2}+\frac{\frac14}{s+2}+2e^{-3s}\left(\frac{-\frac14}{s}+\frac{\frac12}{s^2}+\frac{\frac14}{s+2}\right)???

???+e^{-3s}\frac{1}{s^3(s+2)}-\frac{1}{s(s+2)}???

Apply a partial fractions decomposition to the third fraction.

???\frac{1}{s^3(s+2)}=\frac{A}{s}+\frac{B}{s^2}+\frac{C}{s^3}+\frac{D}{s+2}???

To find ???D???, remove the factor of ???s+2??? from the left side, then substitute ???s=-2???.

???\frac{1}{s^3}\to\frac{1}{(-2)^3}\to-\frac{1}{8}???

To find ???C???, remove the factor of ???s^3??? from the left side, then substitute ???s=0???.

???\frac{1}{s+2}\to\frac{1}{0+2}\to\frac{1}{2}???

To find ???A??? and ???B???, multiply through both sides of the decomposition by the denominator from the left side.

???1=As^2(s+2)+Bs(s+2)+C(s+2)+Ds^3???

Substitute the values ???C=1/2??? and ???D=-1/8??? that we already found.

???1=As^2(s+2)+Bs(s+2)+\frac12(s+2)-\frac18s^3???

???1=As^3+2As^2+Bs^2+2Bs+\frac12s+1-\frac18s^3???

???1=\left(A-\frac18\right)s^3+(2A+B)s^2+\left(2B+\frac12\right)s+1???

???0=\left(A-\frac18\right)s^3+(2A+B)s^2+\left(2B+\frac12\right)s???

Equate coefficients from the first and third terms to find ???A??? and ???B???.

So the decomposition is

???\frac{1}{s^3(s+2)}=\frac{\frac18}{s}+\frac{-\frac14}{s^2}+\frac{\frac12}{s^3}+\frac{-\frac18}{s+2}???

Replacing the third fraction in ???Y(s)??? with this decomposition gives

???Y(s)=\frac{-\frac14}{s}+\frac{\frac12}{s^2}+\frac{\frac14}{s+2}+2e^{-3s}\left(\frac{-\frac14}{s}+\frac{\frac12}{s^2}+\frac{\frac14}{s+2}\right)???

???+e^{-3s}\left(\frac{\frac18}{s}+\frac{-\frac14}{s^2}+\frac{\frac12}{s^3}+\frac{-\frac18}{s+2}\right)-\frac{1}{s(s+2)}???

Apply a partial fractions decomposition to the fourth fraction.

???\frac{1}{s(s+2)}=\frac{A}{s}+\frac{B}{s+2}???

To find ???B???, remove the factor of ???s+2??? from the left side, then substitute ???s=-2???.

???\frac{1}{s}\to-\frac{1}{2}???

To find ???A???, remove the factor of ???s??? from the left side, then substitute ???s=0???.

???\frac{1}{s+2}\to\frac{1}{0+2}\to\frac{1}{2}???

So the decomposition is

???\frac{1}{s(s+2)}=\frac{\frac12}{s}+\frac{-\frac12}{s+2}???

Replacing the fourth fraction in ???Y(s)??? with this decomposition gives

???Y(s)=\frac{-\frac14}{s}+\frac{\frac12}{s^2}+\frac{\frac14}{s+2}+2e^{-3s}\left(\frac{-\frac14}{s}+\frac{\frac12}{s^2}+\frac{\frac14}{s+2}\right)???

???+e^{-3s}\left(\frac{\frac18}{s}+\frac{-\frac14}{s^2}+\frac{\frac12}{s^3}+\frac{-\frac18}{s+2}\right)-\left(\frac{\frac12}{s}+\frac{-\frac12}{s+2}\right)???

???Y(s)=-\frac14\left(\frac{1}{s}\right)+\frac12\left(\frac{1}{s^2}\right)+\frac14\left(\frac{1}{s+2}\right)???

???-\frac12e^{-3s}\left(\frac{1}{s}\right)+e^{-3s}\left(\frac{1}{s^2}\right)+\frac12e^{-3s}\left(\frac{1}{s+2}\right)???

???+\frac18e^{-3s}\left(\frac{1}{s}\right)-\frac14e^{-3s}\left(\frac{1}{s^2}\right)+\frac12e^{-3s}\left(\frac{1}{s^3}\right)-\frac18e^{-3s}\left(\frac{1}{s+2}\right)???

???-\frac12\left(\frac{1}{s}\right)+\frac12\left(\frac{1}{s+2}\right)???

Then with the inverse transform formula ???\mathcal{L}^{-1}{(e^{-cs}F(s))}=f(t-c)u(t-c)??? that we looked at earlier, the inverse transform is

???y(t)=-\frac14(1)+\frac12(t)+\frac14(e^{-2t})???

???-\frac12u_3(t)(1)+u_3(t)(t-3)+\frac12u_3(t)e^{-2(t-3)}???

???+\frac18u_3(t)(1)-\frac14u_3(t)(t-3)+\frac{1}{2(2!)}u_3(t)(t-3)^2-\frac18u_3(t)e^{-2(t-3)}???

???-\frac12(1)+\frac12(e^{-2t})???

???y(t)=-\frac14+\frac12t+\frac14e^{-2t}???

???-\frac12u_3(t)+u_3(t)(t-3)+\frac12u_3(t)e^{6-2t}???

???+\frac18u_3(t)-\frac14u_3(t)(t-3)+\frac{1}{4}u_3(t)(t-3)^2-\frac18u_3(t)e^{6-2t}???

???-\frac12+\frac12e^{-2t}???

???y(t)=\frac34e^{-2t}+\frac12t-\frac34+u_3(t)\left(\frac38e^{6-2t}+\frac{1}{4}t^2-\frac34t-\frac{3}{8}\right)???



Get access to the complete Differential Equations course