Archive for January, 2009

Entropy is the opposite of knowledge

Saturday, January 17th, 2009

Jeff Atwood, over at Coding Horror posed an interesting little puzzle about probability:

Let’s say, hypothetically speaking, you met someone who told you they had two children, and one of them is a girl. What are the odds that person has a boy and a girl?

To put it in more precise language so we can concentrate on probability and not nuance of word choice, the person means that at least one child is a girl.  At first I was tempted to say what a lot of people came up with in the comments: 50%.  If one is a girl, my thought process goes, then we’re just looking at the probabilities for the other child, and surely those are not affected by the child we know about.

This is, of course, wrong.  In that argument we fail to take into account that having two children are distinguishable events, and we don’t know which child they were talking about when they said one was a girl.  When I actually wrote it down, then the solution became more clear.  Having two children gives 4 possibilities in terms of their gender (B for boy, G for girl):

BB, BG, GB, and GG

In learning that at least one is a girl, we can eliminate BB.  We cannot eliminate BG or GB because we’re not told which child was being referred to when we were told one is a girl.  Of the 3 remaining, 2 have one boy and one girl, so the solution is 2/3 or about 67%.

But wait!  Why should order matter?  As expressed by one commenter:

All the children learned probability theory and forgot how to think normally! Why would you care if the first one is a boy or a girl..they didn’t tell that their first child was a Girl, now did they? So, you have three choices: [BB, GB, GG]

To a certain extent, one is entirely justified in formulating the solution in terms that don’t include the ordering.  It wasn’t asked for in the solution or mentioned it in the problem.  However, if you formulate the problem in this way you are forced to abandon an implicit assumption we made in the previous reasoning: that all possibilities are equally likely.  If we leave out order, we can simplify our notation and just count the number of boys, and know that the rest are girls (leaving aside the relatively rare occurrence of gender ambiguity).  So our possible cases are [2, 1, 0].  However, the respective probabilities for these cases are [25%, 50%, 25%].  That is to say, having one boy and one girl is twice as likely as having two girls.  With this in mind, it’s easy to see that the solution should be 2/3.

But why are the probabilities equal when you include order, and not equal when you don’t?  Maybe you don’t even believe me.  The answer has a very deep connection to physics, and so my advice to any doubter is to try it out with a pair of coins!  Get two coins, flip them, and record the number of heads.  Repeat this 20 or 30 times and you’ll handily see that exactly 1 head comes up roughly twice as often as either 2 heads or 0 heads.  It doesn’t even matter whether you flip them at the same time or whether the coins are easily distinguishable!  Even seemingly identical coins are distinguishable in principle.  No two coins are exactly alike at the molecular level, and even if they were, it would be possible to track them individually through the air during a flip.  By only recording the number of heads we are throwing out some information which is, in principle, available to us.

Any time we don’t include information which, in principle, exists, then we don’t get equal probabilities.  However, we can still work out the probabilities of our incomplete description.  In thermodynamics, our incomplete description (in this case, the number of heads) is called the macrostate, and a complete description that uses all the information available in principle is called a microstate.  To find the probabilities of the macrostates, we have to weight them by the number of different microstates that give that macrostate.  In the case of exactly 1 head, this has two microstates (HT and TH).  The other macrostates each have only one microstate, thus exactly 1 head is twice as likely as either 2 or 0.

The number of different microstates that correspond to a particular macrostate is a measure of our lack of information.  When we get a macrostate of 2 heads, we know exactly which microstate we’re in—we have complete knowledge.  But imagine that we had 100 coins instead of 2.  There is only one microstate that has 0 heads, but there are 100,891,344,545,564,193,334,812,497,256 different microstates for 50 heads.  50 heads is astronomically more likely than 0 heads.  But just knowing that there are 50 heads leaves us without much knowledge of the microstate: there are over 100 thousand trillion trillion of them to choose from!  The measure of this is called entropy (technically, the logarithm of the number of microstates).  In our boy-girl example, having one boy and one girl has a higher entropy because we don’t know the order.  Entropy is sometimes called a measure of disorder.

In thermodynamics the macrostate of a system is given by things like overall temperature, volume and pressure, whereas microstates would have to be given in terms of the positions and velocities of each molecule.  That information is present, in principle (at least up to a quantum-mechanical limit), so it has a real effect on the probability.  Just like in coin-tossing the probabilities of the macrostates are weighted by the number of microstates that correspond.  The more likely macrostates must have higher entropy.  This is the origin of the famous 2nd Law of Thermodynamics.  Since macrostates of high entropy are so much more likely, random processes always end up there; the more elements in the system, the more this probability becomes like a simple fact.

Windows Live Writer

Monday, January 12th, 2009

The WordPress web-interface for writing blog posts is OK, but I do miss some of my favorite word-processing features. The blog-posting facility in Word 2007 didn’t impress me, but I’m on a Microsoft kick this week while trying Windows 7, so I thought I’d take Windows Live Writer for a spin.

Although it presents you the option to start a blog on Windows Live, it claims to play nicely with WordPress’s publishing API. I was skeptical, since I host my own blog (powered by WordPress), rather than having it on WordPress.com, but I’ve so far been impressed. Setup was very easy and totally automated: I just gave it my login credentials and the URL to the main site. It quickly discovered that I hadn’t enabled the publishing API, but helpfully gave me the URL of the options page to enable it. It also detected and downloaded my theme so it can give a full preview of what my post will look like on the site.

The botton of the window has three tabs: “Edit,” “Preview,” and “Source.” “Edit” is a WYSIWYG text editor, which helpfully defaults to the appropriate fonts for my blog, but doesn’t include the sidebar or other elements from my theme. “Preview” shows the post as it will look on the page—complete with sidebar and the previous post sitting underneath it. “Source” gives the HTML underneath the post, and unlike previous Microsoft forays into web publishing, it gives clean, sensibly formatted HTML.

pancake bunny

Inserting images is also painless, as illustrated by this bunny with a pancake on its head.  The one thing it is missing in terms of the WordPress system is a way to set the tags for the post.  There’s a tool for inserting tags, but all that does is insert some HTML into the post for tagging to external sites like Technorati or del.ico.us.  All in all, it’s a welcome and viable alternative to using the Web-based tool.

UPDATE (13 Jan): As helpfully pointed out in comments, there is a way to set the tags for the post.  It’s in the post Properties, accessible with <F2>.  Win!

Windows 7 Beta

Sunday, January 11th, 2009

Downloading the Windows 7 Beta was a little more difficult than it should have been, but I was admittedly jumping the gun a little bit.  The public beta was briefly posted, only to be withdrawn because the servers couldn’t keep up with demand.  (It’s now back up.)  Being the impatient man that I am, I managed to find a BitTorrent link to the DVD iso.  It surprises me, just a little, that more companies don’t include a .torrent whenever you have the option to download large files.  I’m not sure if MS thinks that it isn’t secure, or looks amateurish, but I have to say that posting a link and then taking it down doesn’t look so good either.  BitTorrent, or peer-to-peer technology in general just makes so much sense for this kind of application: that is to say, getting a large chunk of data downloaded to a large number of people quickly.  (If you’re unfamiliar with peer-to-peer, it does this by breaking the file into pieces and passing the pieces around from person to person rather than everyone trying to get it from a single server.)

Windows 7, like in previous versions, allows you to install without a Product Key and enter it later, so I loaded it up right away, confident that I’d be able to get one when Microsoft reinstated the public download site.  Upgrading from XP, there was no option to try to migrate my programs and settings, only a clean install was available.  This didn’t bother me, but might turn off some people who’ve skipped Vista when it comes time to upgrade to Win7.  Vista users, apparently, can upgrade with their programs and settings more-or-less intact.  The install was very smooth, and took a little over half an hour.  It had no problems setting up my hardware.  In fact, the only drivers I’ve downloaded myself so far are the Dell drivers for the “advanced” features on my touchpad (aside: advanced is in scarequotes because I liked the Synaptics touchpad on my old Dell much better than the Alps one on my current D630).

The interface improvements are pleasing, and run smoothly and responsively on my laptop (Core2Duo 2GHz, 2GB RAM, Intel 965 Integrated graphics).  Especially nice is the updated taskbar, which gives live thumbnail previews of the windows as you mouse over it, and the new-to-me Window Flip 3D alternative to Alt-Tab.  Annoying is its insistence on changing the theme to a heavy black color every time I open something from the Control Panel.

I also BSoD’ed (the instantly familiar blue screen of death) once while watching a DVD in VLC Player.  It’s nice to know that fail still comes in white text on a blue background.  But other than that, it’s been a nice experience.  Outlook, in particular, loads lightening-fast, and I haven’t had any issues with program or hardware incompatibility.  Looking forward to giving BitLocker whole-disk encryption a go, as well as seeing what the gaming performance is like.

Live Mesh first look

Saturday, January 10th, 2009

So, I’ve decided to use my Saturday to geek-out and try some new computer stuff.  While Microsoft is making a somewhat lackluster presentation at CES compared to the likes of Sony, Palm, and Dell which have announced slick-looking gadgets, in terms of things to try right now, two Microsoft betas have caught my attention.  The first is Live Mesh, the subject of this post.  I’ll write something a little later about Windows 7.

I noticed that Microsoft’s Live Mesh service won a “Crunchie” from TechCrunch.com, so I decided to give it a try.  At its core, it’s a service for syncing files and folders among multiple computers.  But, in addition to updating your different machines, it includes a “Live Desktop,” which is a 5GB storage area in Microsoft’s cloud to allow you to get access to your most important files on any computer with an internet connection.  It also includes remote-access software, which is nothing new, but is accessible with just a click or two (at least in theory–my desktop crashed the first time I tried it).  It certainly seems much more sensible than the complicated setup one needs to do on both ends which is currently par for the course.  It also has some sharing features, but as far as I can tell, these require others to sign-up and sign-in, which will limit their usefulness severely (especially while the service is still in beta).

Live Mesh Popup Control Panel

I’ve installed it on my home desktop and lappy, and will give it a go on my office computer when I get in on Monday.  I have to say, I’m not particularly impressed with the syncing so far from an interface perspective: the size totals for transfers don’t make a lot of sense, and my lappy started uploading even though I told it to sync a new folder taken from my desktop.  These may just be initial hiccups, so I’m willing to give it the benefit of the doubt.  We’ll see how diligent it is at keeping the files up to date without intervention.