% SIMIODE-TeacherStudent-Template.tex and simiode.cls for LaTeX2e
% Version 22 November 2016.
% 
% This template is to be used with the  class file "simiode.cls". 
%  
% The latest version of this class and template files 
% can be found at
% 
%       <http://www.SIMIODE.org> in the Author section.
%
% A "Quick Start Guide" appears below.
%
% This file must be processed with version LaTeX2e or higher.
% Appreciation to Mark Frantz, IUPUI; John Thoo, Yuba College; and Eric Sullivan, Carroll College.
%
\documentclass{simiode}
%
% With this version of the tex file and the associated SIMIODE.cls file you can produce BOTH a Student Version and a Teacher Version of your modeling scenario or technique narrative.
%
% Student Version contains the title STUDENT VERSION along with the NAME OF SCENARIO, with no abstract, no keywords, no tags, no author identifiers, and no COMMENTS section. The Student Version contains only the STATEMENT of the modeling scenario only with appropriate figures, data, instructions, and perhaps a bibliography appropriate for student resourcing, but nothing in the bibliography which would "give away" the nature of the modeling scenario, etc.
%
%The Teacher Version contains the material in the Student Version, namely the title NAME OF SCENARIO, now headed with   TEACHER VERSION, but also full author  identification, abstract, key words, tag words, and, following the STATEMENT, a section of COMMENTS which can be discussion of presentation  ideas, "solutions," techniques, etc.
%
% Authors can prepare a full Teacher Version using the notions immediately below  to create a pdf for review, but in review please eliminate all information about the author as we use a double-blind referee system. Such information will be restored when accepted and published in SIMIODE at www.simiode.org.
%
%***********   Toggle the following line to turn the teacher version on (1) or off (0). ***********
%
\def\TeacherEdition{0} % Toggle this line's value.
\newcommand{\teacher}[1]{\ifnum\TeacherEdition=1 #1 \fi}
%
% The \teacher{ } command wraps any text that will appear only in the teacher version of
% the document. See this file for examples. This has been done for you in the document below.   
% Rename the pdf after you compile each final version.
%
\usepackage{amsmath,amssymb}
\usepackage{color}
\usepackage{graphicx}
%\usepackage{hyperref}
\usepackage{url}
%
\renewcommand{\baselinestretch}{1.3}
%
% NOTE regarding macros %%
%
% Any macros defined for your paper should be contained in 
% the top matter. Likewise, any environment definitions such 
% as \newtheorem or \newenvironment should also go in the 
% top matter. 
% 
% Do not \input your macros as separate files within your 
% final version because more files make it harder for the 
% editors and users to keep track of and/or modify and 
% append your paper.
%
% Top matter is above and the beginning of the document below.
%
\begin{document}

\newpage
%
% You only need to change the NAME OF SCENARIO in the next line and delete the footnote. 
% See above for instructions on toggling from Teacher Version to Student Version.
%
\title{\ifnum\TeacherEdition=1 TEACHER VERSION \else STUDENT VERSION \fi\\Inegrating Factor}


\markboth{Integrating Factor}{Integrating Factor}






\author{Brian Winkel\\Director 
SIMIODE\\
Chardon OH 44024 USA\\
BrianWinkel@simiode.org
}

\makeStitlePDFLaTex


\begin{abstract}
We develop a strategy to solve first order differential equations by transforming one side of the equation to the derivative of a product of two functions, thereby making it easy to antidifferentiate that side. We then have to face the other side of our modified differential equation and this still could be difficult or impossible  to antidifferentiate. 
Despite this, the method works for a number of differential equations which are reasonable models of phenomena. 
\end{abstract}





\section*{INTRODUCTION}

We develop and discuss  a strategy  to solve first order, ordinary differential equations using a technique based on the product rule for differentiation. It is called {\it integrating factor}.   Basically we build a function (called an {\it integrating factor\/}) with which we multiply both sides of our differential equation we wish to solve so that one side looks just like the derivative of a product of two functions.  This makes one side of the differential equation easy to anti-differentiate, but we have to address   the other side of the differential equation which we just multiplied by the integrating factor.  There are modeling situations  which lead to such equations and we use one involving electrical circuits to motivate the method.

We shall show how differential equations can be used to model simple electrical circuits which contain resistors ($R$), inductors ($L$), and capacitors ($C$) in which we model the current in the circuit $I(t)$ at time $t$ due to some impressed electromotive force (EMF) $E(t)$ or voltage $V(t)$.  We shall build the differential equation to model a simple circuit (one loop with a resistor, $R$, and an inductor, $L$) in which the current is moved along by an input voltage ${\rm Emf}(t) =  E(t)$ which creates a potential between a positive pole (anode) and a negative pole (cathode). Basically, the  anode of a circuit or device is a terminal (positively charged) where current flows in from an external source while the cathode of a circuit is the terminal (negatively charged) from which the current or electrons flows out.  For now, we ask you to accept this differential equation which describes the circuit and concentrate on our method and then join in with us as we interpret the results.  

In Figure~\ref{fig:IntFactor-RL-Circuit} we show a RL circuit:    

\begin{figure}[h]
\centering

\vspace*{-.1 true cm}
\includegraphics[width=9cm]{IntFactor-RL-Circuit.eps}


\vspace*{-7.7 true cm}
\parbox{12.1 true cm}{\caption{\label{fig:IntFactor-RL-Circuit} Electric circuit in which the current  $i = I(t)$ is flowing across a resistor $R$ measured in Ohms and an inductor $L$ measured in Henrys. The current is a flow of negative electrons. A switch is at the top and the indication is that at time $t=0$ we through the switch on, thus enabling the current to flow through the circuit.}}
\vspace*{-.3 true cm}    

\end{figure}


Here is the differential equation which we will show later models the current $I(t)$ going through the circuit containing a resistor, $R$, and an inductor, $L$:

\begin{equation}\label{eq:RLCircuit}
 L \frac{dI}{dt} + R\cdot I(t) = E(t) \, . 
\end{equation}

Just the visualization of (\ref{eq:RLCircuit}) hints (or begs, depending upon how well you remember your differentiation formulae) to be seen as the derivative of a product.  Look see in (\ref{eq:FirstRLCircuit}).

\begin{equation}\label{eq:FirstRLCircuit}
 \Large \overbrace{L \frac{dI}{dt} + R\cdot I(t)}^{{\rm looks \,\, like} \,\, u\cdot \frac{dv}{dt} + \frac{du}{dt}\cdot v}, = E(t) \, . 
\end{equation}

\noindent While this looks like a product rule on the left hand side it needs some help, so we shall multiply by an unknown function (to be determined in our process) to see if we can shape the left hand side into the derivative of a product. We shall also divide both sides of (\ref{eq:RLCircuit})  by $L$ to make the product rule more obvious.

This yields a modified differential equation (\ref{eq:ProdRLCircuit}):


\begin{equation}\label{eq:ProdRLCircuit}
\Large \overbrace{u(t) \frac{dI}{dt} + \frac{u(t) R}{L}\cdot I(t)}^{{\rm looks \,\, like} \,\, u\cdot \frac{dv}{dt} + \frac{du}{dt}\cdot v}, = \frac{u(t) E(t)}L \, . 
\end{equation}

Do you see the product rule now on the left hand side of (\ref{eq:ProdRLCircuit})?  If we identify $u = u(t)$ and  $\frac{du}{dt} = \frac{u(t) R}{L} = \frac{R}{L} u(t)$ then the latter equation says that if we can find a function $u(t)$ which satisfies this auxiliary differential equation (\ref{eq:aux}),

\begin{equation}\label{eq:aux}
\frac{du}{dt} = \frac{R}{L} u(t)\, .
\end{equation}
 all we have to do is integrate the left  and  right side of (\ref{eq:intForm}) and we will have solved for $u(t)\cdot I(t)$ This   is an easy step (through division of both sides by $u(t)$) from getting to our desired function, $I(t)$, for the current in our circuit:

\begin{equation}\label{eq:intForm}
 \frac{d (u(t)\cdot I(t))}{dt} = u(t) \frac{dI}{dt} + \frac{d u(t)}{dt} \cdot I(t) = \frac{u(t) E(t)}{L} \, . 
\end{equation}


Now let us actually solve our initial differential equation (\ref{eq:RLCircuit}) using its  new form (\ref{eq:intForm}). We simply integrate both sides to obtain (\ref{eq:intSidesForm})

\begin{equation}\label{eq:intSidesForm}
 u(t)\cdot 
I(t)  = \int \left(\frac{d (u(t)\cdot I(t))}{dt}\right)\, dt =  \int \left( \frac{u(t) E(t)}{L}\right) \, dt \, + c. 
\end{equation}
(Remember our constant of integration  which we will determine from our initial condition $I(0) = I_0$.)

Finally, if we divide both sides of (\ref{eq:intSidesForm}) by $u(t)$ we will have solved for $I(t)$ modulo finding out exactly what this mystery function, $u(t)$, is and our constant of integration, $c$. Thus we have our solution for $I(t)$ in (\ref{eq:ISolveForm})

\begin{equation}\label{eq:ISolveForm}
I(t)  =   \frac{1}{u(t)} \left(\int \left( \frac{u(t) E(t)}{L}\right) \, dt \, + c\right). 
\end{equation}

Let's go after this $u(t)$. As far as solving (\ref{eq:aux}) goes we  have been there and done that.  This is simply the exponential growth equation and we can solve it by separation of variable or Mathematica's {\tt DSolve} command. This means $u(t)$ is 

\vspace*{-.3 true cm}
\begin{equation}\label{eq:intFactor}
\large{u(t) = e^{\int \frac{R}{L} \, dt} = e^{\frac{R}{L} t}\, }.
\end{equation}
Since $u(t)$ is so integral (pardon the pun) to our process we shall call it the {\it integrating factor}, for as you see in  (\ref{eq:intForm})  this multiplication of both sides by our constructed $u(t)$ enables us to easily integrate the left hand side as the derivative of a product of two functions.

Thus, in our circuit differential equation, (\ref{eq:RLCircuit}), for $I(t)$, the current, has a solution (\ref{eq:intFactorSolver}):
\begin{equation}\label{eq:intFactorSolver}
I(t)  =   \frac{1}{e^{\frac{R}{L} t}} \left(\int \left( \frac{e^{\frac{R}{L} t} E(t)}{L}\right) \, dt \, + c\right). 
\end{equation}
Our solution (\ref{eq:intFactorSolver}) for $I(t)$  does look messy, but let us take it step by step.  We do  have to perform the integration and then use the initial condition  to find $c$. Of course, we will need a voltage input $E(t)$ if we are to proceed.

Let us take a simple case in which $E(t) = 5$ volts (a battery), $R = 100$ ohms, and $L = 0.02$ henrys. If we use these values in (\ref{eq:intFactorSolver}) we obtain:

\begin{equation}\label{eq:intFactorCase}
I(t)  =   \frac{1}{e^{\frac{100}{0.02} t}} \left(\int \left( \frac{e^{\frac{100}{0.02} t}\cdot  5}{.02}\right) \, dt \, + c\right) = e^{-5000. t} \left(0.05 e^{5000.
   t}+c\right)= 0.05 + c  e^{-5000. t}\, . 
\end{equation}
When we use a reasonable initial condition, namely $I(0) = 0$, for when the switch is first thrown the circuit has no current running through it, we can solve for $c = -0.05$. Thus, we finally have our solution to (\ref{eq:intFactorSolver}) in (\ref{eq:ISolve}):

\begin{equation}\label{eq:ISolve}
I(t) = 0.05\, -0.05 e^{-5000. t}\, .
\end{equation}

We render a plot of (\ref{eq:ISolve}) in Figure~\ref{fig:IntFactISolve}.



\begin{figure}[h]
\centering

\vspace*{-.1 true cm}
\includegraphics[width=12cm]{IntFactISolve.eps}



\parbox{13.1 true cm}{\caption{\label{fig:IntFactISolve} Plot of the solution to our differential equation (\ref{eq:RLCircuit}) using $E(t) = 5$ volts (a battery), $R = 100$ ohms,  $L = 0.02$ henrys, and initial condition of $I(0) = 0$ amps in the circuit.}}
\vspace*{-.3 true cm}
\end{figure}


Even with limited knowledge of circuits we can see the current quickly ramps up and arrives at a steady state of $I = 0.05$ amps.

\vspace*{.3 true cm}

If we were to get quite complicated with an integrating factor approach or use Mathematica's {\tt DSolve} we could consider an alternating voltage, say the one used in the United States at 110 volts with a frequency of 60 Hz (60 cycles per second), i.e., $E(t) = 110 \sin(2\cdot  \pi\cdot  60\cdot t)$ volts and $R = 100$ ohms,  $L = 0.02$ henrys with an initial current of $I(0) = 0$ amps we would be looking at the following  differential equation for this circuit:

\begin{equation}\label{eq:ACCircuit}
0.02\frac{dI}{dt} + 100\cdot I(t) = 110 \sin(2\cdot  \pi\cdot  60\cdot t) \, . 
\end{equation}
After dividing by the lead number 0.02 we would have:


\begin{equation}\label{eq:ACCircuit1}
\frac{dI}{dt} + 5000\cdot I(t) = 5500\sin(2\cdot  \pi\cdot  60\cdot t) \, . 
\end{equation}

Our integrating factor here is $u(t) = e^{\int 5000 \, dt} = e^{5000 t}$ so our equation upon multiplication by $u(t)$ on both sides becomes (\ref{eq:ACCircuit2}):

\begin{equation}\label{eq:ACCircuit2}
d\left(\frac{e^{5000 t}\cdot I(t)}{dt}\right)= e^{5000 t}\frac{dI}{dt} + e^{5000 t} \cdot I(t) = e^{5000 t} 5500\sin(2\cdot  \pi\cdot  60\cdot t) \, . 
\end{equation}
Now the right hand side is a toughie as you have to integrate by parts twice to evaluate the integral.  Go ahead and give it a shot. We shall meet you when you come out the other side.

\centerline{\vdots}

You should come up with something like this:
\vspace*{-.1 true cm}
\begin{equation}\label{eq:ACCircuitSolve}
I(t) = \left(0.0824692 2.71828^{-5000.
   t}+1.09378 \sin (376.991
   t)-0.0824692 \cos (376.991
   t)\right)(t)
\end{equation}
In Figure~\ref{fig:IntFactor-CircuitSolved} we plot the current in the circuit, I(t), as a function of time $t$ in seconds over a small interval of time $[0,0.2]$ s for the voltage (hence the current) oscillates 60 times per second.



\begin{figure}[h]
\centering

\vspace*{-.1 true cm}
\includegraphics[width=12cm]{IntFactor-CircuitSolved.eps}



\parbox{13.1 true cm}{\caption{\label{fig:IntFactor-CircuitSolved} Plot of the solution to our differential equation (\ref{eq:ACCircuit2}) using $E(t) = 110 \sin(2\cdot  \pi\cdot  60\cdot t)$ volts (an oscillating voltage), $R = 100$ ohms,  $L = 0.02$ henrys, and initial condition of $I(0) = 0$ amps in the circuit.}}
\vspace*{-.3 true cm}
\end{figure}
Notice how the current oscillates at the same frequency as the input voltage  with an amplitude  of 1.09689 amps.

\vspace*{.3 true cm}
 
We begin some activities for you to gain more insight into the method of Integrating Factor.

\begin{itemize}
 \item [1)]  This equation is to model a loan balance, $y(t)$ ($t$ in months) where the loan with initial balance of $y(0) = 20000$ US dollars is at  1\% interest, continuous compounded each month, and monthly payments of \$700 per month. We have transposed the interest amount from right side to left side to make it more amenable to determining the integrating factor, but you should understand the original form of the model.

\begin{equation}\label{eq:LoanDE}
y'(t) - .01 y(t) = 700\, , \quad y(0) = 20000\, .
  \end{equation}

\begin{itemize}
  \item [a)] Determine the integrating factor, $u(t) = e^{\int -.01 \, dt}$.
  \item [b)] Multiply the entire differential equations (both sides) by the integrating factor, $u(t))$.
  \item [c)] Identify and write the left hand side of the resulting differential equation as the derivative of a product -- derivative of  what functions exactly.
  \item [d)] Integrate the differential equation you found in (c), use the initial condition of $y(0) = 20000$ to determine the constant of integration, and then solve (isolate) for $y(t)$. Hint:  Your answer should look like this, $y(t) = 70000\, -50000 e^{0.01 t}$. 
  \item [e)] Determine the time in months when the loan will be paid off.
  \item [f)] Solve the differential equation (\ref{eq:LoanDE}) by separating the variables technique and compare your answer with that which you obtained in (d). 
\end{itemize} 
\item [2)]  Consider the differential equation
\begin{equation}\label{eq:GEN}
y'(t) + g(t) y(t) = h(t)\, , \quad y(0) = y_0\, .
\end{equation}
\vspace*{-.7 true cm}
\begin{itemize}
  \item [a)] Outline or sketch out the process of solving this equation by using the integrating factor approach
  \item  [b)] Discuss any problems (even insurmountable issues) that you could expect to have along the way.
\end{itemize}
\item [3)] Suppose you wish to set up a fund for a niece to have some money for a down payment on a house in 10 years.  You are prepared to put away \$1,000 per year on her behalf and you have a broker who  will guarantee you 4.5\% continuous compound interest on a mutual fund account. 

Form a differential equation model for this investment, solve for the balance at time $t$ in years, and indicate the balance she will have available to her in $t = 10$ years. Do you need to use an integrating factor to solve this differential equation or can you use a separation of variable approach?
\item [4)] You are thinking more about your niece and you think you can up the deposit amount each year by five percent (you are expecting raises at the firm and why not share it with your sister's daughter), i.e.  in year $t$ you can make a deposit of $1000(1 + .05 t)$ - check that this is the right way to model such an increment to your deposit strategy! 
\begin{itemize}
\item [a)] Build a differential equation model for this investment, solve for the balance at time $t$ in years, and indicate the balance she will have available to her in $t = 10$ years. 
\item [b)] Do you need to use an integrating factor to solve this differential equation or can you use a separation of variable approach? Explain why there will be a difference in your solution strategies between (3) and (4).
\item [c)] What will be the difference in the balances after 10 years of using  savings plans  (3) and (4)?
\end{itemize}
\item [5)] We are in the last week of a chemical production effort and we are planning to draw down the liquid in our tank, but our manager wants to run the facility as much as possible in this last week of operation to get the most out of the bio-process in the tank. Originally, the tank contains 1,000 gallons  (gal) of water with 27 pounds (lb) of our bio-asset material completely dissolved in the water.   We add water containing 0.08 lb/gal of our bio-asset material to the tank at a rate of 12 gal/hr, mix it thoroughly and instantly with power mixing blades, and continuously draw off 20 gal/hr of thoroughly mixed solution.

\begin{itemize}
\item [a)] Build a differential equation  model for the amount of bio-asset  in our tank at time $t$ hrs.
\item [b)] Explain why a separation of variables strategy will not work in solving this differential equation and why you will use integrating factor approach.
\item [c)] Solve your differential equation and plot the solution over the last week of operation.
\item [d)] When the concentration in the tank is 0.06 lb/gal or greater then the bio-process in the tank is ineffective and the manager will no longer maintain commercial operation of the tank, but rather just let it empty without any commercial benefit. How long into this last week will the manager be able to run the operation for commercial value?  How long does it take the tank to fully empty of liquid?
\item [e)] Discuss problems we might have with regard to some of the operating assumptions of our tank and system.
 \end{itemize} 

\item[6)] Currently a large NGO employees 8,500 people and some 250 are fluent in a second language. 
 
40 employees per week are choosing to retire for any number of reasons; some personal and some professional, regardless of their language skills.  

In an effort to alter the composition of the organization to reflect the need to speak a second language for better understanding of other cultures the recruitment office will hire replacements with more and more language skills in the following manner. 

During the first week they will hire 10\% of the replacement force to have a second language skill, in the second week that percentage of the new hires who have second language skills will increase to 15\%, and then in the third week that percent will increase to 20\%, etc. This will continue until week 18 at which point they will hire only people with a second language skill.  
\begin{itemize}
  \item [a)]  Produce a mathematical  model  (1) of the number of workers who are fluent in a second language up until the point the NGO is hiring 100\% of its new workers  to have second language experience.   
 \item [b)] What will the company's long range employee population look like with respect to second language skills.  When will the percent of employees with second language skill rise  to 50\%?  75\%? 90\%?  99\%? the company has only employees who have a second language skill. Will the company ever have 100\% of the employees with a second language skills?  Explain.
\item [c)] Suppose, through retirement package incentives to all employees, this NGO would have 80 retirements each week and replace them with the same scheme, i.e. during the first week they will hire 10\% of the replacement force to have a second language skill, in the second week that percentage of the new hires who have second language skills will increase to 15\%, and then in the third week that percent will increase to 20\%, etc. This will continue until week 18 at which point they will hire only people with a second language skill. 

Answer (a) and (b) in this case. Compare the times for variance percentage of employees who have second language skills goals.
  
\end{itemize} 
\end{itemize} 

\teacher{
\section*{NOTES FOR THE TEACHER}

Our basic idea in this text is to motivate the notion of integrating factor as finding a function which when we multiply certain linear differential equations on both sides will convert one side to the derivative of a product of functions. This side is easily integrated and if we can integrate the other side somehow then we can solve the differential equation.  The determination of this integrating factor is quite easy, indeed, it is formulaic. However, the price we pay in integrating the other side, the non-derivative of a product side, could be intensive with lots of integration by hand.

We used the circuit example here because we believe it is a good idea to gradually introduce the applications of differential equations in many context for the interests of the students and in this case the stark introduction of the RL circuit, without much motivation, we thought would be worthwhile because of the technique of integrating factor and then the implications of that solution for the circuit phenomenon.

We have tried to give situations in which the need for a technique beyond separation of variables is appropriate in a modeling context and we have pushed on to further issues in each case so that once we have a solution we can play with in our modeling scenario it as a reward to the perseverance of the student effort to get the solution.

While this is basically a by-hand approach we have placed our technical comments with solution efforts into a Mathematica notebook in this section. It is called 1-002-Text-Mma-IntegratingFactor.nb. We also save the pdf version as well.
}
\end{document}
