Illustrating Theorems from Calculus

Michaela Kubacki, Middlebury College, Mathematics

Author Profile


In this activity, students use MATLAB to create and interact with illustrations of three theorems from Calculus: (1) Extreme Value Theorem, (2) Intermediate Value Theorem, and (3) Mean Value Theorem. The assignment reinforces the graphical interpretation of these theorems while teaching and reinforcing the basics of creating arrays, plots, and tables in MATLAB. Students also experiment with using MATLAB to find extremal values in an array and with finding roots of an equation.

Used this activity? Share your experiences and modifications

Learning Goals

The overall purpose of this assignment is two-fold: reinforce understanding of essential theorems from Calculus and practice basic commands in MATLAB that will be essential for future assignments.

Students will:

  • Articulate, using complete sentences, how the mathematical theorem statements (Extreme Value Theorem, Intermediate Value Theorem, and Mean Value Theorem) relate to their graphical illustrations.
  • Practice creating plots using arrays and add features such as colors, markers, line-styles, labels, and legends.
  • Learn how to create and use anonymous function handles for functions with simple formulas.
  • Learn the importance of using element-wise arithmetic in their function formulas so that functions act element-wise on arrays.
  • Experiment using the basic features of the max and min commands in MATLAB.
  • Practice creating tables with row and column labels.
  • Gain experience reading code with new commands, discovering what it does, and adding annotations.

Context for Use

This activity is used as part of an "Introduction to MATLAB" workshop for undergraduate students taking a mathematics course that utilizes MATLAB. The workshop takes place within the first week of the semester and is 2-hours long, with the first hour being a general introduction and walk-through suitable for any student taking a course using MATLAB. During the second hour, students spit into smaller groups and complete an introductory activity specific to their course.

The activity included is specifically for students enrolled in "Introduction to Numerical Analysis," which is comprised of a mix of lower and upper level students in a variety of majors. The prerequisite for this course is Calculus 2, although these particular theorems are usually covered in first semester calculus. This activity might be adapted as an introductory MATLAB activity for any other course in which these theorems form Calculus play an essential role.

Prior to working on this activity, students complete an hour introduction to MATLAB and learn the following: layout of MATLAB, accessing MATLAB documentation, using MATLAB drive, setting directories and paths, performing arithmetic in the command line, creating arrays and variables, using a livescript, and basic plotting. They then immediately start working on this activity. The first exercise in this activity has students creating arrays and variables to make a basic plot in a live script, so it reinforces skills students just learned before building on them.

Before the workshop and activity take place, students attend a lecture reviewing the following Calculus theorems and some of their applications: Extreme Value Theorem, Intermediate Value Theorem, and Mean Value Theorem. During this review, students make sketches by hand illustrating these theorems. This activity reinforces that material while giving students the chance to learn and practice some basic skills in MATLAB.

Middlebury College is a small liberal arts institution. Our class size is typically 24 students or less. The mathematics department offers a mix of pure and applied mathematics/statistics courses, with applied courses typically involving programming in MATLAB or R.

Description and Teaching Materials

The activity comprises of a handout for the students containing instructions/exercises and a MATLAB livescript (.mlx) file that the students will use to complete the activity. Instructors wishing to adapt this activity are welcome to use the LaTeX source files, included below.

  • illustrating_calc_thms.pdf (Acrobat (PDF) 167kB Oct19 21): This is the pdf version of the activity that can be distributed directly to students in digital or printed form.
  • template_illustrating_calc_thms.mlx (MATLAB Live Script 7kB Oct19 21): This is the livescript template the students will use to complete the activity.
  • illustrating_calc_thms.tex ( 12kB Oct19 21): The first pdf listed above was produced with LaTeX. This is the LaTeX source file that an instructor can download and modify as needed using any LaTeX editor.
  • mcode.sty ( 11kB Sep1 21): This is a style file that the .tex file needs for typesetting MATLAB code. Save this in the same directory as the .tex file.

Teaching Notes and Tips

  • Implement this activity after providing students a review of the relevant theorems in Calculus. During this review, have students sketch, by hand the illustrations of these theorems, so that when they complete the activity in MATLAB they have an idea of what their plots should look like.
  • Students may struggle with recognizing when element-wise arithmetic is necessary and when it is not. Encourage students to check calculations in the command line to help them make these determinations.


This assignment is graded out of 15 points, distributed into 4 categories.

  • Code Content (5 pts.): Code for all problems requiring code is present/complete. The code runs without errors, and produces correct results.
  • Discussions (6 pts.):All discussions are present/complete. Discussions are written using complete sentences and thoroughly/correctly answer the discussion prompts.
  • Code Presentation/Organization (2 pts.):Required code output is visible in the pdf document and any unnecessary output has been suppressed. Code is written and presented in a logical and readable manner. Chosen variable names are consistent and easy to follow. Code includes descriptive annotations in the form of comments (%) so the reader can easily follow the process.
  • Overall Presentation/Organization (2 pts.): Each exercise appears in its own section. Any mathematics is properly typeset using the equation editor. The lab report is organized and presented in a way that is clear and easy to follow.

References and Resources

Most Introduction to Numerical Analysis/Methods undergraduate textbooks will contain a review of the theorems in this activity, however, I have found that many students require a more detailed review and resources (as Calculus backgrounds vary) and so I usually devote a lecture to reviewing these theorems.

Recommended free Calculus Textbooks that cover these theorems at an undergraduate calculus level:

Regarding students entirely new to programming in general, I would encourage those students to follow-up this introduction activity with the MathWorks Onramp Tutorial (2 hours).