I made this Cantor set applet for my Real Analysis class. It is nothing fancy, but it saves me from drawing it on the board.
Cantor set applet
Posted in Academic Technology, Math | Tags: applet, Cantor set, GeoGebra, real analysis, topology
Applet to illustrate the epsilon-delta definition of limit
Here’s a GeoGebra applet that I made for my Real Analysis class. It can be used to explore the definition of limit:
Definition. The limit of as
approaches
is
, or equivalently
if for any
there exists
such that whenever
, it follows that
.
Posted in Academic Technology, Math | Tags: applet, calculus, definition, GeoGebra, limit, real analysis
The danger of false positives
As I mentioned earlier, I’m teaching a first-year seminar this semester called “Science or Nonsense?” On Monday and Wednesday this week we discussed some math/stats/numeracy topics. We talked about the Sally Clark murder trial, the prosecutor’s fallacy, the use of DNA testing in law enforcement, Simpson’s paradox, the danger of false positives, and the 2009 mammogram screening recommendations.
I made a GeoGebra applet to illustrate the dangers of false positives. So I thought I’d share that here. Here’s the statement of the problem.
Suppose Lenny Oiler visits his doctor for a routine checkup. The doctor says that he must test all patients (regardless of whether they have symptoms) for rare disease called analysisitis. (This horrible illness can lead to severe pain in a patient’s epsylawns and del-tahs. It should not to be confused with analysis situs.) The doctor says that the test is 99% effective when given to people who are ill (the probability the test will come back positive) and it is 95% effective when given to people who are healthy (it will come back negative).
Two days later the doctor informs Lenny that the test came back positive.
Should Lenny be worried?
Surprisingly, we do not have enough information to answer the question, and Lenny (being pretty good at math) realizes this. After a little investigating he finds out that approximately 1 in every 2000 people have analysisitis (about 0.05% of the population).
Now should Lenny be worried?
Obviously he should take notice because he tested positive. But he should not be too worried. It turns out that there is less than a 1% chance that he has analysisitis.
Notice that there are four possible outcomes for a person in Lenny’s position. A person is either ill or healthy and the test may come back positive or negative. The four outcomes are shown in the chart below.
| Test result | Ill | Healthy |
| Positive | true positive | false positive |
| Negative | false negative | true negative |
Obviously, the two red boxes are the ones to worry about because the test is giving the incorrect result. But in this case, because the test came back positive, we’re interested in the top row.
For simplicity, suppose the city that is being screened has a population of 1 million. Then approximately (1000000)(0.0005)=500 people have the illness. Of these (500)(.99)=495 will test positive and (500)(0.01)=5 will test negative. Of the 999,500 healthy people (999500)(.05)=49975 will test positive and (999500)(.95)=949525 will test negative. This is summarized in the following chart.
| Test result | Ill | Healthy |
| Positive | 495 | 49975 |
| Negative | 5 | 949525 |
Thus, 495+49975=50470 people test positive, and of these only 495 are ill. So the chance that a recipient of positive test result is sick is 495/50470=0.0098=0.98%. That should seem shockingly low! I wonder how many physicians are aware of this phenomenon.
You can try out this or other examples using this GeoGebra applet that I made.
Posted in Math | Tags: applet, false positive, health, medicine, statistics
A neat probability rule-of-thumb
Disclaimer: I am NOT a probabilist. Not only have I never taught probability, the last time I took a course in probability was in my sophomore year of college. So if this is well known (or totally wrong), forgive me.
A non-mathematician friend of mine shared this link with me. It compares the lifetime risk of dying by various means—cancer, heart disease, shark attack, etc. There are many problems with the analysis presented on this web page (for example, you are not equally likely to die from the flu in each of your 77.6 years (the average lifespan), conditional probability would be a more useful measure of risk for some of these, etc.), but I will ignore all of that. I want to focus on the last line. It says:
Lifetime risk is calculated by dividing 2003 population (290,850,005) by the number of deaths, divided by 77.6, the life expectancy of a person born in 2003.
For example, for drowning the risk is 1 in
Stated another way, they are claiming that if people die each year from a given cause, the total population is
, and the life expectancy is
, then the probability of dying from the given cause is
. I saw this and I thought, “Surely this is wrong. Why would that formula give the probability?”
So I tried to calculate it myself. Here is my back-of-the-envelope calculation. The chance of dying from this cause in one year is . The chance of not dying from this cause in one year is
, the chance of not dying from this cause for
years is
, and so the chance of dying from the cause in
years is
. (Of course, this leaves open the possibility of dying several times in those
years, but we’ll ignore that.)
Let’s use this formula with the drowning example. I get , or 1 in
.
What?!?! I was shocked to see an answer almost identical to the one using the “wrong” technique. There must be more to this than I first thought. Let’s look a little closer.
First, notice that . Sitting inside this expression is a sub-expression that looks a lot like the limit definition of
. In particular, because
is a large number, this expression is very nearly
. Aha! There’s the
term! But we still don’t quite have what we want.
What we’ve shown is that if the probability someone dies of a given cause in one year is , then the probability that they will die from it in
years is approximately
. Now suppose the probability
is small (like the probability of dying by drowning). We will compute the linear approximation to this function at
. We see that
. At
, that derivative is
. So the linear approximation at
is simply
. In particular, if we evaluate it at our specific annual probability value
, we obtain
. And there it is! [Update: thank you to the commenters for pointing out that the introduction of the exponential function, while fine, is unnecessary. Quicker: just use the linear approximation for
at
.]
Again, I’ve never seen this before. Perhaps it is well known. For example, maybe it is a good rule-of-thumb that all good actuaries know.
I’d be happy to hear people’s thoughts about this formula and my reasoning. Maybe there’s another, different way to see this.
[I'd like to thank my colleague Jeff Forrester for talking through this with me.]
Posted in Math | Tags: probability, risk, rule of thumb
Advice for new college students
I’m teaching a first year seminar this semester. This isn’t a math course. (The title of my course is “Science or Nonsense?” We will look at a wide range of topics including the paranormal, evolution, climate change, the vaccine/autism controversy, alternative medicines, etc.) We are required to focus on academic writing, library research, oral communication, etc. I will also be the academic advisor to the students in my class until they declare a major. With this last role in mind, I decided to write up some advice for these new students. Here’s my list. I gave them only statements in bold, the plain text is what I told them as we went through the list.
Advice for new college students
- Get to class on time.
- Read your email, but not during class.
- Spend a summer on campus. Work for a professor, be a tour guide, do research, etc.
- Use proper grammar and capitalization in the email messages to your professors. The email shorthand that may be appropriate between friends is not appropriate when corresponding with your professor (e.g., “hey, prof. when r u going 2 b in yr office?”).
- Call your teachers “Professor —” not “Mr. —” or “Mrs. —.” Almost all of your professors have the highest degree in their field (usually a PhD). (Addressing them as “Dr. —” is appropriate too, although it isn’t common at our school.)
- Get to know your professors and let them get to know you. They’re nice people. Ask your professors about their research, their family, their schooling, etc. Tell them about your summer research projects, your internships, etc. Down the road you may want to ask them for a letter of recommendation and they will be able to write you a much better letter if they know you. Besides, they are human beings, if you are rude to them, they will be less enthusiastic about helping you.
- Don’t skip class. Either you won’t be able to learn the material that you missed or the “free hour” that you gained will be lost several times over trying to catch up. If you do skip class, DON’T ask the professor what you missed—get notes from a classmate.
- Take classes outside of your comfort zone.
- Be protective of your online identity. Don’t post photos on Facebook that you wouldn’t want your parents, your professors, your future inlaws, or your future employers to see.
- Don’t sell your books back, especially for classes in your major.
- Don’t be a member of a clique. For many of you college will be the most diverse living experience of your life. Get to know as many people as possible and not just those with the same background as you.
- Be organized, use a calendar, and pay attention to due dates.
- Find a good distraction-free place to study.
- Learn to write well. I’ve seen far too many mathematics and science students avoid writing courses. They are under the impression that it won’t be relevant to them. Writing is an extremely important skill that is a prerequisite for almost all careers. You will be amazed at how much you will need to write.
- Learn from your mistakes. Look over your assignments when you get them back. The professor put those comments on there for your benefit. If you don’t understand the comments, ask.
- Do the assigned work. And the related…
- Don’t ask for extra credit. I don’t give extra credit and neither do most other college professors; if they do, they would give it to the entire class not just to you individually. Extra credit is great for the strong students—it can boost their grades from an A to an A+. Weaker students who need a grade booster should spend their time doing the assigned work (which they often haven’t done—that’s why their grade is in trouble in the first place). Doing the assigned work is the best preparation for the exams in the class—it gives the best “bang for the buck.”
- Start assignments early and start studying early. Related: don’t email the professor late the night before (or worse, the day of) an exam or the due date for an assignment asking for help.
- Admit when you are wrong. It may be difficult, painful, or embarrassing, but it is liberating. Living with a lie or a guilty conscience is worse than coming clean.
- If you choose to drink alcohol, do so in moderation. Not all college students drinks alcohol. According to a survey given here last year at fall break, approximately one fourth of the first year students had not consumed any alcohol in the past year.
- Stay healthy: eat well, exercise, and get enough sleep.
- Take the courses you want to take, not the ones your parents want you to take.
- Beware of technology such as video games, movies, social media, etc. They can be unhealthy, addictive time sinks.
- Don’t read or send text messages in class.
- Try new things (clubs, sports, volunteering, etc.), but don’t spread yourself too thin.
- Call home, but not too often.
- Get off campus and explore the area. Eat in restaurants, go for a hike, see a movie, visit a museum, etc.
- Study abroad.
- Do not beg your professor for more points on your graded work. If you have doubts about the grading, ask the professor to explain his or her reasoning. Most likely, if there was a grading error, your professor will fix it.
- Show up for appointments and be punctual.
- Don’t let your parents fight your battles. Professors cannot speak with your parents anyway (without a FERPA release).
- If things start going wrong, see a counselor. Each year the counseling center is used by 15–20% of the student body. The service is completely confidential; they won’t notify your parents, your professors, your friends, or your insurance company.
- Let go of your high school anxieties. Your classmates didn’t know you in high school. Make new friends, wear new clothes, listen to different music, and try new things.
- Don’t lie to your professors; they’ve heard them all (otherwise known as the “dead grandmother rule”). (A retired professor I know used to send a condolence card to the student’s parents every time a student informed him of a death in the family.)
- Be considerate of the neighbors. Not everyone in town is a college student. Keep this in mind when you are returning from a party at 2:00 AM.
- Be a good roommate.
- Don’t cheat. The penalties are steep if you are caught. If you are not caught you will have to contend with a guilty conscience. Cheating will produce a short-term gain and a long-term loss. Besides, it is a slippery slope—this is not the way you want to conduct the rest of your life.
- Become a novice. You’ll learn more and get more out of college if you don’t hold onto the attitude that you know everything already.
- Go on a road trip.
- Look at your final exam schedule before scheduling your flight home.
A quick guide to LaTeX
This semester I’ll be teaching real analysis. I am going to have the students type their homework in LaTeX. To make this as easy for them as possible, I will give them a template that is all ready for them to enter their solutions. They shouldn’t have to worry about headers, packages, font sizes, margins, etc. Furthermore, I decided that I should give them a LaTeX cheat sheet—a single document that has all the LaTeX information that they will need. I’ve created LaTeX cheat sheets like this before—but one was for real analysis, one was for topology, one was for linear algebra, and one was for discrete math. Each cheat sheet had different symbols.
So, I decided to bring them all together into a one-size-fits-all LaTeX cheat sheet. I kept it to two pages, so it can be printed (double-sided) on one piece of paper. (I have also posted the LaTeX code. Feel free to take it, edit it, and use it.)
It doesn’t have everything. As I said, I’ve left out all information about headers, etc. Also, since these students will probably not be using figures or tables, I’ve left them out. [Update: I added information about figures. I also added links to some online resources.]
Please let me know in the comments if there is anything that you think I should add. I still have a week and a half to tinker with it before classes begin. Also, please let me know if you find any errors. Thanks!
[Note: When I began this project I intended to modify this cheat sheet by Winston Chang to suit my needs. But in the end, I wiped it clean and started from scratch. (I did use his very nice three-column format though.)]
Posted in Academic Technology, Math, Teaching | Tags: latex, Math, typesetting
Highlights from MathFest 2011
Last weekend I was in Lexingon, Kentucky for MathFest 2011. I had a very nice time and saw some very good talks. I thought, just for fun, that I’d share a couple of juicy mathematical tidbits I learned.
Fibonacci numbers and the golden ratio
Ed Burger of Williams College gave a talk entitled “Planting your roots in the natural numbers: A rational and irrational look at 1, 2, 3, 4,…” From his talk I learned the following interesting facts.
In 1939 Edouard Zeckendorf proved that every natural number can be decomposed uniquely into a sum of Fibonacci numbers in such a way that no two of the Fibonacci numbers are consecutive. Recall, of course, that the Fibonacci numbers are 1, 1, 2, 3, 5, 8, 13, 21, 34, 55,… In particular, they satisfy the relation ,
, and
.
For example:
1=1
2=2
3=1+2
4=1+3
5=5
6=1+5
7=2+5
30=1+8+21
48=1+13+34
Then, in 1957 G. Bergman proved that every natural number can be written uniquely as the sum of distinct nonconsecutive integer powers of (where
the “golden ratio”
). For example:
(check it here if you don’t believe it)
Then, in 2008 Dale Gerdemann noticed that these facts are related.
First of all, the fact that implies that
, which is a very Fibonacci-like relation.
Moreover, notice that and that
.
Similarly, and
.
Do you see the connection yet? How about this:
Indeed, Gerdemann proved that if and only if
(for
sufficiently large).
So, for example, . So from this we can conclude that
, which it is. Isn’t that cool?
Burger went on to describe some work he did with his REU students to extend these results to other sequences and other irrational numbers.
Beyond the Pythagorean theorem
Roger Nelson gave an excellent talk entitled “Math Icons.” It is base on material in his new book (with Claudi Alsina) Icons of Mathematics. They look at the mathematics behind several famous images (icons) in mathematics.
He started by talking about the “bride’s chair.” This is the famous image which gives the geometric interpretation of the Pythagorean theorem. Rather than our usual algebraic , it shows that the sum of the areas of the squares on sides
and
is equal to the area of the square on the side
.
He went on to point out, for instance, that the figures on the sides of the triangle need not be squares. Any similar shapes will do. For example, in the figure below we see that the area sum property holds for semicircles as well. (This is in Euclid’s Elements, VI.31: In right-angled triangles the figure on the side opposite the right angle equals the sum of the similar and similarly described figures on the sides containing the right angle.)
He also discussed various properties of the so-called Vecten configuration. This is the same as the brides’ chair, but for triangles that aren’t right.
One property that I thought was particular nice is that if we take a Vecten configuration and draw in the three “flanks” (the red triangles below), then the area of each of the three flanks is the same as the area of the original (blue) triangle.
Finally, we turn to a Vecten-type configuration, but with equilateral triangles on each face. In this case, if we join the midpoints of each of the equilateral triangles, we obtain a new equilateral triangle (the red triangle below). This is now known as Napoleon’s theorem (yes, that Napoleon, and no, although he was interested in mathematics, we don’t believe that he discovered or proved this theorem).
This entire talk was fascinating. There was a lot more great material in it. I’ll have to check out their book!
How to draw a towel on a beach
Annalisa Crannell gave an amazing talk called “In the shadow of Desargues” on math, art, and perspective drawing. The main focus of her talk was Desargues’s theorem and using it to draw a towel on a beach. I couldn’t do the topic justice here, so you’ll have to check out her new book (with Marc Franz) called Viewpoints: Mathematical Perspective and Fractal Geometry in Art. I’m excited to read it.
MAA: The Musical
Finally, I was honored to be asked to participate in MAA: The Musical, which was performed during the opening banquet. I was happy to be asked and even happier not to be asked to sing in the production. I was enlisted as tech support (running the slide-show that went along with their songs). That was right up my alley. The MAA players were Alissa Crans, Annalisa Crannell, Art Benjamin, Bud Brown (musical director), Dan Kalman, David Bressoud, Francis Su, Frank Farris, Jennifer Beineke, Jenny Quinn, Matthew DeLong, Norm Richert, Paul Zorn, Talithia Williams. They did an amazing job (at least one song is now on YouTube).
[Update: Francis Su recorded the entire performance on his phone. It is now available online (audio only). Enjoy!]
All-in-all, it was a great conference.
Posted in Math | Tags: bride's chair, Desargues's Theorem, Fibonacci numbers, golden ratio, MAA, MathFest, perspective drawing, Pythagorean Theorem
The Japanese theorem for nonconvex polygons
A couple of years ago I wrote blog posts about two beautiful theorems from geometry: the so-called Japanese theorem and Carnot’s theorem. Today I finished a draft of a web article that looks at both of these theorems in more detail. It contains all that you could want—connections between these theorems, generalizations of them, and consequence of them. It even has a little topology (the n-dimensional torus makes an appearance). The mathematics is supplemented by some Geogebra applets so that you can see the theorems in action.
You can find the draft of the article here:
The Japanese theorem for nonconvex polygons
[Known problem: the applet featuring irrational rotations of the circle doesn't seem to work in Safari on the Mac—I'm trying to fix that.]
Posted in Math | Tags: applet, Carnot's theorem, GeoGebra, geometry, Japanese theorem
Some LaTeX odds and ends
Here are a few LaTeX tricks I’d like to share. None of them are earth-shattering, but maybe they’d be useful to some of you. (If you want to try these out, you can download this sample tex file and bib file that contains these tricks.)
1. I have always wanted LaTeX to support inline comments. In many computer programming languages you can insert comments /* like this */ in the middle of a line. You can’t in LaTeX. You can add comments using a % symbol, but then everything on the line after it is commented out.
The chief reason I would like to have inline comments is because I like to leave little notes to myself in the LaTeX—facts that I’ve decided to omit, clarifying details, word choices that I haven’t decided on, etc. Wouldn’t it be nice to write this?
The rain in Spain /* or is it France? */ falls mainly on the plain.
Of course, you can effectively leave inline comments like this (with no space between the two lines):
The rain in Spain%or is it France? falls mainly on the plain.
But I’ve never been happy with the look of that in my code.
Today I had an idea for how to get inline comments in my LaTeX code. I defined a new function that takes one argument and does nothing with it:
\newcommand{\comment}[1]{}
Now I can write inline comments like this:
The rain in Spain\comment{or is it France?} falls mainly on the plain.
2. That inspired me to work on something else on my wish list. When you put
\cite[p. 100]{richeson:2008}
in your article it leaves a citation to the book, includes the page number, and puts the book in the bibliography. When you put
\nocite{richeson:2008}
in your article it does NOT put a citation in the article, but it does put the book in the bibliography. Great. But what I would like to do is put this in my code:
\nocite[p. 100]{richeson:2008}
I want to do this not for the reader, but for me. If I’ve obtained a piece of information from a book, I’d like to make note of it in the body of my text so that I can go back and find it later. For long books, page numbers are crucial. I could use my new comment system
Euler's formula is $V-E+F=2$.\nocite{richeson:2008}\comment{p. 100} Isn't that cool?
Instead, I defined a new command:
\newcommand{\pgnocite}[2]{\nocite{#2}}
This new command takes two arguments—the page numbers and the citation. It ignores the page number and does a “nocite” on the citation. So I write
Euler's formula is $V-E+F=2$.\pgnocite{p. 100}{richeson:2008} Isn't that cool?
3. I do a lot of collaborating using DropBox and LaTeX. When I get the document back from my collaborator, it is difficult to tell what edits he made. So my collaborator and I came up with these commands to highlight new or changed text:
\usepackage[normalem]{ulem}
\usepackage[usenames,dvipsnames]{color}
\newcommand{\remove}[1]{{\color{Red}\sout{#1}$^{\text{remove}}$}}
\newcommand{\moved}[1]{{\color{ForestGreen}#1$^{\text{moved}}$}}
\newcommand{\fix}[1]{{\color{Orange}\uwave{#1}$^{\text{fix}}$}}
\newcommand{\new}[1]{{\color{NavyBlue}#1$^{\text{new}}$}}
When I add a new sentence to the document I put
\new{This is a new sentence.}
in the text. It appears blue with a little superscript “new” next to it. After I’ve read it, I can remove the \new tag. We also defined \remove, \moved, and \fix. You can create your own, add your own colors, and even decorate it with underlines from the ulem package (in the example above, \remove has a strike-through and \fix is underlined with a wavy line).
4. Lastly, we created a command that allows us to put notes in the margin.
\newcommand{\marginnote}[1]{\mbox{}\marginpar{\raggedleft\hspace{0pt}#1}}
Now we type this to get a margin note.
Here's a neat proof of this result.\marginnote{Jim, is this proof correct?}
Extreme examples and counterexamples
I recently read this puzzle at the Futility Closet and it reminded me of a technique that I like to use to test conjectures (when possible). I don’t know if it has a name, so I’ll call it “looking for extreme examples and counterexamples.” I like this technique because when it works it is fast and easy, and it can often be used without writing anything down. I’ll give three examples to illustrate this technique.
Example 1. Let me rephrase the puzzle in the form of a conjecture.
Two runners are in an airport standing at one end of a moving walkway (one of those 100 foot long treadmills). They run at equal speeds to the end of the walkway and back—but one runs on the moving walkway and the other runs on the (unmoving) floor next to the walkway. Conjecture: they both finish at the same time.
The idea, of course, is that the runner on the walkway will get helped by the treadmill going one direction and hindered (by the same amount) in the other direction. He’s traveling the same distance both ways, so the effect of the treadmill cancels itself out.
When you’re imagining the problem in your head you’re thinking that a person runs 15 mph and the treadmill is going 3 miles an hour, or something like that. You may reach for some paper to do some calculations…
But there are no details about velocity in the conjecture. So consider an extreme example—the walkway and the runner are moving at the same speed. Then, running with the walkway the runner goes very fast, but when he tries to come back, he runs on it like a gym-goer does on an exercise treadmill, and makes no progress. He not only loses, he never reaches the finish line. Thus the conjecture is false.
(Note that in the original puzzle the question is: who wins? If the answer HAS a correct answer, then you can use the extreme example given above to conclude that it is not the person running on the moving walkway.)
Example 2. There is a long history of mathematical cranks claiming to be able to trisect an angle. Recall the problem: you are given an angle with measure . Is it always possible, using only a straightedge and compass, to construct an angle with measure
? It is a famous result of Pierre Wantzel that while it is sometimes possible, it is not possible in general (in particular, it is impossible to trisect a
angle).
Here is a favorite “trisection method” given by the mathematical cranks. Suppose you are given an angle . Draw a circle with center
and radius
. We may as well assume that
is on this circle. Draw the chord
. Trisect this chord; that is, find a point
on
such that
(it is well known that it is possible to trisect a line segment using the Euclidean tools). Then
.
Conjecture: this is a valid method of angle trisection.
For small angles, this technique looks convincing (see below).
But it must work for all angles. Don’t dust off your copy of Elements and start looking for relevant propositions, look for an extreme example! For example, suppose . Clearly, as we see below, this technique does not trisect such an angle. Thus the technique fails.
Example 3. My last example is the famous Monty Hall problem. I’m sure this problem is well known to many of the readers of this blog, but here’s the setup. Monty Hall (a game show host) presents 3 closed doors to a contestant. He promises that behind one door is a new car and behind the other two are goats (obviously, the contestant wants to win the car). The contestant picks a door. Monty says that he will open one of the two remaining doors to reveal a goat (which he does). Then he asks the contestant if she wants to switch doors.
Conjecture: there is no advantage to switching. (Your rationale: at first your chance of winning was 1/3. But now there are two doors, one hiding a car and one hiding a goat, so it is a 50/50 shot either way.)
Of course this conjecture is FALSE. Here’s an extreme example to illustrate this point. Suppose there are 1000 doors hiding 1 car and 999 goats. You pick one door. There’s a 99.9% chance that the car is behind one of the other doors. Now Monty (who knows what is behind each of the doors) opens up 998 of the remaining doors. There are two closed doors—your door and one other. Using the same rationale as above, your chance of winning is now 50%, right? No! I hope it is clear that you want to switch!
(By the way, I read this explanation in The Drunkard’s Walk by Leonard Mlodinow.)
Posted in Math | Tags: angle trisection, logic, Monty Hall problem, proofs















