Smoking Vampires

 BuffyI love the TV series of Angel and of Buffy the Vampire Slayer. I enjoy the excitement of saving the world every 42 minutes. But as a scientist I keep asking myself a lot of questions.

Where do vampires take their energy from? Usually oxygen is the fuel for the muscles of living organisms, but vampires do not breathe. Vampires are not living organisms, and yet they have to get their energy from somewhere.

When you kill a vampire, it turns to dust. If organisms are 60% water, then a 200-pound vampire should generate 80 pounds of dust. So why, in the series, do you get just a little puff of dust whenever someone plunges a stake into a vampire? Plus 120 pounds of water apparently evaporates instantly during staking. Can someone who is less lazy than me please calculate the energy needed to evaporate 120 pounds of water in one second? Because my first reaction is that you would need an explosion, not just one stab with Buffy’s stake.

All these unscientific elements do not actually bother me that much. What does bother me are inconsistencies in logic. For example, at the end of Season One of Buffy, Angel refuses to give Buffy CPR, claiming that as a vampire he can’t breathe. But then how can Spike and other vampires smoke? If they can smoke that means they are capable of inhaling and exhaling. Not to mention that these vampires talk: wouldn’t they need an airflow through their throats to produce sounds?

It would make more sense for the show to state that vampires do not need to breathe, but are nonetheless capable of inhaling and exhaling. So Angel should have given Buffy CPR. It would have created a great plot twist: Angel saves Buffy at the end of Season One, only for her to send him to the hell dimension at the end of Season Two.

Back to breathing. I remember a scene in “Bring On the Night” in which Spike was tortured by Turok-Han holding his head in water. But if Spike can’t breathe, why is this torture?

Another thing that bothers me in the series is not related to what happens but to what doesn’t happen. For example, vampires do not have reflections. So I don’t understand why every vampire-aware person didn’t install a mirror on the front door of their house to check for reflections before inviting anyone in.

Also, it looks like producers do not care about backwards compatibility. Later in the series we get to know that vampires are cold. Watch the first season of Buffy with that knowledge. In the very first episode, Darla is holding hands with her victim, but he doesn’t notice that she is cold. Later Buffy kisses Angel, before she knows that he is a vampire, and she doesn’t notice that he’s cold either. Unfortunately, the series also isn’t forward compatible. In the second season of Angel in the episode “Disharmony”, when we already know that vampires are cold, Harmony is trying to reconnect with Cordelia. They hug and touch each other. Such an experienced demon fighter as Cordelia should have noticed that Harmony is cold and, therefore, dead.

Finally, let’s look at Spike in the last season of Angel. Spike is non-corporeal for a part of the season; we see him going through walls and standing in the middle of a desk. Yet, one time we see him sitting on a couch talking to Angel. In addition, he can take the stairs. He can go through the elevator wall to ride in an elevator instead of falling down through its floor. And what about floors? Why isn’t he falling through floors? Some friends of mine said that we can assume that floors are made from stronger materials. But, if there is a material that can prevent Spike from penetrating it, they ought to use this material to make a weapon for him.

I’ve never been involved in making a show, but these producers clearly need help. Perhaps they should hire a mathematician like me with an eye for detail to prevent so many goofs.

Share:Facebooktwitterredditpinterestlinkedinmail

November Jokes

The jokes are a rough translation from a Russian collection, except the last one I invented myself.

* * *

— Moishe, do you know how many cuckolds are there in Odessa not counting you?
— What? What do you mean by saying “not counting you”?
— Sorry. Okay then, how many counting you?
* * *

At a very prestigious Russian nursery school a teacher talks to a four-year-old applicant.
“Mike, can you count for me?”
Mike counts very fast and with a lot of enthusiasm, “Fifty-nine, fifty-eight, fifty-seven…”
“Super,” says the teacher, “But how did you learn to count backwards?”
Mike replies proudly, “I can heat my own lunch — in the microwave.”

* * *

The curl of the curl equals the gradient of the divergence minus the Laplacian. Why do I remember this shit that I never need, but can’t remember where I put my keys yesterday?

* * *

In a bike store:
Customer: “Can you show me your finest helmet? I’ve already spent $200,000 on my head, so I don’t want to take any risks.”
Clerk, sympathetically: “You had a head trauma?”
Customer: “No, I went to college.”

* * *

A topologist walks into a cafe:
— Can I have a doughnut of coffee, please.

Share:Facebooktwitterredditpinterestlinkedinmail

Heavier or Lighter

In my old essay I presented the following coin problem.

We have N coins that look identical, but we know that exactly one of them is fake. The genuine coins all weigh the same. The fake coin is either lighter or heavier than a real coin. We also have a balance scale. Unlike in classical math problems where you need to find the fake coin, in this problem your task is to figure out whether the fake coin is heavier or lighter than a real coin. Your challenge is that you are only permitted to use the scale twice. Find all numbers N for which this can be done.

Here is my solution to this problem. Let us start with small values of N. For one coin you can’t do anything. For two coins there isn’t much you can do either. I will leave it to the readers to solve this for three coins, while I move on to four coins.

Let us compare two coins against the other two. The weighing has to unbalance. Then put aside the two coins from the right pan and compare one coin from the left pan with the other coin from the left pan. If they balance, then the right pan in the first weighing contained the fake coin. If they are unbalanced then the left pan in the first weighing contained the fake coin. Knowing where the fake coin was in the first weighing gives us the answer.

It is often very useful to go through the easy cases. For this problem we can scale the solution for three and four coins to get a solution for any number of coins that is divisible by three and four by just grouping coins accordingly. Thus we have solutions for 3k and 4k coins.

For any number of coins we can try to merge the solutions above. Divide all coins into three piles of size a, a and b, where a ≤ b ≤ 2a. In the first weighing compare the first two piles. If they balance, then the fake coin must be among the b remaining coins. Now pick any b coins from both pans in the first weighing and compare them to the remaining b coins. If the first weighing is unbalanced, then the remaining coins have to be real. For the second weighing we can pick a coins from the remaining pile and compare them to one of the pans in the first weighing.

The solution I just described doesn’t cover the case of N = 5. I leave it to my readers to explain why and to solve the problem for N = 5.

Share:Facebooktwitterredditpinterestlinkedinmail

Ten Coins

Among ten given coins, some may be real and some may be fake. All real coins weigh the same. All fake coins weigh the same, but have a different weight than real coins. Can you prove or disprove that all ten coins weigh the same in three weighings on a balance scale?

When I first received this puzzle from Ken Fan I thought that he mistyped the number of coins. The solution for eight coins was so easy and natural that I thought that it should be eight — not ten. It appears that I was not the only one who thought so. I heard about a published paper with the conjecture that the best you can do is to prove uniformity for 2n coins in n weighings.

I will leave it to the readers to find a solution for eight coins, as well as for any number of coins less than eight. I’ll use my time here to explain the solution for ten coins that my son Sergei Bernstein suggested.

First, in every weighing we need to put the same number of coins in both pans. If the pans are unbalanced, the coins are not uniform; that is, some of them are real and some of them are fake. For this discussion, I will assume that all the weighings are balanced. Let’s number all coins from one to ten.

Consider two sets. The first set contains only the first coin and the second set contains the second and the third coins. Suppose the number of fake coins in the first set is a and a could be zero or one. The number of fake coins in the second set is b where b is zero, one or two. In the first weighing compare the first three coins against coins numbered 4, 5, and 6. As they balance the set of coins 4, 5, and 6 has to have exactly a + b fake coins.

In the second weighing compare the remaining four coins 7, 8, 9, and 10 against coins 1, 4, 5, and 6. As the scale balances we have to conclude that the number of fake coins among the coins 7, 8, 9, and 10 is 2a + b.

For the last weighing we compare coins 1, 7, 8, 9, and 10 against 2, 3, 4, 5, and 6. The balance brings us to the equation 3a + b = a + 2b, which means that 2a = b. This in turn means that either a = b = 0 and all the coins are real, or that a = 1, and b = 2 and all the coins are fake.

Now that you’ve solved the problem for eight and less coins and that I’ve just described a solution for ten coins, can we solve this problem for nine coins? Here is my solution for nine coins. This solution includes ideas of how to use a solution you already know to build a solution for a smaller number of coins.

Take the solution for ten coins and find two coins that are never on the same pan. For example coins 2 and 10. Now everywhere where we need 10, use 2. If we need both of them on different pans, then do not use them at all. The solution becomes:

The first weighing is the same as before with the same conclusion. The set containing the coin 1 has a fake coins, the set containing the coins 2 and 3 has b fake coins and the set containing coins 4, 5, and 6 has to have exactly a + b fake coins.

In the second weighing compare the four coins 7, 8, 9, and 2 against 1, 4, 5, and 6. As the scale balances we have to conclude that the number of fake coins among 7, 8, 9, and 2 is 2a + b.

For the last weighing we compare coins 1, 7, 8, and 9 against 3, 4, 5, and 6. If we virtually add the coin number 2 to both pans, the balance brings us to the equation 3a + b = a + 2b, which means that 2a = b. Which in turn means, similar to above, that either all the coins are real or all of them are fake.

It is known (see Kozlov and Vu, Coins and Cones) that you can solve the same problem for 30 coins in four weighings. I’ve never seen an elementary solution. Can you provide one?

Share:Facebooktwitterredditpinterestlinkedinmail

PRIMES and RSI

I am starting yet another part-time job as the Head Mentor at PRIMES, a new MIT research program for high schoolers. I am very excited about this program, for it will be valuable not only to kids who want to become researchers, but also to kids who just want to see what research is like. Kids who want to learn to think in a new way will also find it highly useful.

PRIMES is in many ways similar to RSI, which it augments and complements. There are also a lot of differences. Keep in mind that I am only comparing PRIMES to the math part of RSI, with which I was working as a coordinator for two years. I do not know how RSI handles other sciences.

Different time scale. RSI lasts six weeks; PRIMES will take about a year. I already wrote about some peoples’ skepticism towards RSI in my piece called “Fast Food Research?.” PRIMES creates a more natural pace for research.

Choices. Because of the time schedule at RSI, students get their project as soon as they start. Students who realize by the end of the second week that they do not like their project are at a disadvantage: if they do not change their project, they’re stuck with something that does not inspire them or is too difficult, and if they do change their project, they won’t have enough time to do a great job. At PRIMES students will have time to talk to the mentors before starting their project, so that they can participate in choosing their project. Depending on how it goes later, they’ll have time to try several different directions. I believe that the best research comes from the heart: students who have the time and opportunity to shape their choices will be more invested in their project.

Application process. At RSI, The Center for Excellence in Education reviews the applications. Even though they usually do a superb job at sending us great students, I believe it would be an advantage if mentors were able to influence the review process, for they might find even better matches to their projects. At PRIMES, the mentors will have this opportunity to review the applications.

Geography. RSI accepts students from all over the US and from some other countries. PRIMES can only accept local students — those who live close enough to visit MIT once a week for four months. Because of this restriction, PRIMES is recruiting from a smaller pool of students than RSI. But for local students it means that it will be easier to get accepted to PRIMES than to RSI.

Coaching. At RSI, students get a lot of coaching. I think that every student is in close contact with four adults. Two of them are from the math department — mentor and coordinator (that’s me!) — and two tutors from CEE. PRIMES will have less coaching. A student will have a mentor and me, the head mentor. In addition, mentors might arrange for students to talk to the professors who originated their projects.

Immersion. RSI students are physically present. They are housed at MIT with the expectation that they completely devote their time to their research. Students at PRIMES will be integrating their research into the rest of their lives and their commitments. That will require good organizational skills and a lot of self-discipline. RSI students have discipline imposed on them by their situation — which may be an advantage to them.

Olympiads. While they are at RSI, students can’t go to IMO or other summer activities. This is why many strong Olympiad students choose not to go to RSI, or they turn down an RSI acceptance if in the meantime they have gotten on to an Olympic team. At PRIMES you can do both. It is possible to go to an Olympiad, in addition to writing a paper.

Grade. RSI students have to be juniors. There are no grade limitations for PRIMES. Thus, it is possible to go to PRIMES in one’s senior year. In this case, it may be too late to use PRIMES on college applications, but it is perfectly fine for the sake of research itself. Or it might be possible to go to PRIMES as a sophomore, and then apply for RSI the next year. This will strengthen the student’s application for RSI.

RSI is well-established and has proven itself. PRIMES is new and hopefully will offer young mathematicians additional opportunities to try research.

I think that the American system of education creates a lot of pressure for teachers to drill their students for standardized tests and multiple choice questions. This blocks creative thinking. Every program like PRIMES is very good for unleashing students’ creativity and contributing to the development of the future thinkers of American society.

Share:Facebooktwitterredditpinterestlinkedinmail

One-Way Functions

Silvio Micali taught me cryptography. To explain one-way functions, he gave the following example of encryption. Alice and Bob procure the same edition of the white pages book for a particular town, say Cambridge. For each letter Alice wants to encrypt, she finds a person in the book whose last name starts with this letter and uses his/her phone number as the encryption of that letter.

To decrypt the message Bob has to read through the whole book to find all the numbers. The decryption will take a lot more time than the encryption. If the book increases in size the time it takes Alice to do the encryption almost doesn’t increase, but the decryption process becomes more and more draining.

This example is very good for teaching one-way functions to non-mathematicians. Unfortunately, the technology changes and the example that Micali taught me fifteen years ago isn’t so cute anymore. Indeed you can do a reverse look-up online of every phone number in the white pages.

I still use this example, with an assumption that there is no reverse look-up. I recently taught it to my AMSA students. And one of my 8th graders said, “If I were Bob, I would just call all the phone numbers and ask their last names.”

In the fifteen years since I’ve been using this example, this idea never occurred to me. I am very shy so it would never enter my mind to call a stranger and ask for their last name. My student made me realize that my own personality affected my mathematical inventiveness.

Since modern technology is murdering my 15-year-old example, I would like to ask my readers to suggest other simple examples of one-way functions or ways to resurrect the white pages example.

Share:Facebooktwitterredditpinterestlinkedinmail

Five Fridays, Five Saturdays and Five Sundays

I received a message at the beginning of October: “This month has 5 Fridays, 5 Saturdays and 5 Sundays; this only happens every 823 years.”

Wait a minute. The Gregorian calendar cycles every 400 years. Where is the figure of 823 coming from?

Wait another minute. Within a century the calendar repeats itself every 28 years. So we are guaranteed that October 2038 will be the same as October 2010.

Wait one more minute. To have a month with five Fridays, Saturdays and Sundays, we need a month that has 31 days and starts on a Friday. There are seven months a year with 31 days, so on average we would expect to have such a month once a year.

If you study the calendar you can see that the seven long months start on six different days. This means that two of the months start on the same day and one of the days is skipped altogether. We see this in both leap years and non-leap years.

Ironically, 2010 is the year with two long months starting on Friday — October and January. Despite the claims of the email about this only happening every 823 years, in fact the same phenomenon occurred twice this year. The next time this will happen is in July 2011.

For those people who get all excited when a month has five Fridays, five Saturdays and five Sundays, I have good news for you. The month following each of these months has to start on Monday. And unless it is a February of a non-leap year, it will have five Mondays.

Share:Facebooktwitterredditpinterestlinkedinmail

Automatic Differentiation

I asked my son Alexey Radul what exactly he is doing for his postdoc at the Hamilton Institute in Ireland. Here is his reply:

The short, jargon-loaded version: We are building an optimizing compiler for a programming language with first-class automatic differentiation, and exploring mathematical foundations, connections, applications, etc.

Interpretation of jargon:

Automatic differentiation is a technique for turning a program that computes a function into a program that computes that function together with its derivative; with a constant factor overhead. This is better than the usual symbolic differentiation that, say, Mathematica does because there is no intermediate-expression bulge. For example, if your function is a large product

Product f1(x) f2(x) … fn(x),

the symbolic derivative has size n2

Sum (Product f1′(x) f2(x) … fn(x)) (Product f1(x) f2′(x) … fn(x)) … (Product f1(x) f2(x) … fn'(x))

automatic differentiation avoids that cost. Automatic (as opposed to symbolic) differentiation also extends to conditionals, data structures, higher-order functions, and all the other wonderful things that distinguish a computer program from a mathematical expression.

First-class means that the differentiation operations are normal citizens of the programming language. This is not the case with commonly used automatic differentiation systems, which are all preprocessors that rewrite C or Fortran source code. In particular, we want to be able to differentiate any function written in the language, even if it is a derivative of something, or contains a derivative of something, etc. The automatic differentiation technique works but becomes more complicated in the presence of higher order, multivariate, or nested derivatives.

We are building an optimizing compiler because the techniques necessary to get good performance and correct results with completely general automatic differentiation are exactly the techniques used to produce aggressive optimizing compilers for functional languages, so we might as well go all the way.

It appears that the AD trick (or at least half of it) is just an implementation of synthetic differential geometry in the computer. This leads one to hope that a good mathematical foundation can be found that dictates the behavior of the system in all the interesting special cases; there is lots of math to be thought about in the vicinity of this stuff.

Applications are also plentiful. Any time you want to optimize anything with respect to real parameters, gradients help. Any time you are dealing with curves, slopes help. Computer graphics, computer vision, physics simulations, economic and financial models, probabilities — there’s so much stuff to apply a high quality such system to that we don’t know where to begin.

Share:Facebooktwitterredditpinterestlinkedinmail

Modern Coin-Weighing Puzzles

I usually give a lot of lectures and I never used to announce them in my blog. This time I will give a very accessible lecture at the MIT “Women in Mathematics” series. It will be on Wednesday October 6th at 5:30-6:30 PM in room 2-135. If you are in Boston, feel free to join. Here is the abstract.

I will discuss several coin-weighing puzzles and related research. Here are two examples of such puzzles:

1. Among 10 given coins, some may be real and some may be fake. All real coins weigh the same. All fake coins weigh the same, but have a different weight than real coins. Can you prove or disprove that all ten coins weigh the same in three weighings on a balance scale?

2. Among 100 given coins, four are fake. All real coins weigh the same. All fake coins weigh the same, but they are lighter than real coins. Can you find at least one real coin in two weighings on a balance scale?

You are not expected to come to my talk with the solutions to the above puzzles, but you are expected to know how to find the only fake coin among many real coins in the minimum number of weighings.

Share:Facebooktwitterredditpinterestlinkedinmail

Decycling Graphs and Terrorists

In 2009 I was working at MIT coordinating math research for Research Science Institute for high school students. One of our students Jacob Hurwitz got a project on decycling graphs.

“Decycling” means removing vertices of a graph, so that the resulting graph doesn’t have cycles. The decycling number of a graph is the smallest number of vertices you need to remove.

Decycling is equivalent to finding induced forests in a graph. The set of vertices of the largest induced forest is a complement to the smallest set of vertices you need to remove for decycling.

lattice

forest

tree

Among other things, Jacob found induced trees and forests of the highest densities on graphs of all semi-regular tessellations. On the pictures he provided for this essay, you can see an example of a tessellation, a corresponding densest forest, and a corresponding densest tree. The density of the forest and the tree is 2/3, meaning that 1/3 of the vertices are removed.

To motivate RSI students I tried to come up with practical uses for their projects. When I was talking to Jacob about decycling, the only thing I could think of was terrorists. When terrorists create their cells, they need to limit connections among themselves, in order to limit the damage to everyone else in the cell if one of them gets busted.

That means the graph of connections of a terrorist cell is a tree. Suppose there is a group of people that we suspect, and we know the graph of their contacts, then the decycling number of the graph is the number of people that are guaranteed to be innocent.

Have you noticed how Facebook and LinkedIn are reasonably good at suggesting people you might know? The algorithm they use to analyze the data is fairly effective in revealing potential connections. Recently, someone was able to download all of the Facebook data, which means that any government agency ought to be able to do the same thing. They could analyze such data to discover implicit connections. As a byproduct of looking for terrorists, they would also discover all of our grudges.

Oh dear. What are they going to think when they find out I’m not connected to my exes?

Share:Facebooktwitterredditpinterestlinkedinmail