## Mathematical structures, 4

Week 4 is over, and it brought some surprises, mainly in the positive reactions of the students, which continues to delight me. In fact, one tutor reported full attendance this week for the first time in the semester.

This week was meant to be about functions, but because of delays last week we had to spend the first lecture on counting. One topic was the Principle of Inclusion and Exclusion. I explained this principle for two sets and for three sets, and told the students that the pattern continues but that I was not intending to prove it. But someone asked me how you would even write it down mathematically. A good question, since I had been using sets A, B and C, and clearly this wasn’t going to work. So we spent a few minutes developing a notation which would cope with n sets. I wrote down the formula, and gave the sign of the last term as (−1)n−1, explaining why this is so. Someone asked, “Could you also write that as (−1)n+1?” These are not the sort of questions I am used to getting from the audience in a first-year lecture.

I define a function f : A → B to be a black box, which accepts an element of the domain A as input and spits out an element of the codomain B as output. This is meant to drive home two points:

• we don’t care how the function values are actually calculated;
• the domain and codomain are part of the specification of the function.

As I expected, the difference between codomain and range puzzled the students. I think it is an important point. Most of them will not be computer programmers; but in strongly typed languages you have to provide this information up front. Also, one thing we did was to count the number of functions from A to B (the number is, of course, |B||A|), even though many (sometimes all) of these functions will have range not equal to B.

The other non-standard thing about the approach is that the definition of a function as a set of ordered pairs is tucked away in the supplementary material, which I expect will only be read by the better students. I am trying to teach them how to think about mathematics, not how to be rigorous mathematicians!

Similarly, a relation is a black box with two input slots; instead of an output slot it has two lights labelled “YES” and “NO”, one of which lights up when the two elements of the domain are inserted.

One of the questions on the problem sheet asked whether the number of possible essays you can store on a 320Gb hard disk is finite or infinite. I wanted the students to realise that there are only a finite number of zero-one strings that can be stored, only some of which will code essays. But one student surprised me by suggesting that a given string might have different interpretations in different languages, with different encoding methods, and it is not clear a priori that there are only a finite number of possibilities. Potentially the number of languages is infinite. I think you get into deep water fairly quickly following up this line of thought.