# 5.4: Integration

**At Grade**Created by: CK-12

## Indefinite Integrals

As students begin anti-differentiation they will need to have a certain degree of confidence with common derivatives. This confidence, developed from substantial practice, will result in quicker recognition of the “results” from their work in differentiation.

To develop the needed skill for harder problems in the future, it is ok to practice guess and check type integration before working on the “reverse” power rule or other techniques. While it takes some time, and sometimes causes frustration, the pay off is getting an understanding of how to separate and algebraically manipulate functions to make for easier integration when the problems get complicated. A couple of good problems to try:

\begin{align*}\int\limits \sin (2x) dx \end{align*}

\begin{align*}\int\limits 4x^3 dx\end{align*}

\begin{align*}\int\limits ex^2 dx\end{align*}

All of these problems are solvable easily with substitution or other techniques to be learned later. However, the process of trying functions, taking the derivative and seeing how the outcome turns out will provide a strong foundation for understanding the techniques and rules later, as well as just being good analytic practice.

## The Initial Value Problem

Here is an example problem with a basic differential equation:

You have two friends who are coming to meet you. One of your friends calls you \begin{align*}1 \;\mathrm{hour}\end{align*} after he left saying that he is now \begin{align*}320 \;\mathrm{miles}\end{align*} away. Your other friend calls \begin{align*}2 \;\mathrm{hours}\end{align*} after leaving, and is now \begin{align*}200 \;\mathrm{miles}\end{align*} away. The first person averages \begin{align*}72 \;\mathrm{mph}\end{align*} and the second averages \begin{align*}55 \mathrm{mph}\end{align*}. When were they equally distant from you?

A contrived problem, but one that provides some opportunity. There are many ways to solve this problem, and some students may feel like using calculus is a waste of time, as they are just learning those skills and others are still more familiar. It is a challenge when introducing new topics to choose problems that are easy enough to check and feel confident about, but provide opportunities to practice the new skills. Therefore, don't discourage or dismiss students who feel there is a better way, but insist that everyone at least attempts the problem using calculus.

All we have is two constant functions so we should list them: \begin{align*}v_1 (t)=72,v_2 (t)=55\end{align*}. Astute observers will see a potential problem with this, however. Since the drivers are coming towards you, and the standard convention is to put the subject of the problem at the origin, we should actually be indicating the velocities to be negative. It is up to the instructor when that should be brought up. We saw earlier that velocity is the derivative of the position function, so it follows that position is the anti-derivative of the velocity function. Therefore \begin{align*}s_1 (t)=- 72t + c_1\end{align*} and \begin{align*}s_2 (t) = - 55t + c_2\end{align*}. We do wish to know when the two position functions are equal, but with the constant term still not determined we can't do so. This is where the initial conditions come into play. Substituting in the time and position: \begin{align*}320 = -72(1)+c_1 \rightarrow 392=c_1\end{align*} and \begin{align*}200 = -55(2)+c_2 \rightarrow 310 =c_2\end{align*}. Now the problems can be set equal: \begin{align*} - 72t + 392 = - 55t + 310 \rightarrow 82 =17t \rightarrow t = 4.8\end{align*}.

It is important also to interpret the answer correctly. It states they will be equidistant \begin{align*}4.8 \;\mathrm{hours}\end{align*} after they left, not after they called. A simple problem, but one to illustrate the application of differential equations and how initial conditions fit in.

## The Area Problem

The same way that physical problems can illustrate the motivation for the derivative, the same can be done for integrals. Take the following table of velocities from a car starting from a full stop:

\begin{align*}& \text{Time (sec)} && 1 && 2 && 3 && 4 && 5 && 6 && 7 && 8 && 9 \\ & \text{Velocity (ft/s)} && 21 && 24 && 29 && 32 && 38 && 39 && 37 && 34 && 30\end{align*}

How much distance did the car travel in those \begin{align*}9 \;\mathrm{seconds}\end{align*}?

The way this was done in algebra was to find the average velocity and multiply by the time to get the distance traveled. It should be apparent from the table that the velocity, and even the change in velocity, is not constant. However, something can be inferred from that process. If we graph the time on the \begin{align*}x\end{align*} axis, and the velocity on the y axis, then the average velocity times the time is the same as the area of the rectangle made. Ask the students “Is there a way to get a more accurate approximation?” A diagram or graph may be helpful as an illustration. It should be clear that treating each second as it's own problem will result in a closer answer. One question that needs to be answered is where to take the height of each rectangle from. If you take the height from the right hand side the answer is:

\begin{align*}21(1)+24(1)+29(1)+32(1)+38(1)+39(1)+37(1)+34(1)+30(1)=284\end{align*}

Taking it from the left hand side:

\begin{align*}0(1)+21(1)+24(1)+29(1)+32(1)+38(1)+39(1)+37(1)+34(1)=254\end{align*}

Students should be able to safely assume that the correct answer is in between those two. Furthermore, they should think about the different ways that the answer could be improved. Students will probably come up with smaller rectangles, more rectangles, average the rectangles or end points (essentially the trapezoid rule) and possibly some others, most of which will be the next steps.

## Definite Integrals

It is up to the instructor at this point whether or not to introduce some summation rules. This may depend on whether or not the class has had experience with series in previous classes or if they are comfortable with what has been presented thus far in the class. These facts do not need to be proven just yet; there will be proofs presented later in the chapter on series. Some useful facts are:

\begin{align*}\sum_{i=1}^n c = nc\end{align*} where \begin{align*}c\end{align*} is a constant

\begin{align*}\sum_{i=1}^n i & = \frac{n(n +1)}{2} \\ \sum_{i=1}^n i^2 & = \frac{n(n+1)(2n+1)}{6} \\ \sum_{i=1}^n i^3 & = \frac{n^2(n+1)^2}{4} \\ \sum_{i=1}^n cf (i) & = \sum_{i=1}^n f(i) \sum_{i=1}^n p(i) \pm q(i) = \sum_{i=1}^n p(i) \pm \sum_{i=1}^n q(i)\end{align*}

Many definite integrals can be solved using just these rules:

Solve: \begin{align*}\int\limits_{0}^{1} 5x + 4dx\end{align*}

First, the width of each interval with \begin{align*}n\end{align*} subdivisions is \begin{align*}\frac{1}{n}\end{align*}. This makes each right hand endpoint \begin{align*}\frac{1}{n} i\end{align*}. Therefore the definite integral is:

\begin{align*}\int\limits_{0}^{1} 5x + 4dx = \lim_{n \to \infty} \sum_{i=1}^n \left (5 \left (\frac{i}{n} \right ) + 4 \right ) \frac{1}{n} = \lim_{n \to \infty} \sum_{i=1}^n \frac{i5}{n^2} + \frac{4}{n} = \lim_{n \to \infty} \left (\sum_{i=1}^n \frac{5i}{n^2} + \sum_{i=1}^n \frac{4}{n} \right )\end{align*}

Using the final summation rule above. Now we can pull the constants out front and that will result in a match for the form listed above for some other summation rules:

\begin{align*}\lim_{n \to \infty} \left (\frac{5i}{n^2} \sum_{i=1}^n i + \sum_{i=1}^n \frac{4}{n} \right ) = \lim_{n \to \infty} \left (\frac{5n(n+1)}{2n^2} + 4 \right ) = \lim_{n \to \infty} \left (\frac{5n^2}{2n^2} + \frac{5n}{2n^2} + 4 \right ) = \lim_{n \to \infty} \left (\frac{5}{2} + \frac{5}{2n} + 4 \right )\end{align*}

Now it's possible to evaluate the limit and find that \begin{align*}\int\limits_{0}^{1} 5x + 5dx = \frac{13}{2}\end{align*}.

## Evaluating Definite Integrals

An application of the definite integral, and one that appears regularly on tests, is finding the average value for a function. Averages are easy to find in linear situations, but not so easy with curves. The average value of a function can be found by evaluating:

\begin{align*}\frac{1}{b-a} \int\limits_{a}^{b}f(x)dx\end{align*}

which can be thought of as the area under the curve divided by the length of the interval. This is consistent with how we would find the mean in most other situations. An example of it's use:

An endowment account is being continually withdrawn from over the course of a month to cover day to day expenses. The amount of money in the account can be modeled with the equation: \begin{align*}E = 20+980e^{-.01t}\end{align*} where \begin{align*}E\end{align*} is the amount in the account, in thousands, and t is time in days. The bank pays \begin{align*}8.5\%\end{align*} interest on the average amount in the account over the whole \begin{align*}30\end{align*} day month. How much interest is paid? How much money needs to be placed into the account at the end of the month to maintain the same balance?

Because this is a curve, it is not possible to subtract the endpoints and divide by the duration. The function, and the information on the endpoints needs to be place into the average value formula:

\begin{align*}\frac{1}{30 - 0}\int\limits_{0}^{30} 20 + 980e^{-0.1t} & = \frac{1}{30} \left [20t - 98000e^{- .01t}\big|^{30}_{0} \right ] \\ & = \frac{1}{30} \left [\left (20(30) - 98000e^{-.01(30)}\right ) - 20(0) - 98000e^{-.01(0)}) \right ] \\ & = \frac{1}{30} [600-726000.18 + 98000)\\ & =866.66\end{align*}

This give us the average amount of money for the month, so multiplying by \begin{align*}.085\end{align*} states that \begin{align*}73.66\end{align*} thousand dollars are paid. This means that after the interest gets paid there is \begin{align*}940.32\end{align*} thousand in the account. If we substitute \begin{align*}0\end{align*} into the formula to find out how much the balance was at the beginning of the month, we find that it needs to be \begin{align*}1000\end{align*} thousand dollars, meaning that there needs to be \begin{align*}59.68\end{align*} thousand replaced to keep the endowment going.

There is frequently a question regarding average values on the AP examination. Because of it's intuitive format, that is, it is close to how we find means, it may not need to be stressed for memorization, but it will come in handy for both tests, and for applied classes like physics and economics.

## Integration by Substitution

This is the beginning of one of the more memorable parts of first year calculus. The set of techniques for integration need practice, practice and more practice. It is a pattern recognition game that can only be won through having the experience to match the correct technique. Furthermore the use of an incorrect technique may not result in an impossible situation, but will only fail to help get closer to the solution. A simple algebraic example of what I mean: to solve \begin{align*}3x+2=-x-5\end{align*}, one of the tools that is available to solve algebraic equation is to square both sides. We can legally do so in this instance, but doing so will only make the problem worse. This can often happen with either a poor choice of method, or a poor substitution or other traps that will be considered in the next sections.

If the integral is not straightforward, it is always preferable to start by attempting a substitution. It is the easiest, and usually going to work most frequently. Another clue is that substitution is the opposite of the chain rule. If it looks like you are being asked to integrate a composite function, substitution is probably the key.

## Numerical Integration

The trapezoid rule and Simpsons rule provide one of the first peeks into the sort of “brute-force” solving methods that we rely on now with technology. Getting a close answer with either method is not challenging, like taking a very involved anti-derivative is challenging, but can take significantly longer depending on the situation. One of the main tenets of computer science is that the major advantage of a computer is that it can do the same procedure, over and over again, without making errors or getting bored. Try to compute Simpson's rule by hand with \begin{align*}50\end{align*} subdivisions and you too will believe that it is an advantage.

So a great problem to tackle at this point is how to program a computer to take a definite integral with a good deal of precision. I will present the steps in TI-BASIC here, as the graphing calculator is probably the most likely place for students to be programming in the math classroom. This is also relatively easy in Python, Java or C if the instructor is familiar with those languages and has access to computers to use for programming. There are resources on the web detailing how to write a program for Simpsons rule in those languages.

I will put comments after a “//” to explain what each line is doing. These comments should not, and really can't, be entered on the calculator.

- Input “FUNCTION?”,Str\begin{align*}1\end{align*} //Getting the function and storing it in a string variable, found under the VARS menu
- Str\begin{align*}1\rightarrow Y1\end{align*} //Placing the function in the \begin{align*}Y1\end{align*} spot so it can be used as a function
- Input “LOWER LIMIT?”,\begin{align*}A\end{align*} //The lower limit of integration
- Input “UPPER LIMIT?”,\begin{align*}B\end{align*} //The upper limit of integration
- Input “DIVISIONS?”,\begin{align*}N\end{align*} //The number of subdivisions used for the approximation
- While fPart\begin{align*}\left (\frac{N}{2} \right )\neq 0\end{align*} //This checks to see if the number entered for \begin{align*}N\end{align*} is even. If not, it asks for a new number until \begin{align*}N\end{align*} is even
- Disp “NEED NEW \begin{align*}N\end{align*}”
- Input “\begin{align*}N\end{align*} MUST BE EVEN”,\begin{align*}N\end{align*}
- End
- \begin{align*}\frac{(B-A)}{N \rightarrow D}\end{align*} //Makes \begin{align*}D\end{align*} the length of each subdivision
- \begin{align*}N \rightarrow I\end{align*} //I will be used as a counter between \begin{align*}0\end{align*} and \begin{align*}\end{align*}
- \begin{align*}\left \{1 \right \} \rightarrow L1\end{align*} //Setting up a list for the coefficients to be multiplied to each endpoint of the function
- While \begin{align*}I > 2\end{align*}
- augment\begin{align*}(L1,\left \{4,2 \right \})\rightarrow L1\end{align*}
- \begin{align*}I-2 \rightarrow I\end{align*}
- End
- augment\begin{align*}(L1,\left \{4,1 \right \})\rightarrow L1\end{align*}
- sum\begin{align*}(L1*\mathrm{seq}(Y1(A+D*I),I,0,N))*\frac{D}{3 \rightarrow S}\end{align*} //This takes the sum of each element of the sequence of function values from \begin{align*}0\end{align*} to \begin{align*}N\end{align*}, multiplies by the width of each, and puts the answer into \begin{align*}S\end{align*}

Disp Str\begin{align*}1\end{align*} //Displays the function and answer

Disp “IS APPROX”

Disp \begin{align*}S\end{align*}

While the use of a list to produce the coefficients is a bit of a novel approach, there are many other ways to do so, including putting the computation of the approximation inside of a For or While loop. Be flexible and try to guide students as much as possible in writing some of their own code. A next step might be to try and write a program for trapezoid approximation.

### Image Attributions

**Save or share your relevant files like activites, homework and worksheet.**

To add resources, you must be the owner of the section. Click Customize to make your own copy.