A better number sequence for teaching Cantor’s diagonalization.

I’ve been teaching CMSC250: Discrete Structures in CS UMD for a while now. Essentially a more CS-friendly version of Discete Mathematics, with more logic, set theory, structural induction, countability. Countability, a rather esoteric subject, is challenging for our students. Naturally, a student that doesn’t get countability because they don’t get bijections cannot be helped until they understand bijections, but when it  comes to the Cantorian diagonalizing proof that the reals are uncountable (to be precise, that the interval [0, 1]) is uncountable), one can lose many more students.

I conjecture that one possible reason for this is that the sequence of numbers that is used to create  the 2D matrix is usually a bit arbitrary in both texts and slides. For example, in my own slides, I have this following sequence of numbers:

Screenshot 2018-02-28 12.50.38

With such a sequence of numbers, I have observed that even medium-to-strong students oftentimes have trouble. So let’s try to improve our example. Here’s a nice trick: Write down only the diagonal portion of the listing of reals:

r_1 = 0. \mathbf{2}xxxxxx\dots

r_2 = 0.x\mathbf{4}xxxx\dots

r_3 = 0.xx\mathbf{2}xxx\dots

r_4 = 0.xxx\mathbf{9}xx\dots

r_5 = 0.xxxx\mathbf{0}x\dots

r_6 = 0.xxxxx\mathbf{8}\dots

\ \vdots \qquad \vdots \qquad \vdots \qquad \vdots

Since the diagonal values are the only ones that you need to construct the number of interest, go ahead and construct it. I call it r' (r “prime”) only because I would like to use r later.

r' = 0.353019\dots

And now we will go replace all of those x‘s with the same-index digits of the number itself. For example, we will replace the 2nd, 3rd, 4th, 5th and 6th digit of r_1 with 5, 3, 0, 1 and 9 respectively. We will also replace the 1st, 3rd, 4th, 5th and 6th digits of r_2 with the relevant digits of r', and so on and so forth:

r_1 = 0. \mathbf{2}53019\dots

r_2 = 0.3\mathbf{4}3019\dots

r_3 = 0.35\mathbf{2}019\dots

r_4 = 0.353\mathbf{9}19\dots

r_5 = 0.3530\mathbf{0}9\dots

r_6 = 0.35301\mathbf{8}\dots

\ \vdots \qquad \vdots \qquad \vdots \qquad \vdots


The benefit of carefully constructing the number sequence in this way is that now the student can see that those numbers, no matter how hard they try to look like our own constructed number r', they fail in at least one decimal digit. In fact, with this visualization of the first 6 decimal digits for every real r_j, there is a difference of exactly one decimal digit. We have essentially pushed the argument to its limits: even if we had a real r_k whose 1st, 2nd, 3rd, …. (k-1)th, (k+1)th, (k+2)th, …. digits are the same, r_{k_k} is guaranteed, by construction of r', to be different from a_k.

The final piece of the argument can perhaps be shown as follows: The statement “[0, 1] is countable”, can be re-worded as: “For every real r in [0, 1], there is some positive integer j such that r = r_j.

The way I like to proceed from that point onward is the following: Since there is some positive integer j such that every single r \in [0, 1] can be written as r_j, then this is also the case for our constructed real number r' since, clearly, by the way that I have constructed r', it is a number between 0 and 1!

Maybe this j is equal to 1. But this can’t be, since we notice that the numbers differ in the first decimal digit, again by construction. And this is where the construction comes to help: all the other (visible) digits are the same. However, it suffices for there to be a difference in a single digit in order for us to say that, for a given j,\ r \neq r_j.

Maybe j = 2. The first digit is ok, it is 3 in both r_2 and r', But the second digit gives us a difference, despite the fact that all other digits are the same!

Maybe j = 3, and so on and so forth.

So the point is that this enumeration actually provides a Discrete Mathematics student with more intuition about why the proof works.






Spiderman: Homecoming is entertaining, but morally bankrupt.

I have recently began watching the entire Marvel Cinematic Universe, mostly out of curiosity. I’ve been enjoying it! Ridiculous C.G.I, good humor, some good acting, hilarious plot holes, and, perhaps surprisingly, some interesting moral arguments here and there. For example (obviously, spoilers follow):

To say that I am wasting my time trying to find morality in Marvel movies because their focus is on the CGI and action is an all-or-nothing statement, and experience has shown that all-or-nothing statements tend to be null. Unfortunately, watching Spiderman: Homecoming, one of the latest additions to the series, has left me troubled.

This movie essentially reboots the character of Spiderman and casts him within the modern-day framework of the Avengers.

About ten years after the Battle of New York, featured in the end of the first Avengers movie, Peter Parker (Tom Holland) is a “typical” white teenager who has found himself “blessed” with extreme agility and physical prowess. During the day, he is a sophomore in a STEM-oriented highschool in his home NY burrough of Queens. During the night, he is neighborhood-friendly vigilante Spiderman. Using a make-shift spider suit, he shoots webs from his hands as he hops from building to building, thwarting petty crime and being the all-around neighborhood good guy. He is being put up by his aunt Mae (Marissa Tomei) in Queens, whom he views essentially as his mother. It is implied by the movie that Peter’s parents are either dead or unavailable.

During the airport confrontation featured in Captain America: Civil War, Spiderman was on Tony Stark’s side. For his services, he is given an advanced suit and a “line” to Tony Stark’s personal assistant, Happy. Excited, Peter manages his daily routine in such a way that he finishes school duties as fast as he can and then he joins the so-called “Stark internship”, which is essentially a misnomer for “I’m fighting petty Queens crime until Happy calls me for an actual mission.”

The movie is entertaining. There’s short, biting humor, some funny highschool stereotyping based on a teenager’s changing body and psychology, Holland is a very good choice, and so is Keaton (Vulture, the main antagonist). With Keaton’s character, however, begin some problems.

Statement #1: “Evil government” here to steal the fruits of your labor

The movie actually begins with a shot right after the Battle of New York, so there’s a flashback to 10 years before “present day”. The Vulture leads a team of scavengers who are collecting and sorting the alien invasion’s fallout (exotic minerals, weapons, fuel). This “business” is lucrative, since it was made obvious from the invasion proper that the materials the aliens use have significant energy and weaponization parameters that could revolutionize human industrial endeavor, at both a small scale (small / medium businesses) and large scale (factories). Of course, peddling the weapons themselves in the black market is the most straightforward way for a quick, huge cash flow. The Vulture is obviously interested in this latter venture (he is the arch-villain, after all).

The Vulture has assembled this team by using his own money, arranging for trucks to bring the workers from other areas of the country, set up tents, equipment, arranged buyers, etc. Very few minutes into the movie, an unnamed federal government entity swoops in and informs the crew that as per a certain Executive Order, the area is now under the jurisdiction of the Feds. The people making up this entity are portrayed very coldly, in sharp black suits, led by a seemingly emotionless and detached woman, who responds to The Vulture’s protests with “sorry, there’s nothing we can do”.

And it is these protests that are the problem. Perhaps in an effort to offer some kind of logical basis about how Keaton’s character actually ends up being the Vulture, the movie shows what this governmental overtaking means for Keaton and his crew; Keaton has “overextended” (verbatim), assembling this crew using his own finances and bargaining with significant income that can support the families of his workers. This he makes quite evident to the officials arriving on the scene, even punching one out of sheer classic white man working-class frustration.

Dude, no. Alien shit has fallen from the sky. The CDC and DHS MUST weigh in on how much of this stuff is radio-active and all-around dangerous. Just because you went out on a limb to help people with what is a most definitely illegal operation doesn’t mean that the government is the bad guy here. You’re the idiot. Not to mention that it’s quite clear what you’re planning on doing with the weapons. 

In times such as this that  an inbred anti-authoritarian is head of State and his Neanderthal – level supporters equate government with spending and spending is bad and taxes and don’t take my freedoms and other such BS, this is not something that you want to popularize.

Statement #2: “Ultra (???)-liberals” are annoying

One of the protagonist’s friends is a young girl with a strong political stance. She is not comfortable with the status quo and displays a very distinct way of thinking and a general aura of not being comfortable in her own shoes, since other people have had, have, and will very likely still have it worse than her. She is forced to read a piece of dialogue where she tells the protagonist and his best friends that it’s somehow completely natural that they have no friends (see statement #4) and that she doesn’t either. Of course. Politically involved people are outcasts that should have no friends.

Statement #3: Thighs over brains, yet again

The protagonist’s erotic interest is an oversexualised senior. The girl playing is very beautiful, no doubt. Tall, beautiful skin and lips, deep eyes, beautiful hair.

And that is pretty much her role in the movie. In a STEM-oriented highschool, the directors have the opportunity to elevate the position of women by clearly depicting desirable role models: a beautiful woman who can also enter a lab and make the same mistakes and the same breakthroughs as everybody else. Instead, she’s leading the debate team, and her own contributions to the debate team are from the managerial standpoint. Nowhere in the sequence of the movie is there a single implication that this woman, in addition to visually striking, can be intelligent.

Statement #4: Geeks are unpopular and unattractive

This hits home a bit, since I’m a computer geek. The protagonist’s best friend is portrayed as an overweight, unpopular kid who, when not in the lab or not hacking passwords, spends his day eating Cheese Puffs and watching Netflix / getting high (the last activities are not actually portrayed in the movie, but anybody with half a brain -in short supply these days, I know – can tell that this is  exactly the mental picture that we are fed with). No, Jon Watts. Geeks can wear nice clothes, or not. They can be sexually active, or not. They can eat Cheese Puffs, or Quinoa soup and salads. They can be not stereotypes. It’s their choice. Show them this. Give me something original. Give me a geek that is actually grounded in the real world. Tell our undergraduate students who are struggling to find their identity that it’s ok to be socially awesome, sexually active, politically involved. Show them as I see them in reality, people who are struggling emotionally yet are growing in all sorts of weird ways. Give us an original example of what is really going on. Challenge my worldview. You have the power; your audience is millions that are watching the show absent-minded or high: tickle their subconscious by passing the right message.

Some might say that I’m being over-sensitive and over-feminist. The latter word makes no sense in Jasonland and it’s quite dangerous, but this is a discussion for a different time. But I very much want to apply emphasis on the use of the preposition “over”: No. I am not being over-whatever. I’m just challenging your world view. I’m challenging dangerous stereotypes. There exist stereotypes that are either not dangerous at all, or, if we want to ground ourselves in the real world where absolutes don’t exist, infinitesimally dangerous. For example, stormtroopers in Star Wars always missing their target, which extends towards pretty much every action movie there’s ever been: bad guys are terrible shots. I guess this stereotype could be harmful if people want to go out there and shoot criminals, since in the real life, even a bad shot is better than a movie bad guy shot….

In a time when we hear all kinds of degrading comments about minorities and women, with the very president having suggested groping women’s genitals, we have to look deeply into our own behaviors and our inputs and thing: “how did this make me more into a Trump today?” Or, we can choose not to and continue the proliferation of male-only jokes, and “no girls in guys’ nights”. Because we want to be sexist and call women “bitches” and we don’t want girls around because they will be offended. Yeah, of course they will. You’re calling them bitches. Would you like it if women called you or the entirety of male-hood a bastard or an asshole during ladies’ night? Do you not get aggravated when you hear statements such as “all men are the same”?

It’s very, very easy to get offended without trying to rationally think why the other person is thinking the way they are thinking. I have to put myself in the equation because lately I’ve been hearing so many things that defy my logical pattern of thinking that all I get to is contradictions. But it’s much harder, and a sign of a better person, a person I want to become, to be able to understand how the person reached the conclusion, and whether they are “over” – sensitive or “over” – not sensitive. Maybe then I wouldn’t be calling Trump supporters Neanderthals.


There’s nothing in this life that is worth anything beyond money. You have to get to the top and start controlling people. Six pack, billionaire, fast car, many hot chicks, excellent suit. Everything else is just a mediocre existence not worth talking about or even living. Kill yourself and stop wasting my air, weakling.

It’s all about people. Happiness is not hard, it’s in the moments. Who cares how much money you make? There are many people with a lot of money whom people hate, look at Trump. The “top” is unattainable, it’s a fictional ideal that is popularized by companies so that they can get you to buy more stuff.

Enough with the excuses. If you can’t make it, go back to Greece and become a street-sweeper, you piece of uncultured modern-day swine. Fuck you. Really smart people let go of health problems and do it. Stop making excuses and just get to the top or else you’re nothing, and that’s that.

Without health, you are nothing. You got sick, had to take 6 months off and your new advisor was hostile. It’s completely reasonable to quit under those circumstances. Nobody is making fun of you. Even if you were doing well and decided to quit, it’s your decision and you have to do what makes you happy.

There is no happiness in this world. There’s only power, money and hate. If you don’t like it, kill yourself. You have to project a certain image. Without it, you’re toast. That’s the truth, you know it is, so shut up and get work done. It’s nothing without work. There’s no happiness. There’s just work, money, and power.

The people you work with, do they go home after 5? Do they work as much as you do? I think the answer is no. Then why do you try harder and then harder and then harder to prove to yourself… what? 

If you don’t work 24-7  you’re a Greek piece of shit. You’re lazy like all Greeks and your work ethic is next to none. No matter your students hate you, you deserve all the hate you can get. There’s nothing. You put up a schedule for the bass guitar, you weren’t able to keep up with that even, you Greek piece of human garbage. 

Scheduling is hard. Putting limits is hard. You don’t have to work 24-7. You just need to know what’s not worth spending your time on. Successful people do that all the time. Knuth doesn’t answer e-mail in decades. He invented open addressing, for heaven’s sake.

Look, I’m not looking for excuses. I’m just a piece of shit person who had better just go back to Buttfuckland and stuff their face with moussaka, fail and AIDS.

Listen to yourself, you’re being irrational. Nobody cares about your money, your degrees, your sexual experience and “conquests”. In fact, nobody cares in general. Everybody is so self-absorbed with their own problems that they don’t have time to look down on you.

Bullshit. A bunch of people are just waiting for me to fail hard and are scheming in corners, waiting for me to fail. Dropping out of a PhD, making less money than I ought to at this point, not being at the top. It’s already too late. I have to get to the top fast. I need more money, a better car, a better job, a PhD, a house in San Diego, and I need it now. It’s already too late. I probably can’t get it now. 



What Trump means for a white, privileged male from a different country

I was born and raised in Athens, Greece, leaving the country for a PhD in Computer Science in UMD back in 2012. While it is true that Greece has been hit hard by the recession since 2009, what most people won’t tell you is that even in times of financial prosperity, it’s always been a corrupt, stagnant, sexist, racist and all-around horrible place to live in if you have any kind of empathy for your fellow human being and you are entertaining thoughts such as actual, compassionate gender equality and gay people not being devil’s spawn. To quote a certain video game character, most of modern Greeks would not be able to tell right from wrong if one of them was helping the poor and the other one was banging their sister.

I didn’t take Trump lightly at all. I slept 2 hours that night and woke up with the taste of a bunch of stale cigarettes in my mouth. Held my ordinary office hours during a day that half the workplace was absent without even bothering to call in; who can blame them? Depressed students were seeing me about their quizzes and homeworks and stuff. Begging the question of whether anything of that sort actually mattered.

It’s futile to rehash what’s happened in the political arena since. Suffices to say that not even Greeks would be dumb enough to vote for somebody like that, Russian probe notwithstanding. What’s not futile to bring up is a fantastic question that I was asked by a friend of mine who wanted to challenge my thinking and make me feel better in the months that followed the election, months during which my line of thinking was completely binarized: I’m either Greek or American, I’m either lazy or hard-working, I’m either liberal or conservative. Nothing in between. The question was:

“Why are you so affected by Trump? As a white male invested into mutual funds of companies who can only benefit from deregulation, as a non-constituent who could leave at any point and go to Canada (I have Greek and Canadian citizenship), as a non-Muslim white person with a car and a credit card, why is it that you are having that hard of a time with this?

It was a fantastic question, and it’s taken me some time to find an adequate response. I’ve also had to take time off of the news to avoid aggravation. Since August, there’s been no Facebook, no Washington Post, no front-page news, nothing. Home->Work->Home. It’s been going nicely. Lets my mind clear of the stupid shit you are likely hearing every day and leaves me time for my music.

Trump affects me because his presidency makes me understand that I am a person without a country, despite having two passports. I speak Greek, my family is in Greece, but I don’t feel Greek. I haven’t for many years. I take pride in my work and I hold Science as the ultimate ideal. I can’t live in an environment like Modern Greece, where the path of least resistance is glorified. Where higher education and healthcare are both constitutional rights for citizens, but have stopped actually working since the 70s. Where women are passively accepting guys disregarding their complaints because “it’s probably that time of the month”. Where black people are considered subhumans and are the subject of very unsettling jokes, even for somebody with a very dirty mouth like myself.

So where is home then? Is it the US? Where we’ve had an African-American published neurosurgeon declare, on camera, that slaves were just “immigrants who worked very hard”? Where cheering Trump NYC voters yell “back to the reservation, faggot” to gay people after the election was over? Where there’s still debates over whether it’s good to actually give people assault rifles? Still? In 2017? Where every 20-30 year old spends their free time drinking at bars again and again and again? Where the social inequality is so obvious that the best students in our major come from three elite highschools? Where everybody is courteous and professional but nobody actually cares about anybody but themselves? Because, no matter how many “How are you doing today”s you tell me, I know that if I were in need, you wouldn’t give two shits. In Greece, if you say “hi” on the phone, you would get -at best- a welcoming grunt. But if you were hurt in a car accident, or if you were so sad you couldn’t lift yourself from bed, or if you were hurt by a loved one, you would immediately get strangers, actual strangers, hold your hand, buy you a beer and dance with you. Because Greeks, no matter how corrupt, backwards, smelly, creepy, sweaty they might seem, are actually in touch with the only thing that matters: people. It’s all about people, and going out with people, laughing with them. Loving them with all that you got at that point in time, at that location in space.

I was the proudest man in the world to come to the US. My previously documented health troubles were the first blow. An understanding that the healthcare system of the most powerful country in the world can’t figure out how to take a blood test. Avoiding giving a patient medications that will actually push them closer to death appears to be an area of active research. I was tempted to stay back during my recovery in late 2015. My PhD in the USA was in shambles, researchers I knew in Athens reached out, and I was even formally accepted into the PhD program of my alma matter. But I changed my mind and in February 2016 I came back to the States with less than what I had in 2012; a hostile advisor who couldn’t accept the fact that I fell badly sick, no guarantees of funding or Visa status 3 months after my plane landed, no signed lease. Just a suitcase and a plan. Because my will to actually excel in Computer Science and be able to do something was still irresistible. Because that has always been what the USA meant for me: Unbounded potential for somebody skilled and motivated. And so I was, letting go of the cancerous doctorate and working as an instructor of 500+ students every semester and loving every single one of them and myself more, day by day.

And then Trump.

So all this is the answer to my friend’s question, which I believe is shared by many foreign over-achievers who wanted to come here out of pure will, pure fire to excel in their trade. Unless you are one of us, you cannot hope to understand our extreme mental dichotomy and our quiet, overwhelming despair about where exactly on this goddamn planet we belong. Because even if we are in the upper echelons of Maslow’s Pyramid, this doesn’t make us immune to pain, mental health issues and existential crises. We still hurt because we have compassion, because we are logical people who can’t accept the dissemination and glorification of idiocy. Because we have invested time, money and tears in our education and expect the decision makers to be educated people who understand Science and think with equal parts numbers and compassion. And, in the US of all countries, it is stupidity that now rules.

Let me know when all this ends, please. I won’t be able to tell, because I no longer follow the news.


A deep take on countability, cardinality and ordering

I’ve been teaching CMSC250, Discrete Mathematics, over the past year in CS UMD. Last semester, I typed a more philosophical than mathematical post on Countability, Cardinality and Ordering, which I’m repeating here for the community’s sake.

After our ordinality lecture last Tuesday, I had a student come to me and tell me that they were not sure how to think about ordinality: they were understanding the relationship between cardinality and size, since it is somewhat intuitive even for infinite sets (at least to them!), but ordinality still appeared esoteric. That’s 100% natural, and in this post I will I’ll try to stray away from math and try to explain how I think about countability, cardinality and ordinality intuitivelyThis post has exactly zero things to do with the final, so if you want to limit your interactions with this website to the exam-specific, you may stop reading now.

Before we begin, I would like to remind you of a definition that we had presented much earlier in the semester, I believe during an online quiz: A set S is dense if between any two elements of it, one can find another element. Note something interesting: only ordered sets can be qualified as dense or not! Technically, we had not presented the notion of an ordered set when we discussed dense sets, but it is intuitive enough that people can understand it.


We say that any enumerable set is countable. Enumerable, mathematically, means that we can find a bijection from the non-zero naturals to the set. Intuitively, it means “you start from somewhere, and by sequentially making one step, no matter how long it takes, you are guaranteed to reach every single element of the set in finite time”. Whether this finite time will happen in one’s lifetime, in one’s last name’s lifetime, or before the heat death of the universe, is inconsequential to both the math and the intuition. Clearly, this is trivial to do for either the non-zero naturals or the full set of naturals: you start from either 1 or 0, and then you make one step “forward”.

However, we also saw in class that this is possible to also generalize for the full set of integers: we start from 0 and then start hopping around and about zero, making bigger hops every time. Those hops are our steps “forward”.

Those results are probably quite intuitive to you by now, and I feel that the reason for this might that both LaTeX: \mathbb{N} and LaTeX: \mathbb{Z} are non-dense sets.There are no naturals or integers between LaTeX: n and LaTeX: n+1 (LaTeX: n \in \mathbb{N}  or LaTeX: n \in \mathbb{Z} ).

Let’s stray away from LaTeX: \mathbb{Q}  for now and fast-forward to LaTeX: \mathbb{R} . We have already shown the mathematical reason, Cantor’s diagonalization, for which the set of reals is uncountable. But what’s the intuition? Well, to each their own, but here’s how I used to think about it as a student: Suppose that I start from zero just to make things easier with respect to my intuitive understanding of the real number line (I could’ve just as well started with LaTeX: -e^8). 

Then, how do I decide to make my step forward? Which is my second number? Is it 0.1? Is it -0.05? But, no matter which I pick as my second number, am I not leaving infinitely many choices in between, rendering it necessary that I recursively look into this infinite interval? Note that I have not qualified “infinite” with “countably infinite” or “uncountably infinite” yet. This was my personal intuition as a Discrete Math student about 11 years ago about why LaTeX: \mathbb{R}  is uncountable: Even if you assume that you can start from 0, there is no valid ordering for you to reach the second element in the sequence of reals! Therefore, such a sequence cannot possibly exist!

But hold on a minute; is it not the case that this argument can be repeated for LaTeX: \mathbb{Q} ? Sure it can, in the sense that between, say, LaTeX: 0 and LaTeX: \frac{1}{2}, there are still infinitely many rationals. It is only after we formalize the math behind it all that we can say that this is a countable infinity and not an uncountable one, as is the case of the reals. But still, we have to convince ourselves: why in the world is it that the fact that every one of these infinite numbers can be expressed as a ratio of integers make that infinity smaller than that of the reals?

Here’s another intuitive reason why we will be able to scan every single one of these numbers in finite time: everybody open the slide where we prove to you that LaTeX: \mathbb{Q}^{>0}  is countable using the snaking pattern. Make the crucial observation that every one of the diagonals scans fractions where the sum of the denominator and the numerator is static! The first diagonal scans the single fraction (LaTeX: \frac{1}{1}) where the sum is 2. The second one scans the fractions whose denominator and numerator sum is 3 (LaTeX: \frac{1}{2},\ \frac{2}{1}). In effect, the LaTeX: i^{th} diagonal scans the following fractions:

LaTeX: \{ \frac{a}{b} \mid (a,b \in \mathbb{N}^{\geq 1}) \land (a + b=i+1)\}

For those of you that know what equivalence classes are, we can then define LaTeX: \mathbb{Q}^{>0}  as follows:

LaTeX: \mathbb{Q}^{>0} = \bigcup_{i \in \mathbb{N}}\{ \frac{a}{b} \mid (a,b \in \mathbb{N^{\geq 1}}) \land (a + b=i+1)\}

Let’s see this in action…

LaTeX: \mathbb{Q}^{>0} = \{ \color{red}{\underbrace{ \frac{1}{1}}_{i=1}}, \color{blue}{ \underbrace{\frac{1}{2}, \frac{2}{1}}_{i=2}} , \color{brown}{\underbrace{\frac{1}{3}, \frac{2}{2}, \frac{3}{1}}_{i=3}}, \dots \}

Note that essentially, with this definition, we have defined a bijection from LaTeX: \mathbb{N^{\geq 1}} \times \mathbb{N^{\geq 1}} to LaTeX: \mathbb{Q}. We know that LaTeX: \mathbb{N}^{\geq 1} \times  \mathbb{N}^{\geq 1} is countable, so we now know that LaTeX: \mathbb{Q}^{> 0}  is also countable! 🙂

Let’s constrain ourselves now to the original challenge that we (I?) are faced with: we have selected 0 as our first element in the enumeration of both LaTeX: \mathbb{Q}  and LaTeX: \mathbb{R}  (the latter is assumed to exist), and no matter which our second element is (say it’s LaTeX: \frac{1}{2}), we have infinitely many elements in both sets between 0 and LaTeX: \frac{1}{2}But now we know that those infinites are different: in the case of LaTeX: \mathbb{Q} . we know for a fact that we will reach all of those fractions whose decimal values are in LaTeX: (0, 0.5). In the case of LaTeX: \mathbb{R} , there is no such enumeration: any enumeration we define will still leave an… uncountably infinite gap between any two elements in “sequence”.

Remember how in our lecture on Algebraic and Transcendental numbers, we gave only three examples of numbers in LaTeX: TN, yet the fact that LaTeX: TN is uncountable when LaTeX: ALG is countable guarantees that there are “many more” Transcendental numbers than Algebraic? Same thing applies here with the rationals and irrationals: given any interval of real numbers LaTeX: (r_1, r_2), there are many more irrationals than rationals inside that interval... If you define a system of whole numbers (integers), there are many more quantities that you will not be able to express as a ratio of integers. That’s why back in the day (300 B.C) when Euclid proved that LaTeX: \sqrt 2 is not expressible as such a ratio LaTeX: \frac{a}{b} (or, more accurately, that LaTeX: 2 cannot be expressed as the square LaTeX: \frac{a^2}{b^2}) his result was so unintuitive; those Hellenistic people did not have rulers. They did not have centimeters or other accepted forms of measurement. The only thing they had were shoestrings, or planks of wood which they put in line and “saw” that they were the same length, and then they measured everything else as the ratio of such “whole” lengths.


Recall something that we said when we were discussing the factorial function and its combinatorial interpretations when applied on positive integers. Bill’s explanation of why LaTeX: 0!=1 was purely algebraic: If it were LaTeX: 0, then, given the recursive definition LaTeX: n!\:=\:n\:\cdot\left(n-1\right)! for LaTeX: n\:\ge1, every LaTeX: n! would be LaTeX: 0rendering it a pretty useless operation. My explanation was combinatorial: we know that if we have a row of, say, LaTeX: n marbles, there are LaTeX: n! different ways to permute them, or LaTeX: n! different orderings of those marbles. When there are no marbles, so LaTeX: n=0there is only one way to order them: do nothing, and go watch Netflix. 

Let’s stick with Bill’s interpretation for a moment: the fact that some things need to be defined in order to make an observation about the real world work. In this case, the real world is defined as “algebra that makes some goddamn sense”. My explanation is more esoteric. You could say: “What do you mean there’s only one way to arrange zero things? I don’t understand, if there are zero things and there’s nothing to do, shouldn’t there be, like, 0 ways to arrange them?”. So, let’s stick with Bill’s interpretation to explain something that I attempted to explain to a group of students after our first lecture this semester: Why do negative numbers even exist?

Here’s one such utilitarian explanation: Because without negative numbers, Newtonian Physics, with their tremendous application in the real world, would not work. That is, the model of Newtonian Kinematics with its three basic laws, which has been empirically proven to describe very well things that we observe in the real world, needs the framework of negative numbers in order to, well, work. So, if you’re not ok with the existence of negative numbers, you had better also be able to describe to me a framework that explains a bunch of observations on the real world in some way that doesn’t use them. For example, you probably all remember the third law of Newtonian motion: For every action LaTeX: \color{red}{\vec{F}}, there exists an equal and opposite reaction LaTeX: \color{red}{-\vec{F}}:

Recall that force is a vectoral quantity since it is the case that LaTeX: \vec{F} = m \cdot \vec{a}, and acceleration LaTeX: \vec{a} is clearly vectoral, as the second derivative of transposition LaTeX: \vec{x}

The only way for Newton’s third law of motion can work is if LaTeX: \vec{F} + (-\vec{F}) = \vec{0}. This is only achievable if the two vectors have the same magnitude but exactly opposite directions. No other way. Hence the need to define the magnitudes as follows:

LaTeX: | |\vec{F}|| = \frac{1}{2} \cdot m \cdot a^2,\ | |\vec{\color{red}{-}F}|| = \color{red}{-}\frac{1}{2} \cdot m \cdot a^2

and the necessity for negative numbers becomes clear. Do you guys think the ancient Greeks or Egyptians cared much for negative numbers? They were building their theories in terms of things they could touch, and things that you can touch have positive mass, length, height…

Mathematics is not science. It is an agglomeration of models that try to axiomatize things that occur in the real world. For another example, ZFC Theory was developed in place of Cantorian Set Theory because Cantorian Set Theory can lead to crazy things such as Russel’s Paradox. Therefore, ZFC had to add more things to Set Theory to make sure that people can’t do crazy stuff like this. If we discover contradictions with the real world given our mathematical model, we have to refine our model by adding more constraints to it. Less constraints, more generality, potential for more contradictions. More constraints, less generality, less contradictions, but also more complexity.

So when discussing the cardinality of LaTeX: \mathbb{N}  and LaTeX: \mathbb{Z}  and finding it equal to LaTeX: \aleph_0, we are faced with a problem with our model: the fact that LaTeX: \color{magenta}{\mathbb{N} \subset \mathbb{Z}} (I have used the notation of proper subset here deliberately). Now, I just had a look at our cardinality slides, and it is with joy that I noticed that we don’t use the subset / superset notation anywhere. That’s gonna prove a point for us.

So, back to the original problem: intuitively understanding why the hell LaTeX: \mathbb{N}   and LaTeX: \mathbb{Z}  have the same cardinality when, if I think of them on the real number line, I clearly have LaTeX: \mathbb{N} \subset \mathbb{Z}:

LaTeX: \underbrace{\dots, -4, -3 , -2, -1, \underbrace{0, 1, 2, 3, 4, \dots}_{\mathbb{N}} }_{\mathbb{Z}}

The trouble here is that we have all been conditioned from childhood to think about the negative integers as “minus the corresponding natural”. This conditioning is not something bad: it makes a ton of sense when modeling the real world, but when comparing cardinalities between infinite sets, that is, sets that will never be counted entirely in finite time, we distance ourselves from the real world a bit, so we need a different mathematical model. To that end, let’s build a new model for the naturals. Here are the naturals under our original model:

LaTeX: 0, 1, 2, 3, \dots

This digits that we have all agreed to be using have not been around forever. The ancient Greeks used lowercase versions of their alphabet: LaTeX: \alpha, \beta, \gamma, \delta , \epsilon, \sigma \tau ', \zeta,\ \dots\ \omega  to name a total of 25 “digits”, while the Romans used a subset of their alphabet “stacked” in a certain way: LaTeX: I, II, III, IV, V, VI, \dots, X, XI\dots . These “stacked” symbols cannot be really called digits the way that we understand them, especially since new symbols appear long down the line (LaTeX: C, M) etc. These symbols we actually owe to the Arabic Renaissance of the early Middle Ages.

The point is that I can rename every single one these numbers in a unique way and still end up with a set that has the exact same properties (e.g closure of operations, cardinality, ordinality) as LaTeX: \color{red}{\mathbb{N}}. This is formally defined as the Axiom of Replacement. So, let’s go ahead and describe LaTeX: \mathbb{N}  by assigning a random string for every single number, assuming that no string is inserted twice:

LaTeX: foo, bar, otra, zing, tum, ghi,\dots

Which corresponds to our earlier

LaTeX: 0, 1, 2, 3, 4, 5,\dots

Cool! Now the axiom of replacement clearly applies to LaTeX: \mathbb{Z}  as well, so I will rewrite

LaTeX: \dots, \color{blue}{-5, -4, -3, -2, -1,}\ \color{magenta}{0, 1, 2, 3, 4, 5,}\dots


LaTeX: \dots, \color{blue}{qwerty, forg, vri, zaq,  nit,}\ \color{magenta}{bot, ware, yio, bunkm, ute, kue,}\dots

Call these “transformed” sets LaTeX: \mathbb{N}_{new} and LaTeX: \mathbb{Z}_{new} respectively. Under this encoding, guys, I believe it’s a lot more obvious that LaTeX: \mathbb{N}_{new} \not\subset \mathbb{Z}_{new} in the general case. LaTeX: \mathbb{N}_{new} \subset \mathbb{Z}_{new} under these random encodings is so not-gonna-happenish that its probability is not even axiomatically defined. Therefore, now we can view LaTeX: \mathbb{N}  and LaTeX: \mathbb{Z}  as infinite lines floating around space, lines that we have to somehow put next to each other and see whether we can line them up exactly. If you tell me that even under this visualization, the line that represents LaTeX: \mathbb{Z} _{new} is infinite in both directions, whereas that of LaTeX: \mathbb{N}_{new}  has a starting point (0), then I would tell you that I can effectively “break” the line that represents LaTeX: Z_{new} in the middle (0) and then mix the two lines together according to the mapping that corresponds to:

LaTeX: 0, 1, -1, 2, -2, 3, -3, \dots

Now we no longer have the pesky notation of the minus sign, which pulls us to scream “But the naturals are a subset of the integers! Look! If we just take a copy of the naturals and put a minus in front of them, we have the integers!”. We only have two infinite lines, that start from somewhere, extend infinitely, and it is up to us to find a 1-1 and onto mapping between them. That is, it is up to us find a 1-1 mapping between:

LaTeX: foo, bar, otra, zing, tum, ghi,\dots


LaTeX: bot, ware, nit, yio, zaq, bunkm\dots

(Note that I re-ordered the previous encoding LaTeX: \dots, \color{blue}{qwerty, forg, vri, zaq,  nit,}\ \color{magenta}{bot, ware, yio, bunkm, ute, kue,}\dots according to the “hopping” map into  LaTeX: \color{magenta}{bot}, \color{magenta}{ware}, \color{blue}{nit,} \color{magenta}{yio}, \color{blue}{zaq}, \color{magenta}{bunkm},\dots .)

Under this “visual”, you guys, it makes a lot of sense to try to estimate if the two sets have the same cardinality and, guess what, they do 🙂

Not much else to say on this topic everyone. We can have a bunch of applications of the axiom of replacement to prove, for example, that the cardinality of the integers, LaTeX: \aleph_0, is also the cardinality of LaTeX: \mathbb{N} \times \mathbb{N}LaTeX: \mathbb{Q} , etc. It is only when we start considering sets such as LaTeX: \mathbb{R} , \mathcal{P}(\mathbb{N}) and LaTeX: \{0, 1 \}^\omega  that this idea that we can be holding two infinite lines in space fails.


There’s not much to say here except that the easiest way to understand how an order differs from a set is to consider an ordering exactly as such: an order of elements! Think in terms of “first element less than second less than third less than …. “. The simplest way possible. It is then that we can prove rather easily that LaTeX: \omega \prec y \prec \zeta .

Things only become a bit more complicated when considering the ordering LaTeX: \omega + \omega:

LaTeX: 0 < \frac{1}{2} < \frac{3}{4} < \frac{5}{6} < \dots <1 < \frac{3}{2} < \frac{4}{3} <\dots <2 <\dots

Please note that this ordering is clearly not the same as LaTeX: \eta, the ordering of LaTeX: \mathbb{Q} . Between the first and the second element, for instance, there are countably many infinite rationals: LaTeX: \frac{1}{100}, \frac{2}{5}, \dots , \frac{3}{7}\dots  which are not included in the ordering. 

Finally, realize the meaning of “incomparable” orderings: a pair of orderings LaTeX: \alpha, \beta  will be called incomparable if, and only if:

LaTeX: (\alpha \npreceq \beta) \wedge (\beta \npreceq \alpha).

So please realize that this is not the same as saying, for instance, LaTeX: \beta \nprec\alpha .

I think this is all, I am bothered when I can’t explain something well to a student so I thought I’d share my views on countability in case the subject becomes easier to grasp.


Piazza sucks.

I’m in Academia. Well, at least the part of Academia that’s still related to actual teaching.

The vast majority of my collaborators in UMD as well as in other institutions use Piazza to host their courses. It’s easy, it’s fast and at the very least it looks like it has close to 100% uptime (written during a time that our UMD fork of Instructure’s Canvas has been down for hours).

However, active development on Piazza has effectively stopped since early 2015. During Fall 2016, I would look at my Android Play Store for updates on the Piazza app and for a long time the latest one would date back to February 2015. Right now, it appears that certain patches have been made as early as Feb 7,2017, but the app is still atrocious. This is just an example of the many issues that surround Piazza.

The most major issue, for which I just submitted a bug report, is the fact that there is no filesystem consistency on Piazza. If you use the “Resources” tab and post a link to the file in a discussion topic, and you want to make a change to the file, then all the other links become stale. They point to positions in an Amazon S3 filesystem. When the number of links to a file grow, this becomes a huge problem.

Furthermore: the only way to password-protect your page right now (of importance to any person who needs a private discussion forum), you need to actually send an e-mail to team@piazza.com with your password choice, which of course is then stored in cleartext in your e-mails. My response was immediately adhered to, but what happens if you need to password-protect it during a weekend? I use Piazza to communicate with my TAs, and the information conveyed is often sensitive (thoughts on midterms, recitation topics, rubrics). I don’t want students snooping around (it’s already happened once this semester).

Piazza is perfect for communication: students love it, because other students can immediately offer responses. In contrast, nobody ever uses the Canvas “Discussion” feature. However, in departments where the average course registration is in the hundreds (like us), moderating such a huge forum requires TAs dedicated to doing only that. It’s not impossible, but it’s hard. Ensuring that solutions to problems under active submission don’t leak is tough. A student can take down a post within minutes, yet a PDF with solutions can already have reached a good portion of the class.

But all of these things are simple issues of technical decisions and design. They could be met through either Bug Reports or (a)synchronous brainstorming sessions using tools like Confluence or HipChat. What really bugs me is how the Piazza team doesn’t seem to care any more about the product, shifting their entire focus into making it yet another recruitment platform, which they call “Piazza Careers“. Seriously? That’s what students need? Another recruitment platform? I’m guessing that the Piazza team had some sort of shift in their venture capital and it was required of them to transform the entire platform into another recruiting platform.

It’s a real bummer. Blackboard has been a disaster (link) and Canvas has too many issues to discuss in a blog post. Active Learning services like TopHat are breakable when people use their phones. I recently had a student pretty much admitting to me during my office hours that they never attended the lectures of a certain math course, but had a friend of theirs text them the TopHat code and the proper answers to the questions. The clickers and accompanying software offered by Turning Technologies  have multiple issues of connectivity, even though those issues mostly have to do with the ELMS-CANVAS integration and not the software or clicker device itself.

We need reliable educational software. Not another recruitment platform. Pooja Shankar, an alumni of CS UMD and the founder of Piazza, ought to be the first person to recognize this.




I had my Discrete Math students critique Charlie the Unicorn, and here is how some responded.

Title says it all. This summer I’m teaching CMSC 250, “Discrete Structures” (really, this is a misnomer; I have no idea why we don’t call it “Discrete Mathematics”), to undergraduate students in the Department of Computer Science at UMD. As one of the requirements of the course, I had them review the epic saga of Charlie the Unicorn and submit a short essay. Now I knew these kids are bright and have a sense of humor, yet once again they surpassed all expectations.

Here are anonymous excerpts of what was handed to me:

The “Charlie the Unicorn” series has taught me about the dangers of the world we live in today. Life isn’t always rainbows and unicorns and I’m pretty glad it isn’t. That world seems messed up. There are tons of two-faced people out there and it is important to read through them or else they will get you to think you are the banana king and steal your stuff.

Why yes indeed, you never know when that might happen.

The Pink and Blue Unicorns are sociopathic robbers who are unable to distinguish
reality from fantasy, as well as being able to force their fantasies onto others through either hypnosis or hallucinogenic drugs. It is obvious that these two unicorns are a threat to society and need to be put into an insane asylum and be rendered unable to create their fantasy worlds.

Ouch! So much for second chances.

While Charlie is being manipulated, they continually make fun of him and steal his belongings. These acts seem to be unprovoked and only cause them enjoyment; they gain no real reward from these acts. Each situation they get Charlie into results in a catchy song followed by the immediate death of the performer.

My favorite part of Charlie the unicorn was the part when Charlie is convinced that he is the banana king. It’s probably true that if you levitate and shine and light on someone you could probably convince them of anything.

In an attempt to make sense of this video, the only conclusion that I could come to was that this is what Jason Steele, the creator of Charlie the Unicorn, experienced while higher than a kite. I would imagine that his stoner hallucinations were best manifested in a video where he and his friends were portrayed by unicorns, so that is exactly what Steele created.

Some people were more introspective than others:

Charlie the Unicorn is a politically-themed satire lambasting both Democratic and Republican politicians alike.  In the video, Democrats are symbolized by the blue horse and Republicans, the red.  The third horse, Charlie, represents the average citizen, with his white color additionally connoting the average citizen’s relative innocence and naïveté in politics.  The blue and red horses—henceforth referred to as “the purple horses”—employ fanciful promises and extreme enthusiasm to slowly goad the white horse—who is initially reluctant—into travelling to Candy Mountain with them.  This journey represents an ordinary citizen being stirred out of political apathy by the campaigning of a compelling politician spouting ideals, hopes, and promises of a better tomorrow.  However, the motivations of the purple horses were not so noble or selfless;[…]

While others actually hinted towards inductive reasoning / rule learning:

Each adventure involves an annoying commute to the destination with the pink and blue unicorn, arriving at the destination, receiving a song, having the singer blow up, and then Charlie somehow being put into danger. From this pattern, we can build an implication relationship which Charlie quickly learned. If Charlie goes on an adventure with the pink and blue unicorn, then he will be put in danger. As far as then fourth chapter of their adventures, this rule has been valid. But we do not know for sure if it will apply for future episodes.

Or human persuasion techniques:

To me the fact that there are 3 unicorns was interesting. People tend to believe when more than 3 people start believing some idea. For example if 3 people points to the sky in the middle of the road, other people start looking at the sky since people think there must be reason the 3 people are pointing to the sky. It is called the “Power of 3”.

This person, along with the person who provided the politically themed comments, seemed to be the ones closer to what the Internet believes the videos to be about:

One thing I did find interesting throughout all the episodes is that no matter how evil the things were Pink and Blue unicorn did to Charlie were (like taking his kidney), he went on every single adventure with them. After losing my kidney or my belongings by hanging out with my friends I wouldn’t want to hang out with them anymore. I don’t know if they’re necessarily Charlie’s friends to begin with which makes me question his decisions to follow them even more. In the last episode, Pink and Blue unicorn tried to take his life, but starfish came and rescued Charlie. I honestly could not stop laughing when starfish told Charlie that he was a star and then when Charlie made the wish, starfish’s eyes burned out. I was questioning why starfish was so in love with Charlie in the third episode, but good thing he was a starfish or else Charlie wouldn’t have lived. YOLO. I wonder why Pink and Blue unicorn were able to take everything away from Charlie except for his life. Was the creator trying to tell us something there? Whatever, I’m not going to think too much into it. A+, 10/10 would watch again.

Finally, if you’re interested in finding what the Internet thinks these videos are about, (a) You have a serious problem and (b) Here you go: