Narendra Modi and the Correlation Term

In a speech in Canada last night, Prime Minister Narendra Modi said that the relationship between India and Canada is like the “2ab term” in the formula for expansion of (a+b)^2.

Unfortunately for him, this has been widely lampooned on twitter, with some people seemingly not getting the mathematical reference, and others making up some unintended consequences of it.

In my opinion, however, it is a masterstroke, and brings to notice something that people commonly ignore – what I call as the “correlation term”. When any kind of break up or disagreement happens – like someone quitting a job, or a couple breaking up, or a band disbanding, people are bound to ask the question of whose fault it was. The general assumption is that if two entities did not agree, it was because both of them sucked.

However, considering the frequency at which such events (breakups or disagreements ) happen, and that people who are generally “good” are involved in such events, the badness of one of the parties involve simply cannot explain them. So the question arises – if both parties were flawless why did the relationship go wrong? And this is where the correlation term comes in!

It is rather easy to explain using vector calculus. If you have two vectors A and B, the magnitude of the sum of the two vectors is given by \sqrt{|A|^2 + |B|^2 + 2 |A||B| cos \theta} where |A|,|B| are the magnitudes of the two vectors respectively and \theta is the angle between them. It is easy to see from the above formula that the magnitude of the sum of the vectors is dependent not only on the magnitudes of the individual vectors, but also on the angle between them.

To illustrate with some examples, if A and B are perfectly aligned (\theta = 0, cos \theta = 1), then the magnitude of their vector sum is the sum of their magnitudes. If they oppose each other, then the magnitude of their vector sum is the difference of their magnitudes. And if A and B are orthogonal, then cos \theta = 0 or the magnitude of their vector sum is \sqrt{|A|^2 + |B|^2}.

And if we move from vector algebra to statistics, then if A and B represent two datasets, the “cos \theta” is nothing but the correlation between A and B. And in the investing world, correlation is a fairly important and widely used concept!

So essentially, the concept that the Prime Minister alluded to in his lecture in Canada is rather important, and while it is commonly used in both science and finance, it is something people generally disregard in their daily lives. From this point of view, kudos to the Prime Minister for bringing up this concept of the correlation term! And here is my interpretation of it:

At first I was a bit upset with Modi because he only mentioned “2ab” and left out the correlation term (\theta). Thinking about it some more, I reasoned that the reason he left it out was to imply that it was equal to 1, or that the angle between the a and b in this case (i.e. India and Canada’s interests) is zero, or in other words, that India and Canada’s interests are perfectly aligned! There could have been no better way of putting it!

So thanks to the Prime Minister for bringing up this rather important concept of correlation to public notice, and I hope that people start appreciating the nuances of the concept rather than brainlessly lampooning him!

How 2ab explains net neutrality

I’ve temporarily resurrected my blog on the Indian National Interest, and this post is mirrored from there. This is a serious argument, btw. After a prolonged discussion at Takshashila this morning, I convinced myself that net neutrality is a good idea.

So Prime Minister Narendra Modi has set off this little storm on Twitter by talking about the relationship between India and Canada being similar to the “2ab term” in the expansion of (a+b)^2 .

Essentially, Modi was trying to communicate that the whole of the relationship between India and Canada is greater than the sum of parts, and it can be argued that the lack of a “cos \theta” term there implies that he thinks India and Canada’s interests are perfectly aligned (assuming a vector sum).

But that is for another day, for this post is about net neutrality. So how does 2ab explain net neutrality? The fundamental principle of the utility of the Internet is Metcalfe’s law which states that the value of a telecommunications network is proportional to the square of the number of entities in the network. In other words, if a network has n entities, the value of these n entities being connected is given by the formula k n^2 . We can choose the unit in which we express utility such that we can set k = 1, which means that the value of the network is n^2.

Now, the problem with not having net neutrality is that it can divide the internet into a set of “walled gardens”. If your internet service provider charges you differentially to access different sites, then you are likely to use more of the sites that are cheaper and less of the more expensive sites. Now, if different internet service providers will charge different websites and apps differently, then it is reasonable assume that the sites that customers of different internet services access are going to be different?

Let us take this to an extreme, and to the hypothetical case where there are two internet service providers, and they are not compatible with each other, in that the network that you can access through one of these providers is completely disjoint from the network that you can access through the other provider (this is a thought experiment and an extreme hypothetical case). Effectively, we can think of them as being two “separate internets” (since they don’t “talk to” each other at all).

Now, let us assume that there are a users on the first internet, and b users on the second (this is bad nomenclature according to mathematical convention, where a and b are not used for integer variables, but there is a specific purpose here, as we can see). What is the total value of the internet(s)?

Based on the formula described earlier in the post, given that these two internets are independent, the total value is a^2 + b^2. Now, if we were to tear down the walls, and combine the two internets into one, what will be the total value? Now that we have one network of (a+b) users, the value of the network is (a+b)^2 or a^2 + 2 ab + b^2 . So what is the additional benefit that we can get by imposing net neutrality, which means that we will have one internet? 2 ab, of course!

In other words, while allowing internet service providers to charge users based on specific services might lead to additional private benefits to both the providers (higher fees) and users (higher quality of service), it results in turning the internet into some kind of a walled garden, where the aggregate value of the internet itself is diminished, as explained above. Hence, while differential pricing (based on service) might be locally optimal (at the level of the individual user or internet service provider), it is suboptimal at the aggregate level, and has significant negative externalities.

#thatswhy we need net neutrality.

Gloomy weather

For most of today, the weather in Bangalore has been what most people would traditionally classify as “gloomy”. The sun has mostly been invisible, popping out only now after a fairly strong shower. There has been a rather thick cloud cover, with the said clouds being mostly dark. There has been the threat of rain all day, culminating in a rather powerful shower an hour back.

I haven’t minded the weather one bit, though, though it helps that I haven’t had to step out of home all day. I’ve been happy sitting by the window, sipping coffee and tea and green tea, and eating Communist peanuts, and working. In fact, I’ve grown up considering this kind of weather (cool, cloudy, with a hint of drizzle) as being the ideal romantic weather, and when the weather turns this way nowadays, I miss the wife a whole lot more! Till recently, I never understood why such weather was traditionally classified as “gloomy”. Until I went to Europe to visit the wife last month.

March in Europe is traditionally classified as “Spring” (summer doesn’t come until June there, which is hard for someone from Bangalore, where summer ends in May, to understand), but in most places I went to (I visited five different cities during my trip), the weather was basically shit. I had carried along my “winter jacket” (bought at a discount in Woodland at the end of last winter), and didn’t step out even once without it. It was occasionally accompanied by my woollen scarf and earmuffs, with hands thrust into pockets.

For days together the sun refused to come out. In fact, our entire trip to Vienna was a washout because of the weather. Thick dark clouds and no sun might be romantic in tropical Bangalore, but in Vienna, where it is accompanied by chilling winds and occasionally maddening rain (and once snow), it can be devastating. It can cause insane NED – you might argue that if weather was so bad in Vienna we could have used it as an excuse to stay inside museums and see things, but the gloom the weather causes is real, as we frittered and wasted hours in an offhand way, hanging around in coffee shops doing nothing, and just touring the city in trams, again doing nothing (we had got a three-day pass).

The one time the sun peeped out (after a heavy shower like this afternoon’s in Bangalore), we went ecstatic, but our joy was shortlived as it was quickly followed by another downpour which killed our enthu for the rest of the day.

The bad weather followed us all though our 10-day trip across Prague, Vienna and Budapest. The first and last being former Soviet cities didn’t help, as the (really beautiful from inside) apartment we stayed in Prague was in a rather dreary area, with the weather making the locality even more depressing. As a consequence, we hardly hung around in the locality, taking away dinner on each of the three days we were there. Our Budapest apartment was in a more vibrant part of town (most of our meals were within 500m of our apartment) but the general dreariness and chill meant that we didn’t explore as much as we would have otherwise done, perhaps.

We were back in Barcelona (which too had been rather dreary in March) last Saturday night, and when there was bright sunshine on Easter Sunday morning as we went to the nearby bakery for breakfast, we were absolutely ecstatic. We spent time just sitting on the parkbench, soaking in the sunshine. I made a mental note that if I’m going those parts next spring, I should go there AFTER Easter and not before (like this year). I also made a mental note to never again question why weather that is traditionally called “gloomy” is called so.

What makes a Gencu successful?

Last evening I participated in a gencu with Cueballs and Zulu. First of all, let me explain what “gencu” is. It’s a term coined by the wife, and is short for “general catch up”. The reason she coined it was that for a while I was meeting so many people without any real agenda (I still do. Did four such meetings yesterday including the aforementioned) that she felt it deserves its own coinage.

So she would ask “what are you doing today?”. “Meeting this person”, I would respond. “Why?” would be the obvious next question. “No specific reason. Gen catch up”, I would respond.

I ended up saying “Gen catch up” so many times that she decided to shorten it to “gencu”, and we use the term fairly often now. This is the first attempt at publicising it, though. And no, unlike me, she still doesn’t do too many gencus.

So the thing with gencus is that you have no specific agenda, so if you don’t have anything to talk about, or don’t find each other particularly interesting, the meeting can quickly unravel. You can soon run out of things to talk about, and quickly you will start discussing who you are in touch with. So in that sense, gencus can have a high chance of failure (especially if you are meeting the counterparty for the first time or after a long time), and this is one of the reasons why the wife doesn’t do gencus.

One way of insuring against gencus going bad is to have more players. When you have three people, the chances of the gencu going bad are reduced (can’t be ruled out, but the probability decreases). In that sense, you get to meet two people at the same time with the insurance that you will not get bored. On the downside, if there is something specific that two of you want to talk about, you either have to shelve it or let the third person get bored.

While riding to another gencu after the one with Cueballs and Zulu (I must mention that none of the three of us felt the need for a third person to “insure” the gencu. Those two were planning a gencu openly on twitter and since I wanted to meet them both, I invited myself, that’s all!), I was thinking of what can make a multiparty (> 2) gencu successful. I was thinking of my recent multiparty gencus, and most of them had been pleasant and enjoyable, and never boring for any party.

The key to making a multiparty gencu successful, I realised, is mutual respect (ok I’m globing now, I admit). I’ve been through bad 3-way gencus too, and the problem with those has been that two of the three dominate, and don’t let the third person speak (a group discussion like atmosphere). Or two of three have a common interest or connection and speak too much about that, excluding the third person. Such meetings might be okay for one or two parties (among those that are dominating) but definitely uncomfortable for the third.

The above point had two people dominating the gencu at the cost of the third being a problem. Sometimes you don’t even need two people for that. One of the three people can simply hijack the whole thing by talking about themselves, or their pet topic, at the exclusion of the other two people (such people don’t really need counterparties for conversation, but still choose to attend multiparty gencus).

The network structure before the meeting is also important. In our case yesterday, we knew each other “pair-wise”, so it was a complete graph at the beginning of the meeting itself. Not all three-party gencus are like this, and it is possible for two people at one such gencu to not know each other before. This can occasionally be troublesome, since the law of transitivity doesn’t hold for people getting along with or liking people, so if A knows B and B knows C, there is no guarantee that A will get along with C. It can also happen that B will give more importance to talking to A than to talking to C (been affected by this from all three sides in the past). It might be hard to find stuff that everyone finds interesting, resulting in leaving out people. And so forth.

What about larger groups? Groups of five or bigger I’ve seen usually devolving into smaller groups (a notable exception was this one drinking session in late January, where we were 7 people and still had only one (excellent) conversation going), so they need not be analysed separately. Groups of 4 can work, but I prefer groups of 3 (maybe I’ll do a more rigorous analysis of this in a later post).

So what’s your experience with Gencus? What is the ideal number, and how do you go about it?

On the wife looking Hispanic

So the wife had mentioned to me sometime in the past that many people here in Barcelona mistake her to be Hispanic, and instinctively talk to her in Spanish, which she is not very good at (though she is much better than me, and is taking regular lessons in her university). She claimed that it was because of her skin colour (“fair” by Indian standards, but much darker than white), and “features”.

Now, as far as I can see, she has no Hispanic blood. She is a born and thoroughbred Gult (though her ancestors migrated to Karnataka generations ago). So when she first mentioned this to me a few months back, I didn’t particularly believe her. And then it happened last night.

We were taking a RyanAir flight from Budapest to Barcelona. I was in the aisle seat and she was in the middle seat, and as the drinks cart passed by us, I asked for a Coke (and was offered a Pepsi, and must mentioned that the Pepsi I thus got is nowhere similar to the oversweet Pepsi we get in India. It was actually good), and held a conversation with the steward for over two minutes, speaking in English all the time.

Once the steward had handed me the can of Pepsi and two glasses with ice, the stewardess on the other side of the drinks cart said “that would be two Euros fifty”. Since I wasn’t carrying money (our division of labour (and hedge) during the trip was that I carried the local currency and debit card, while the wife carried Euros), the wife shuffled into her pocket for change.

The stewardess promptly noticed this and immediately said “dos cincuenta” – Spanish for “two fifty”. Clearly she thought the wife was Hispanic! And it is not that the stewardess hadn’t heard me speak to the steward all the time so far, in fairly chaste English!

This must go down as a bizarre occurrence, except that from what the wife tells me this is a rather common issue with her. And she treats this as a feature, not a bug.

Anyway, here is a picture taken on the day that the wife told me that people in Spain mistake her to be Hispanic. This picture was taken in October, on the first day of my first visit to Barcelona.

profile

Borrowing chip and pin credit cards

Just before she left for school on Friday, the wife told me that her debit card was in a certain drawer in her cupboard, and I should use it in case I wanted to go out. She told me the PIN and said that I could wish to draw money from the ATM downstairs if necessary, or simply swipe the card wherever I go.

I’ve always been queasy about borrowing or lending credit/debit cards. I’ve always thought that it’s illegal to use someone else’s card, even with their consent. The traditional way a credit/debit card works, your signature on the charge slip is supposed to be compared to the signature on the back of the card, and the merchant can refuse you service if the two don’t match (this is seldom implemented in India, but that’s the theory). For that reason, if i were to use the wife’s credit card and the waiter sees that the signature on the charge slip doesn’t match that on the card (obviously!), it might lead to an embarrassing situation.

For this reason I ended up withdrawing a significant amount from the ATM and using the cash thus withdrawn for my expenses. Looking at credit/debit card swipes in action later on, however, I was wondering if it was actually necessary to do so.

In Europe, like in India (Europe is the leader, India followed; US has no plans to follow it seems), all credit and debit cards are chip-and-PIN based cards. The credit card is not swiped in the terminal, but instead is inserted in a way that the terminal can read an embedded chip (more secure than the magnetic stripe). To this, you enter a four-digit PIN, which acts as the validation after which the charge gets approved. Typically, after you’ve approved a transaction with your PIN, a signature is not required, though in India they insist on it (despite the charge slip saying “PIN verified; signature not required”).

And that is what I’ve noticed here in Spain ever since I withdrew money from the ATM that day – there is no requirement for signature in any transaction. The waiter (let’s say we’re at a restaurant) brings the swiping machine, you enter the card, the waiter enters the amount and you enter your PIN, and out comes the slip and the waiter hands back the card to you and walks away. No signature! And this is standard practice across all debit and credit card terminals!

A possibly unintended advantage of this is that it’s now possible to borrow (with permission) someone else’s credit or debit card and actually use it!

Amending the snooze function in alarm clocks

This is an idea that appeared to me in my dreams. Really. I’m not joking. Or maybe I thought of it as soon as I woke up this morning – in the cusp of dreams and reality, and then presently fell back asleep. Either ways, it doesn’t matter. The idea is surely mine, and not knowing how to profit from it I’m making it public.

The basic idea is that the inter-snooze interval between consecutive alarms should decrease geometrically. Currently, alarm clock apps on mobile phones have a fixed snooze duration. For example, my Moto G has a fixed snooze duration of 6 minutes (which I think i can change through settings, but will remain fixed at the new level then). The wife’s iPhone has a fixed snooze duration of 5 minutes (again customisable I believe).

However, I believe that this is illogical and makes you wake up over a longer time interval than necessary. The reasoning is that the degree of wakefulness at each alarm ring is different. When you wake up at the second ring (after you’ve snoozed it once), you’re more wakeful than you were when the alarm rang for the first time. After you’ve snoozed for the second time, you are unlikely to go into as deep sleep as you did when you snoozed it for the first time, in which case you are unlikely to go into the kind of deep sleep you were in before the first ring of the alarm clock.

By keeping the inter-snooze duration constant, what the alarm clock is doing is to give you an opportunity to go back in into the same kind of deep sleep (the longer you sleep between alarm rings, the greater the possibility that you will go back into deep sleep), which further impedes your complete waking up.

What is ideal is that the first time you get woken up from deep sleep, you struggle, snuggle and snooze, and go back to sleep. The next time you should be woken up before you’ve hit the deep sleep phase. You wake up again, struggle, snuggle and snooze, and go into shallower sleep. The next alarm ring should catch you at this shallower stage, and rouse you up. And so on.

So what I’m proposing is that the inter-snooze interval in alarm clocks should decrease geometrically. So if the first inter-snooze interval lasted five minutes, the next one should last less than that, and the one after that even less than that. Each time this interval should come down by a pre-defined fraction (let’s say half, without loss of generality). That way, even if you snooze multiple times, it ensures that you finally wake up in a time-bound fashion (beyond a point, the snooze duration becomes so small that it rings continuously until you switch off and wake up, and by then you have attained full consciousness).

So the way I want my alarm clock designed is that I define how much time I want to wake up in (let’s say default is 20 minutes), and a (harder to change) multiplicative factor by which inter-snooze times come down (default is half), and the inter-snooze interval decreases accordingly geometrically so that you wake up in exactly the time that you’ve initially specified!

So with the defaults of 20 and 1/2, the inter-snooze periods will be 10 mins, 5 mins, 2 min 30 secs, 1 min 15 secs, 37.5 secs, 18.75 secs, … by which time you should be annoyed enough to have woken up but yet wakeful enough having drifted back only just enough!

I think this is a world-changing idea, but I mention again that I don’t know how to commercialise it so putting it out in the open. If you think this works for you, thank me!

And perhaps this is a good assignment to start my career in programming mobile phone apps. Should I start with iOS or Android? (I have an android phone and an iPad).