Jun 16, 2011

On the Nokia vs Apple Settlement

The common interpretation is that Nokia won and Apple lost. Even John Gruber of Daring Fireball fame just reported the fact, without any comment whatsoever. However, the settlement is secret, so it's just as easy to argue that Apple won: Nokia wanted Apple to pay a hefty fee to license patents necessary to build iPhone. When Apple refused, Nokia had to back down and now gets a fraction of what they really wanted. I suspect that the truth is somewhere in between.

Remember that when the process started, Apple claimed that Nokia demanded unreasonable license terms. Apple did not say they wouldn't need to license Nokia's patents, but that Nokia refused to offer RAND* terms as required by the standards the patents applied to.

Sure, Apple sued Nokia in turn, but that is standard procedure in this kind of litigation. If you don't, you won't have anything to bargain with down the road.

The fact that they settled as fast as they did indicates that there was no real dispute about principles, and both sides are happy enough with the deal. The law suit was just part of license negotiations, maybe because Apple was in no hurry to get a license agreement in place, and Nokia decided to speed things up.

* Reasonable and non-discriminatory licensing (RAND)

Jun 14, 2011

Probability Sucks: Three Cards

A long time ago I encountered a simple problem about probability. For me, it was an eye opener. Common sense did not apply, and I was captivated by how we generalize in erroneous ways.

The problem was this:

You have three cards, one card is black on both sides, one card is white on both sides, and the last card is black on one side and white on one side. If you draw a card that is white on the front, what is the probability that it is whit on the other side?

The answer seems obvious, 50%, right? Or maybe not. Let's write a short program to test the hypothesis. Scala is the natural choice, of course:

object CardSimulation {
import util.Random
def main(args: Array[String]) {
val stack = Array(new Card(Face.White, Face.White), new Card(Face.White, Face.Black), new Card(Face.Black, Face.Black))
println("Welcome to the card simulation")
print("Enter number of times to pick a card> ")
while (true) {
try {
val line = Console.in.readLine
if (line == "quit") exit()
var tries: Int = line.toInt
var results = List[Card]()
for (x <- 0 until tries) {
val cardNumber = Random.nextInt(3)
val facingUp = Random.nextBoolean()
val card = new Card(stack(cardNumber).front, stack(cardNumber).back, facingUp)
results = card :: results
if (card.upSide == Face.White) print("w")
else print("b")
}
println("\n skipped " + results.count(_.upSide == Face.Black) + " black cards")
val totalWhites = results.count(_.upSide == Face.White)
println(" using " + totalWhites + " white cards")
val otherSideWhites = results.filter(_.upSide == Face.White).count(_.otherSide == Face.White)
println(" of which " + otherSideWhites + " had a white back side, or " + (100D*otherSideWhites/totalWhites) + "%")
println(" ok")
print("> ")
} catch {
case ex: Exception => println("Enter an integer or type quit to exit")
}
}
}

object Face extends Enumeration {
val White = Value
val Black = Value
}

class Card(val front: Face.Value, val back: Face.Value, var faceUp:Boolean = true) {
def upSide: Face.Value = {
if (faceUp) front
else back
}
def otherSide: Face.Value = {
if (faceUp) back
else front
}
}
}


A sample run looks like this:

Welcome to the card simulation
Enter number of times to pick a card> 55
bwwbbwwwbwwwbwwbbwbbbbbwbbwbbwwwbwbbbwwwbwbbwbwbwwbbwbb
skipped 29 black cards
using 26 white cards
of which 18 had a white back side, or 69.23076923076923%
ok
> 55
wwwbbwbwwwwbwbwwbbbbwbwbwwwbwbbbbwbwwbwbbbbwbwwwbbbbbbb
skipped 30 black cards
using 25 white cards
of which 18 had a white back side, or 72.0%
ok
> 55
wbwwwwwbwbwbbbbwbwwwbbbbbbbbbbbbwbbwbbbwwwwbwwwbwbbwbww
skipped 30 black cards
using 25 white cards
of which 15 had a white back side, or 60.0%
ok
>


Hm, either I'm extremely lucky, or something is a bit fishy... Lets see, with three cards with two sides each we get 6 possible outcomes, 3 outcomes are black and the problem states that we have a white card, so 3 outcomes remains. 3 outcomes, I think we're on to something. The possibilities are (1)white front of card 1, (2)white back of card 1, and (3)white front of card 2.

Notice that (1) and (2) are white on the other side, and only (3) is black on the other side. I.e. the probability that the color of the other side is 2/3. This explains the output of our test program. Not so difficult to understand once you know you need to go a little bit deeper than just going by first impressions.

The take away, at least for me, is that probability is deceptive, and it is easy to assume wrong, even when it's fairly easy to reason your way to a correct answer.