Thursday, 20 December 2012

Little Joys of Discovery #2: A Theorem for Divisibility Tests

You may be familiar with the very simple divisibility test for nines and threes. If you add up the digits of a number, and the sum is a multiple of 9, then the number itself is a multiple of 9. For example, 1+8=9, so both 18 and 81 are divisible by 9. So, too, are 108, 1080, 10000008 and so on. And if the number is so long that the sum of its digits isn't immediately obviously divisible by 9, well, just add up the sum's digits, and there you go.

This is also true of multiples of 3; if the sum of the digits is divisible by 3, then so is the original number.

When I first learned this, I found it interesting, but kind of mysterious. What was so special about the numbers 9 and 3 that they should have this property, and no other numbers should have it? I spent a fair bit of time puzzling over this, and eventually came up with an even more delightful theorem. Again, as with my previous posting on Mersenne primes, I'm likely to be revealing my ignorance of math here to anyone who's actually educated in the subject, but what I'm really trying to share here is how much fun I had figuring this out for myself.

 Here's the insight I had that made it all come together. Whenever you add 9 to something, that's essentially the same as adding 1 to the tens column and subtracting 1 from the units column. So, in principle, since you're adding and subtracting 1, you're not affecting the total.

So let's start with zero. Add 10, subtract 1, you get 9. Do that again, you get 18. And so on, up to 90, which is where it gets a little bit complicated, because you have some digits ticking over and ticking back with the carrying-the-one thing, but ultimately it all works out to the same thing: You're adding 1 to the tens column (turning 90 into 100) and then subtracting 1 from the units column (turning 100 back into 99). Now, the digits add up to 18 instead of 9. But this whole divisibility test is recursive, and you can add 1 and 8 to get 9 again, and there you go.

What happens if you start with one instead of zero? Well, 1+9=10, and 1+0=1, so the sum of the digits remains 1. Add another 9, you get 19, whose digits add up to 10, whose digits again add up to 1. No matter how many times you add 9 (or add 10 and subtract 1), this property will be preserved. More generally, take any number, add up the digits until you're left with just one digit, and whatever that digit is is the remainder when the original number is divided by 9. (Er, sort of. If the remaining digit is 9, then the remainder is zero, but that's because it's impossible to add up any non-zero digits to get a result of zero.)

That's also why the test works for multiples of 3. Any multiple of 9 is, of course, also a multiple of 3, so it's trivially true that if its digits add up to a multiple of 9, it's also a multiple of 3. And if you add 3 to a multiple of 3, the result is also a multiple of 3, so a remainder of 3 (or 6) when a number is divided by 9 indicates divisibility by 3.

When I figured this out, I realized that it's actually part of a more general theorem that works in any base, not just base 10. I'll state it this way:

In any base n, the sum of the digits of any multiple of a factor of (n-1) 
will itself be divisible by that factor of (n-1).

So, for example, in hexadecimal (base 16), any multiple of 3, 5 or 15 will have digits that add up to a multiple of 3, 5 or 15 respectively. 25 in hexadecimal is 19. 1 + 9 = 10 (or in hexadecimal, A) which is divisible by 5. So there. 

This is, of course, well-known to mathematicians and has been for ages. But golly was it satisfying to figure it out for myself!

Monday, 17 December 2012

Gun Idolatry

Back in August I blogged about an argument against gun control that I thought was particularly silly. Unfortunately, I used up the title that I really wanted to use for this post, a critique of the old NRA slogan "Guns don't kill people; people kill people."

It's a brilliant piece of rhetoric, because on a moral level, it's absolutely true. People are blameworthy for the good or the evil they do, and guns only do evil as instruments at the direction of people. Of course we shouldn't blame guns, but the people who point them at other people.

(That's a little loaded in itself, appealing to our sense of justice in asking us not to blame the poor innocent guns for what people do with them. But by that very same token, guns don't have any rights to justice, and we don't need to care about treating them unfairly if we do blame them for violence. Even if their availability contributes just a little bit to elevated rates of violence, we could be justified in destroying them all, and we wouldn't have to apologize to the poor innocent guns at all. Their owners might have a moral claim, but guns themselves are just inanimate objects with no right not to be scapegoated for our sins.)

From a moral perspective, placing responsibility on human beings is absolutely appropriate, so it's hard to take issue with the slogan there. Indeed, I think this is a very important point often overlooked in the wake of tragedies like last week's horrific school shooting, as we make a deliberate effort to forget the shooter and remember the victims. Well-meaning as that is, and as repugnant as it seems to "reward" the pathetic loser by paying him the attention we presume he wanted, we should remember that our moral obligation is watch out to make sure we don't do bad things, and so we should always be alert to catch in ourselves the kind of error or psychosis or whatever it is that leads people to do bad things. To that end, alas, we really ought to try to understand how the shooter went astray, so we can better avoid taking the same path. Our moral obligations have to do with our role as potential villains, not as potential victims, and so it is the potential villain inside us we must be ever vigilant to identify.

I cannot fault the slogan for reminding us of this. As people, we need to remember that it's not our guns but ourselves we must blame. Guns don't kill people; WE kill people. And if that were the whole of the slogan's meaning, I'd be fine with it. But it's not.

See, there's another reading of the slogan, one that comes out if we read it not from the perspective of a potential villain, but as a potential victim. If you read it this way, it's much more terrifying, insidious, and destructive: Guns won't kill us; people will kill us. Those people, they're dangerous, be afraid of them. Arm yourself; you may need to shoot them.

That fear-soaked message is, I think, central to the gun psychosis of American society. I don't have a problem with people owning guns because they use them for hunting or they enjoy target shooting or they collect them or study them or just think guns are cool. It doesn't bother me that guns are designed to kill people; so are swords, and I have no problem keeping a sword in my house. No, I have a problem with people owning guns because they are afraid. Fear is the problem; frightened people are dangerous.

Why are people afraid, and what are they afraid of? Well, they think they're afraid of criminals or the government or the New World Order coming and imposing its will by force. And sure, these are things against which we should be on guard, of course. But underneath it all is an excessive, irrational and almost mystical terror of violence. Nothing is quite so terrifying, it seems, as the threat of violence. Dying in car accident? Well, yeah, it could happen, but everyone still drives. Lung cancer? Meh. If you gotta go, you gotta go, but don't take away my cigarettes. But somehow, if someone puts a gun to your head, you have to do what he says?

People talk about violence being glorified, but I'm not sure that's the right word. It's mystified, and thus made somehow supernaturally powerful. And so naturally, people who are afraid want to possess this power for themselves, perhaps thinking it will make them less afraid, though it doesn't really, since they know that other people also have guns. Frightened people are dangerous, but frightened people with guns even more so.

Okay, okay, maybe we can blame the occasional (well, appallingly frequent) gun death of an innocent on the twitchy trigger fingers of paranoids, but surely the losers responsible for mass public shootings aren't acting out of fear, are they? No, of course not. But they do often seem to be people who feel powerless in their daily lives, and in a society where guns represent power, what do you expect?

So I don't think the problem is, exactly, that Americans have too many guns. It's that they think they need them, and the very unwillingness to even discuss the possibility of putting stronger regulations in place is symptomatic of that profoundly unhealthy fear. Paradoxically, if they were able to talk about gun control, they wouldn't need to talk about gun control. 

Tuesday, 11 December 2012

Reflecting on December 6, 1989

     I confess to having, despite my best efforts, a bit of a chauvinist streak. Perhaps that's putting it too strongly, but it manifests itself this way: my visceral sense of horror at the idea of violence is greater when the victim is female. I don't know why I should feel this way. It could be cultural (the stigma attached to a boy who hits a girl is significant, or at least it was when I was growing up), but I don't think so, because I've been able to consider and reject other such indoctrination. More likely, I'm just hardwired to view the loss of a potential mate as less desirable than the loss of a potential rival for mates.
     Whatever the reason, I recognize that from a philosophical moral perspective, it's an irrelevant consideration, a personal preference that should play no role in reasoned discussion about public policy. So while I may personally feel especially horrified at the Polytechnique massacre (whose 23rd anniversary was this past week), I have to remind myself that it would have been every bit as wrong and horrible if Marc Lepine had singled out and killed just the men in the class instead of just the women. The sex of the victims should make no difference in our evaluation of tragedy, and my gut reaction (that it's somehow worse that women were killed) is actually a part of the patriarchal world view that got us into this mess.

     And so I have always felt very uncomfortable with the way this tragedy has become an emblem for raising awareness of Violence Against Women. One the one hand, I accept that violence against women really is a specific problem we need to raise awareness of. And yes it was violence, yes it was against women, and yes they were specifically targeted as women. Yet something still feels wrong. How can violence against women not be violence against women?

     Let me back up a bit. Why do we need to raise awareness in the first place? What is it about violence against women that differs from violence against men or indeed any hate crime against any identifiable demographic? Why do we not need to raise awareness of violence against mimes or Norwegians or agnostics? Isn't violence against anyone equally bad?
     Of course it is. It's not that violence against women is worse than other kinds of violence, but rather that there's a particular kind of pathology involved that doesn't apply to most other sorts of violence, and doesn't even apply in every case where the victim happens to be female, either. (My fencing coach happens to be a woman, and though I rarely manage to hit her, I do try.)
     Let's start with domestic violence, which is typically (though not exclusively) carried out by men against women. Historically, we've studiously ignored this as a "private matter." It was assumed that a man had a right and obligation to discipline his wife, and how he chose to do it was nobody else's business. Police and the courts were loath to interfere. But to ignore such violence is to tolerate it, to tacitly endorse it.
     To most of us, that rationale sounds kind of old-fashioned, and likely to many abusive men as well. There is another sort of wife-beater, after all, the passionate guy who just loves her so much that he can't help himself when he gets angry baby don't you understand. It's not like these guys think it's okay, exactly, to react violently, but they and the mates who take them back make excuses, treat each incident as an exception rather than part of a pattern, and again, ultimately ignore the pattern, thus permitting it to continue.
     It's not limited to domestic violence, of course. The deep-seated attitude underlying all of this is the presumption that women are, in some sense, property of men, resources to be exploited rather than people to be respected as equals. That attitude leads to rape and related subjugations, and our habit of ignoring or excusing domestic assaults leaks over somewhat when it comes to rape. We're still kind of inclined to blame the woman for leading him on or dressing provocatively or making up the whole thing, perhaps because it's just so much easier to ignore the problem and hope it goes away.
     THAT is why we have to raise awareness. It's our ingrained habit of turning away, of acting like it's no big deal or just a private matter or that it doesn't really happen, that perpetuates the presumption that women aren't fully persons, and the violence it spawns.

     Now, it's probably the case that Marc Lepine had that same insidious attitude about the proper role of women when he blamed feminists for "ruining his life". I remember reading at the time that his application to attend l'Ecole Polytechnique had been rejected, and he most likely thought that he'd have gotten in if only it hadn't been for those darned women taking "his" spot. Why couldn't they stay at home, barefoot and pregnant like they're supposed to? Perhaps that was his rationale, and so it is connected to the very problem of which we need to raise awareness.
     But the connection is long and tangled, and not immediately obvious. It's easy to imagine, after all, some troubled loser blaming immigrants, or natives, or wealthy white guys, or virtually any other demographic, for his problems and carrying out a similar rampage, and in fact that does happens from time to time. So one can look at the Polytechnique massacre as just another hatecrime, where the targeted group happened to be "women taking positions in engineering classes", without recognizing Violence Against Women as being fundamentally different from, say, Violence Against Orthodontists in this context.
     So even if the massacre was a culmination of the problem we're trying to raise awareness of, the people we most need to reach are not going to make the connection. The rapist (or rapist sympathizer) will look at that and not see himself, because he's not taking a gun into a public place and shooting women and then taking his own life; indeed, he may well condemn the crime himself (even if only lamenting it as a waste of young women for whom he has better uses). The man who loses control and beats his girlfriend or wife won't see himself; he'd never hurt a stranger, after all. And the cops and judges who look the other way when a man "disciplines" his wife aren't going to see this shooting as a private matter into which they should not intervene.

     That's why I feel so uncomfortable treating this tragedy as symbolic of violence against women. It troubles me that using it this way tends to emphasize the gender of the victims, rather than the pathology of thought that we need to fix. That pathology is the idea that women aren't fully persons in some sense, that they are valuable property to be cherished and protected, or that it would be a violation of some other man's property rights to damage them. We don't address that pathology by saying that violence against women is wrong, because that's perfectly compatible with the view of women-as-objects. We address it by reinforcing the idea that violence against people is wrong, and raising awareness of the fact that yes, in fact, women are people, dammit!

Friday, 7 December 2012

Traffic Rules: It's not about you.

     People often complain about traffic regulations, particularly speed limits (and rules against following-too-close, one of my pet peeves), on the basis that they don't improve safety. "I'm a good driver," they say. "I'm alert and I pay attention, and I can judge my stopping distance and control my vehicle at much higher speeds that the posted limit."

     That may well be true, although it probably isn't, considering how many people consider themselves to be above-average drivers. But even if it is, it is based on a narrow and unreflective conception of why we have traffic laws. They aren't just about preventing accidents; they're also about maintaining an efficient and orderly flow of traffic so people can actually get where they're going.

     Let's start with a very simple example. You might feel more comfortable driving down the middle of the road, with more room to spare in avoiding parked cars or other obstacles at the side of the road, but we have a convention of driving just on the right side of the street (or left if you happen to live in England or Japan). This isn't really about preventing collisions, because presumably if we had no rules about what side of the road to drive on, people would be alert to the possibility of oncoming traffic and usually be able to stop in time. Rather, it's a way of sharing the road so that traffic can move in both directions, smoothly and efficiently. Instead of stopping to get into arguments about who was there first and who should get out of the way, we just instinctively move over to the right and drive past each other without incident, arriving at our destination sooner than we would otherwise

     We rarely get people demanding the right to drive on the left if they should choose, and complaining about the The Man telling us what side of the road to use. But the safety rationale for speed limits seems fuzzier; while there is a very clearly marked line down the middle of the road that we all recognize we should not cross if we don't want a head-on collision, it's a lot easier to rationalize that driving a mere 20 klicks over the posted limit isn't all that much more dangerous than 5 or 10 klicks.
     Even if that were true (which it isn't), it doesn't matter. The speed limit isn't there because The Man thinks you're not a good enough driver to handle your vehicle at higher speeds. Like driving on the right side, it's a way of sharing the road so that we can all get where we're going with minimal delay.
     Consider: You're at a stop sign, waiting for a break in traffic to cross the street or merge into traffic. How big a gap do you need? Well, obviously that depends on how fast traffic is moving, and how fast you can accelerate. The faster traffic is moving, the bigger a gap you need, and consequently, the longer you'll have to wait. The longer you have to wait, the less your total travel time benefits from higher speed limits, and there is a point at increasing the speed limit actually decreases total average speed.
     The same principle applies to lane changes. If you find yourself stuck behind someone going slower than you'd like, it's reasonable to want to pass them by moving into another lane. But if traffic in that lane is going very much faster than you are, it will be much harder to find a safe opportunity to do so. So you are delayed longer, driving slower than you'd like to, because people in the other lane are allowed to drive as fast as they want. Again, a lower speed limit in this situation is to your benefit, because it gives you more chances to actually drive at that speed, rather than being delayed by the difficulty of merging into the higher speed lane.

     So, counterintuitive though it seems, speed limits are actually intended to speed you up, to get you and everyone else where you're going as fast as possible by sharing the road. The road is a scarce resource, and traffic laws are as much about fairly distributing that resource as they are about saving lives.

Tuesday, 4 December 2012

Too Short; Didn't Think

     I just visited a discussion forum, and saw a thread that was 15 pages long, but I only looked at the last posting to it and noticed that it was more than a whole screen of text. Since I hadn't read any of the prior posts, I had no idea what the context was, but why should I spend my valuable time reading?
     I also didn't pay any attention to simple clues about the discussion. Since I didn't skim any of the previous posts, I didn't noticed that there had been a lot of dialogue in the days leading up to that final posting, and that several days had passed since the final post, suggesting either that the final post had put to rest much of the argument, or that it was so stupid as to make everyone else give up and abandon the thread. If this had occurred to me, I might have resolved the question by noticing that the final post had a respectable number of up-votes from readers, suggesting that this one final post had probably been a satisfactory wrap up to the thread to that point.
     I just didn't want to read so much text. It would take too much of my time. It never crossed my mind that it must have taken the author at least as much time to write as it takes me to read. I just thought it was inconsiderate of the author to put a big pile of text on the screen and not just tell me in a simple sentence or two what it meant. Of course, since I hadn't read the entire thread, I had no way of knowing that the author and others had done just that, many times, in the previous posts, and that the short versions had been unsuccessful in persuading the other participants to the debate. I didn't realize that the big long post I saw was an attempt to explain in minute detail exactly why those shorter versions were to be accepted.
     It's possible that, had I read the entire thread, I would have understood these things. But that would have involved taking the time to read and think, and I've got better things to do. So I'll just helpfully post as a comment, "TL;DR". Everyone needs to know that I can't be bothered to read.

Monday, 3 December 2012

What Do Patents Encourage?

     A month ago, I posted complaining about how copyright law has imposed costs on the rest of us, prompted by my frustration in trying to legitimately copy some files from a CD-ROM to an iPad. This morning I had an experience that added to my frustration with intellectual property law, this time in the form of patents.
     The whole reason for having patent law is to encourage innovation, but at least sometimes I suspect  it does the opposite. I was driving my son to school in an older car a cassette deck where the CD player ought to be, when it occurred to me that, given how small MP3 players are now, shouldn't it be possible to build one into a device that emulated a tape cassette? You just make a little induction coil or some such gadget to interface with the tape head of the cassette player, and use that as an output. Have sensors in the reel sockets to detect when the cassette thinks it's playing, rewinding or fast-forwarding, maybe even have them draw some power from them for recharging, and there you go. All the technology to do this exists; it should be fairly simple to build such a device.
     As I thought about this, I realized that there were various hurdles to overcome besides the technical. The first one, I thought, from a business perspective would be market: how much demand would there actually be for this thing? I mean, there are still cassette players around, but for how much longer, and is it cost-effective for anyone to buy this gadget instead of just getting something up-to-date? But perhaps, if it were cheap enough, for people who just like their old stereo systems.
     The thing that really gave me pause, though, was patent law. Surely, I thought, someone else would have thought of this invention before I did. And that meant that if I were to go out and create this device and try to sell it, I'd probably get sued by whoever registered the patent on it. Even if nobody else had patented it and I didn't want to apply for a patent myself, I'd still need to search through patents to ensure that I wouldn't be running afoul of someone else's rights by creating such a device.

     This is all academic, of course, because I'm not at all technically adept enough to design and build this thing, and I'm not actually all that interested in marketing it either. (Also, I was right that someone else probably had thought of it, and built it. Turns out there are several on the market already.) But what I found striking was that of all the obstacles to turning an idea into a reality, the one that discouraged me the most was the whole business of patents. I just didn't want to have anything to do with the kind of research that would involve, and I've been to law school!

     That's not to say that patent law always discourages innovation. For people and companies who have ideas with solid economic potential, it is certainly worthwhile to invest the time and resources in developing the invention and applying for the patent. But for borderline case? For things that might be useful? Here is where things get iffy.
     Laws are generally intended to promote some sort of behaviour and discourage others, but it often turns out that the behaviour a law actually  promotes is not the behaviour it's intended to promote. Cynically, some people (wrongly) say "it's only illegal if you get caught." More accurately, you're only punished if you get caught, but the point here is that people often consider it more cost-effective to modify their behaviour around the practical consequences more than the actual intention of the law.
     Patent law is no different. As much as we might want patent law to encourage innovation, it isn't actually innovation that is encouraged, but the use of patent law itself. You aren't rewarded for coming up with and marketing a good idea so much as you're rewarded for applying for and asserting patent rights. Suppose two identical twins separated at birth independently come up with a brilliant idea, and both go through all the steps needed to develop it for market, but one of them applies for a patent and the other doesn't. Which one will reap the rewards? Clearly, all other things being equal (and here we've postulated that they are), it's the act of going to the patent office that's rewarded, not the innovation itself.

     Again, I don't have a solution for this. I don't have an alternative to patents to propose here, anymore than I was able to suggest an alternative to copyright. But I do think we should be aware of how sometimes our policies work against themselves.