# Thoughts on Numerical Integration (Part 3): Derivation of left, right, and midpoint rules

Numerical integration is a standard topic in first-semester calculus. From time to time, I have received questions from students on various aspects of this topic, including:

• Why is numerical integration necessary in the first place?
• Where do these formulas come from (especially Simpson’s Rule)?
• How can I do all of these formulas quickly?
• Is there a reason why the Midpoint Rule is better than the Trapezoid Rule?
• Is there a reason why both the Midpoint Rule and the Trapezoid Rule converge quadratically?
• Is there a reason why Simpson’s Rule converges like the fourth power of the number of subintervals?

In this series, I hope to answer these questions. While these are standard questions in a introductory college course in numerical analysis, and full and rigorous proofs can be found on Wikipedia and Mathworld, I will approach these questions from the point of view of a bright student who is currently enrolled in calculus and hasn’t yet taken real analysis or numerical analysis.

For the sake of completeness, I discuss here the origins of the left-endpoint, right-endpoint, and midpoint rules of numerical integration. (These topics are often presented in calculus texts.) Consider the problem of finding $\displaystyle \int_a^b f(x) \, dx$, the area under a curve $f(x)$ between $x=a$ and $x=b$.

To start the process of numerical integration, the interval $[a,b]$ is divided into subintervals. Usually, for convenience, the intervals are chosen to be the same length, a convention that I’ll follow in this series. That said, if the function is known to vary wildly on some parts of the domain but not so wildly on other parts, then computational efficiency can be gained by varying the sizes of the subintervals, choosing smaller subintervals for the places where the function varies wildly.

In any event, we’ll choose equal-sized subintervals for the duration of this series.

One numerical approximation can be made by choosing left endpoints. In the picture below, the interval $[a,b]$ was divided into four equal subintervals. Let $h = (b-a)/4$, so that $x_0 = a$, $x_1 = x_0 +h$, $x_2 = x_0 + 2h$, $x_3 = x_0 + 3h$, and $x_4 = x_0 + 4h = b$. We then can draw rectangles using the left endpoints of each subinterval. The sum of the areas of these rectangles below is

$hf(x_0) + hf(x_1) + hf(x_2) +hf(x_3)$,

and so this serves as an approximation to the area under the curve. In general, if there are $n$ subintervals and $x_k = x_0 + kh$, then the integral may be approximated as

$\int_a^b f(x) \, dx \approx h \left[f(x_0) + f(x_1) + \dots + f(x_{n-1}) \right]$

That said, left endpoints were not necessary for making an approximation. We could have instead chosen the right endpoints of each subinterval. The sum of the areas of the rectangles below is

$hf(x_1) + hf(x_2) + hf(x_3) +hf(x_4)$,

and so this serves as an approximation to the area under the curve. In general, if there are $n$ subintervals, then the integral may be approximated as

$\int_a^b f(x) \, dx \approx h \left[f(x_1) + f(x_2) + \dots + f(x_n) \right]$

As a final approximation, any point in each subinterval could’ve been used for making an approximation. In the picture below, we use the midpoints of the subintervals, where $c_k = (x_k + x_{k-1})/2$. The sum of the areas of the rectangles below is

$hf(c_1) + hf(c_2) + hf(c_3) +hf(c_4)$,

and so this serves as an approximation to the area under the curve. In general, if there are $n$ subintervals, then the integral may be approximated as

$\int_a^b f(x) \, dx \approx h \left[f(c_1) + f(c_2) + \dots + f(c_n) \right]$

# Engaging students: Synthetic Division

In my capstone class for future secondary math teachers, I ask my students to come up with ideas for engaging their students with different topics in the secondary mathematics curriculum. In other words, the point of the assignment was not to devise a full-blown lesson plan on this topic. Instead, I asked my students to think about three different ways of getting their students interested in the topic in the first place.

I plan to share some of the best of these ideas on this blog (after asking my students’ permission, of course).

This student submission comes from my former student Cire Jauregui. Her topic, from Precalculus: synthetic division.

How can technology (YouTube, Khan Academy [khanacademy.org], Vi Hart, Geometers Sketchpad, graphing calculators, etc.) be used to effectively engage students with this topic?

The website IXL has a series of Algebra 2 learning topics where students can do practice problems. It presents students with a problem and tracks how long it takes them to solve the question. It also gives them a score out of 100. This site also has examples students can use to help them learn. The “Learn with an example” page walks students through the process step by step so that they can learn the process. If a student answers correctly, they are congratulated, given points, and then given a new problem to solve. If a student answers the question incorrectly, they are given a full explanation with the steps to solve the problem written out so students can check where they messed up. There are so many problems this program can come up with and provide students with many examples of all kinds.

What interesting things can you say about the people who contributed to the discovery and/or the development of this topic?

Paolo Ruffini developed Ruffini’s rule which is now known most commonly as synthetic division. Ruffini was an Italian mathematician in the late 1700s. In 1796, Napoleon Bonaparte and his troops signed agreements with the duke of Modena where Ruffini was studying and teaching. Here Napoleon set up the Cisalpine Republic where Ruffini was appointed to be a representative for the Junior Council of the Cisalpine Republic. He did not wish to take the position, so he left to return to his studies at the University of Modena in 1798. However, when he was required to swear an oath to the Republic, Ruffini refused due to his religious grounds and was removed from his teaching position at the university and told he could not teach again.

How does this topic extend what your students should have learned in previous courses?

This topic extends on a student’s ability to do long division and also polynomial long division. Polynomial long division works exactly how students would expect dividing a polynomial would work. The polynomial dividend is under the bracket, the leading term (not just the coefficient) of the divisor is used as the primary divisor which determines what should be on top of the bracket. This process continues until the divisor cannot divide into the dividend and then is used as a remainder where the “leftover” part is put over the divisor and left as a fraction. Synthetic division simplifies this process by focusing on the coefficients of the polynomial being divided. By focusing on the coefficients, it can remove some of the confusion students face when trying to do polynomial division.

# HyFlex Teaching During the Pandemic (and Beyond?)

I’m happy to say that an article I wrote teaching last spring — when I had to negotiate teaching both in-person students and students who were participating remotely — was published in this month’s issue of MAA FOCUS. I hope that some of these thoughts might be helpful to somebody else who might be in this position for the Fall 2021 semester.

# Engaging students: Half-life

In my capstone class for future secondary math teachers, I ask my students to come up with ideas for engaging their students with different topics in the secondary mathematics curriculum. In other words, the point of the assignment was not to devise a full-blown lesson plan on this topic. Instead, I asked my students to think about three different ways of getting their students interested in the topic in the first place.

I plan to share some of the best of these ideas on this blog (after asking my students’ permission, of course).

This student submission comes from my former student Trenton Hicks. His topic: working with the half-life of a radioactive element.

How can this topic be used in you students’ future courses in mathematics or science?

The topic of half life is a direct intersection of math and chemistry. In addition to being a common precalculus problem, we see half life come up in radioactive decay in chemistry. Half life is a concept that extends all the way into upper college chemistry, physics, and even archaeology when it comes to carbon dating. If students use carbon dating to any extent, they can use half life to determine the age of organic material since carbon 14 is radioactive (Wood). Since half life has to due with nuclear chemistry, this can also tie into nuclear power, since half life is crucial in computations related to efficiency and nuclear engineering. Half life is a form of exponential decay. If students have a thorough understanding of half life, they can better understand other natural phenomena that exhibit properties that are consistent with exponential decay. These phenomena include RC circuits, atmospheric pressure, and toxicity.

In Chernobyl Ukraine, 1986, there was a disaster at a nuclear power plant that has had lasting effects on the environment, people, and culture. The initial explosion was harmful enough, as 2 people lost their lives. Furthermore, radiation leaked into the atmosphere, and it’s speculated that many individuals are suffering the health consequences. When this story first broke, it shook everyone, and scared people away from nuclear power. Lately, there was another documentary that came to light about the incident from HBO. Many people don’t know that the former power plant is still very dangerous to this day. Why? Because the highly radioactive byproducts of the meltdown have half lives that makes them stick around for quite a while. One particularly dangerous isotope, caesium 137, has a half life of about 30 years. This means that in 2016, about half of the caesium decayed. Half of the sheer amount of caesium that was leaked due to the meltdown is still an enormously dangerous amount. News and documentaries report that there’s still a massive constructive effort to contain the radiation. Showing these news stories to students will convey the importance of half life and give them a little bit of insight into how much care should be given to nuclear power.

Half life began as a model proposed by Rutherford in the late 1800’s and very early 1900’s. Rutherford discovered that radioactive decay would turn one element into another. This change happens at a rate that we recognize as exponential decay, hence the model we use is consistent with that idea. Rutherford’s work would soon earn him a Nobel Prize. Other disciplines have taken the idea of “half life,” and have created convincing arguments for how the universe behaves. For instance, toxicology uses half life to convey how potent a dose of toxin is versus long it takes for the body to metabolize the toxin. Another notable development is the blog post on the fs website (linked below) that discusses half lives in terms of how our brains retain information, as well as the information itself. Relaying that half life isn’t just a chemistry or math topic to students, and providing them with this history might just increase the half life on their retaining of the concept.

References:

Fs blog:

Half Life: The Decay of Knowledge and What to Do About It

Sources:
Author: Rachael Wood

Click to access ExponentialDecay.pdf

Click to access Section_4.5.pdf

# Thoughts on Numerical Integration (Part 2): The bell curve

Numerical integration is a standard topic in first-semester calculus. From time to time, I have received questions from students on various aspects of this topic, including:

• Why is numerical integration necessary in the first place?
• Where do these formulas come from (especially Simpson’s Rule)?
• How can I do all of these formulas quickly?
• Is there a reason why the Midpoint Rule is better than the Trapezoid Rule?
• Is there a reason why both the Midpoint Rule and the Trapezoid Rule converge quadratically?
• Is there a reason why Simpson’s Rule converges like the fourth power of the number of subintervals?

In this series, I hope to answer these questions. While these are standard questions in a introductory college course in numerical analysis, and full and rigorous proofs can be found on Wikipedia and Mathworld, I will approach these questions from the point of view of a bright student who is currently enrolled in calculus and hasn’t yet taken real analysis or numerical analysis.

In this post, I’d like to take a closer look at the indefinite integral $\displaystyle \int e^{-x^2} dx$, which is closely related to the area under the bell curve $\displaystyle \frac{1}{\sqrt{2\pi}} e^{-x^2/2} dx$. This integral cannot be computed using elementary functions. However, using integration by parts, there are some related integrals that can be computed:

$\displaystyle \int x e^{-x^2} dx = -\displaystyle \frac{1}{2} e^{-x^2}$

$\displaystyle \int x^3 e^{-x^2} dx = -\displaystyle \frac{x^2+1}{2} e^{-x^2}$

$\displaystyle \int x^5 e^{-x^2} dx = -\displaystyle \frac{x^4+2x^2+2}{2} e^{-x^2}$

$\displaystyle \int x^7 e^{-x^2} dx = -\displaystyle \frac{x^6+3x^4+6x^2+6}{2} e^{-x^2}$

Based on these examples, it stands to reason that, if $\displaystyle \int e^{-x^2} dx$ can be written in terms of elementary functions, it should have the form

$\displaystyle \int e^{-x^2} dx = f(x) e^{-x^2}$,

where $f(x)$ is some polynomial to be determined. We will now show that this is impossible.

Suppose $f(x) = \displaystyle \sum_{k=0}^n a_k x^k$, a polynomial of degree $n$ to be determined. Then we have

$\displaystyle \frac{d}{dx} \left[ f(x) e^{-x^2} \right] = e^{-x^2}$

or

$f'(x) e^{-x^2} - 2 x f(x) e^{-x^2} =e^{-x^2}$

or

$f'(x) - 2x f(x) = 1$.

In other words, all terms on the left-hand side except the constant term must cancel. However, this is impossible: $2x f(x)$ is a polynomial of degree $n+1$ while $f'(x)$ is a polynomial of degree $n-1$. Therefore, the left hand side must have degree $n+1$ and therefore cannot be a constant.

A similar argument shows that $f(x)$ cannot have the form $f(x) = \displaystyle \sum_{k=0}^n a_k x^{b_k}$, where the exponents $b_k$ may or may not be integers.

This may be enough to convince a calculus student that there is no elementary antiderivative of $\displaystyle e^{-x^2} dx$. Indeed, although the proof goes well beyond first-year calculus, there is a theorem that says that if $\displaystyle \int x^a e^{bx^2}$ can be expressed in terms of elementary functions, then the antiderivative must have the form $f(x) e^{b x^2}$. So the guess above actually can be rigorously justified. References:

• Elena Anne Marchisotto and Gholam-Ali Zakeri, “An Invitation to Integration in Finite Terms,” The College Mathematics Journal , Sep., 1994, Vol. 25, No. 4 (Sep., 1994), pp. 295-308
• J. F. Ritt, Integration in Finite Terms: Liouville’s Theory of Elementary Methods, Columbia University Press, New York, 1948

# Engaging students: Using sequences

In my capstone class for future secondary math teachers, I ask my students to come up with ideas for engaging their students with different topics in the secondary mathematics curriculum. In other words, the point of the assignment was not to devise a full-blown lesson plan on this topic. Instead, I asked my students to think about three different ways of getting their students interested in the topic in the first place.

I plan to share some of the best of these ideas on this blog (after asking my students’ permission, of course).

This student submission comes from my former student Gary Sin. His topic, from Precalculus: using sequences.

How has this topic appeared in pop culture?

Probably the most used sequence in pop culture or art is the Fibonacci sequence. I learned about the Fibonacci sequence myself from “The Da Vinci Code” by Dan Brown. The Fibonacci sequence has been explored by many mathematicians over the years and if we divided 2 successive numbers (larger divided by the smaller), the limit of the ratio is the golden ratio.

The golden ratio was heavily believed to be seen in nature itself. Naturally people were fascinated that such a number could be seen everywhere in nature. Many artists based their art on the golden ratio, believing that the ratio is aesthetically pleasing. A great example is the polyhedral seen in “’The Sacrament of the  Last Supper” by  Salvador Dali. Modern architects also utilize the golden ratio in their builds. It was also believed that the proportions of the different parts of the limbs of humans are in the golden ratio.

The Fibonacci Sequence is fascinating and is a great way to demonstrate to students the beauty in math and how even artists are influenced by it and is a beautiful link to how mathematics can also be seen in nature.

How could you as a teacher create an activity or project that involves your topic?

Sequences are fun to play around with as some sequences are infinite or finite and the series they form could converge to a number. Students could be given a starting sequence and are asked to find the nth term of a sequence. I could also point out how sequences can be seen in something as simple as the list of natural numbers, multiples of positive integers.

Students could also be given both arithmetic and geometric sequences and plot them on a graph accordingly to see if the sequence progresses linearly or exponentially. I could also introduce sequences that are neither and that are divergent.

One of the important usefulness of sequences is how it relates to limits of a sequence. I could provide a fun riddle for students to figure out the limit of a sequence using word problems like Zeno’s Paradox. Students can figure out the rule of a sequence and plot it on the graph to see how it converges toward a number.

How does this topic extend what your students’ should have learned in previous courses?

The most amazing thing about sequences is that students use them from the moment they learn how to count as kids. Natural numbers are sequences that are obtained by adding 1 to the previous term. Naturally, the multiples of positive integers are also sequences. Students will also realize that the powers of a base are geometric sequences. When learning about plotting functions, linear, quadratic or cubic; the students are basically using sequences and basic pattern recognition to create tables of values and observing the rate of change.

Sequences are especially important in bridging a simple concept like a sequence to limits of functions, limits of infinity are an important abstract idea that provokes the students to think more about how a function would act if it  kept going forever.

When determining a recursive of exclusive formula for sequences, students will also have to apply basic algebra, order of operations, arithmetic, exponents in order to create or prove that a formula works for a sequence.

# Thoughts on Numerical Integration (Part 1): Why numerical integration?

Numerical integration is a standard topic in first-semester calculus. From time to time, I have received questions from students on various aspects of this topic, including:

• Why is numerical integration necessary in the first place?
• Where do these formulas come from (especially Simpson’s Rule)?
• How can I do all of these formulas quickly?
• Is there a reason why the Midpoint Rule is better than the Trapezoid Rule?
• Is there a reason why both the Midpoint Rule and the Trapezoid Rule converge quadratically?
• Is there a reason why Simpson’s Rule converges like the fourth power of the number of subintervals?

In this series, I hope to answer these questions. While these are standard questions in a introductory college course in numerical analysis, and full and rigorous proofs can be found on Wikipedia and Mathworld, I will approach these questions from the point of view of a bright student who is currently enrolled in calculus and hasn’t yet taken real analysis or numerical analysis.

First, let’s talk about why numerical integration is necessary in the first place. Indeed, I can still remember a high school calculus teacher asking me this question nearly 20 years ago, and this question really got me thinking about what we’re collectively teaching in the secondary curriculum. Indeed, in a Calculus I course, it seems like every integral can be computed if only the proper trick is used. We teach students to search for these different tricks:

• Let $u = x^2+5$ to find $\displaystyle \int \frac{6x \, dx}{\sqrt{x^2+9}}$.
• Let $x = 3\tan \theta$ to find $\displaystyle \int \frac{6 \, dx}{\sqrt{x^2+9}}$
• Use integration by parts to find $\displaystyle \int x^3 e^x \, dx$

In fact, we teach so many tricks that we may give the impression that every integral can be computed if only the proper trick is employed. Indeed, my university hosts an annual “Integration Bee” that challenges students to find the right technique(s) to evaluate some pretty tough integrals.

Unfortunately, not every integral can be solved in terms of a finite number of elementary functions (polynomials, rational functions, exponential functions, logarithms, trigonometric and inverse trigonometric functions). One function that is commonly known to many students which does not have an elementary antiderivative is $\displaystyle \frac{1}{\sqrt{2\pi}} e^{-x^2/2}$, otherwise known as the bell curve. For most numbers $a$ and $b$, the area

$\displaystyle \int_a^b \frac{1}{\sqrt{2\pi}} e^{-x^2/2}$

cannot be found exactly, and so we ask students to either use a table in the back of the textbook or else use a function on their scientific calculators to find the answer.

Just for the fun of it, I went through my Ph.D. thesis and wrote down some of the integrals that I had to integrate numerically while in school. As an applied mathematician, I was initially stunned by the teacher’s innocent question because so much of my work would be utterly impossible if it wasn’t for numerical integration. Here are some of the easier ones:

• $\displaystyle \int_0^t \frac{1-e^{-x}}{x} dx$
• $\displaystyle \int_{2R}^\infty t^2 g(t) \left( \frac{a_1 t^4 + a_2 t^2 + a_3}{(t^2-R^2)^7} +\frac{b_1 t^2 + b_2}{(t^2-R^2)^5} + \frac{c}{(t^2-R^2)^3} \right) dt$
• $\displaystyle \int_{d_2}^\infty \int_0^{d_1} \frac{y^2-x^2}{(x^2+y^2)^2} \left(e^{-a(x+d_1)-b d_2} - c\right) dx \, dy$
• $\displaystyle \int_{x/2}^\infty \sqrt{r^2 - k^2/4} \phi(r) \, dr$
• $\displaystyle \int_{x/2}^\infty \left( \frac{z \sqrt{4r^2-z^2}}{4} + r^2 \arcsin \left( \frac{z}{2r} \right) \right) \phi(r) \, dr$
• $\displaystyle \int_0^{2R} e^{-sz} \exp \left[ -c \left( z \sqrt{4R^2-z^2} + 4R^2 \arcsin \frac{z}{2R} \right) \right] dz$
• $\displaystyle \int_0^d \exp \left[ -sz - \lambda \left(z - \frac{z^2}{4d} \right) \right] dz$
• $\displaystyle \int_d^{d \sqrt{2}} \exp \left[ -sz - \lambda \left( \frac{d (\pi+1)}{2} - d \arcsin \frac{d}{z} + \frac{z^2}{4d} - \sqrt{z^2-d^2} \right) \right] dz$
• $\displaystyle \int_0^\infty \exp \left[-sz - \eta \left(1 - e^{-cz/2} - \frac{cz}{4} e^{-cz/2} \right) \right] dz$
• $\displaystyle \int_{-\infty}^x \frac{e^t}{t} dt$

All this to say, there are plenty of integrals that arise from a real-world context that have a numerical answer but cannot be computed using the techniques commonly taught in the first-year calculus sequence.

# Engaging students: Computing logarithms with base 10

In my capstone class for future secondary math teachers, I ask my students to come up with ideas for engaging their students with different topics in the secondary mathematics curriculum. In other words, the point of the assignment was not to devise a full-blown lesson plan on this topic. Instead, I asked my students to think about three different ways of getting their students interested in the topic in the first place.

I plan to share some of the best of these ideas on this blog (after asking my students’ permission, of course).

This student submission comes from my former student Jonathan Chen. His topic, from Precalculus: computing logarithms with base 10.

What interesting (i.e., uncontrived) word problems using this topic can your students do now?

Computing logarithms with base 10 can appear in many scientific applications for word problems. To define the acidity or alkalinity of a substance, Chemists use the formula $pH = \log [H^+]$. “[H+] is the hydrogen ion concentration that is measured in moles per liter” (Stapel, n.d.). We know lemon juice is acidic because the pH value is less than 7. We know bleach is basic because the pH value is greater than 7. When a pH value is equal to 7, the solution is neutral. An example of something neutral would be pure water. Teacher can create word problems based on the information given about a liquid solution. Noise can be measured in decibels. The formula used to measure the strength of a sound is $dB = 10 \log(I \div I_0)$. “I0 is the intensity of ‘threshold sound,’ or sound that can be barely be perceived” (Stapel, n.d.). Teachers can create word problems based on the defined terms of how many times more intense a sound is than the threshold sound. Similar problems with the topic of computing logarithms can be made involving earthquake intensity.

How can this topic be used in your students’ future courses in mathematics or science?

As shown in the above answer, this topic can reappear in student’s future science course in the topic of pH levels, earthquake intensity, or “loudness” measured in decibels. In order to find the pH levels, [H+] concentration, or the [OH] concentration you may need to know how to calculate logarithms with base 10 when dealing with the equation $pH = \log [H^+]$. Similar things can be said about measuring “loudness” and earthquake intensity. Their formulas involve calculating logarithms with base 10. Other future topics students may encounter in mathematics are logarithmic functions, Euler’s number, natural log, and logarithm rules. While not all of these future topics are strongly related to the topic of calculating logarithms with base 10, they can be loosely connected to where the practice of calculating logarithms with base 10 makes it easier to understand and do things related to the future topics. With the topic of logarithmic rules, it can help better simply and calculate with logarithms with base 10.

Calculating logarithms with base 10 has been around since 1614. John Napier invented logarithms and ever since then small additions have been made. Additions such as a logarithmic table made it easier to solve logarithmic problems. The logarithmic tables are similar to the multiplication tables elementary schoolers memorize to calculate simple multiplication faster for their future problems. Many mathematicians made their contributions to add more to the logarithmic table to the point where the calculations reached up to 200,000. Aside from the logarithmic tables, there were other methods to calculate logarithms with base 10 such as the slide rule. It was also possible to memorize the values of the logs with base 10 of 1 through 10 and use the logarithmic rules to calculate bigger values. Because

$\log 400 = \log(100 \times 4) = \log 4 + \log 100$

by expansion and logarithmic rules, people can solve this problem my memorizing that $\log 4 = 0.602$ and knowing that $\log 100 = \log 10^2 = 2$. Knowing this makes the equation more clear to recognize and easier to solve by hand. Calculating logarithms with base 10 were used extensively until the creation of the calculator made it easier to calculate anything, including logarithms.

References

“The Log Log Duplex Trig” “Slide Rule”. (n.d.). Retrieved from Web Archive: https://web.archive.org/web/20090214020502/http://www.mccoys-kecatalogs.com/K%26EManuals/4081-3_1943/4081-3_1943.htm

Bourne, M. (n.d.). 4. Logarithms to Base 10. Retrieved from Interactive Mathematics: https://www.intmath.com/exponential-logarithmic-functions/4-logs-base-10.php