Wrong, wrong, WRONG. You DO NOT understand the problem, if you think that this means the probability of the other child being a boy is 1/2. GB and BG are equivalent linguistically, but not mathematically; they do not represent identical possibilities in the space of all conceptual representations of a family of two.
Here, I'll prove it for you:
;; Have a child, with an equal probability of the child being a boy or a
;; girl.
(defun make-child ()
(if (eql (random 2) 0)
'boy
'girl))
;; Make a family of n members, with each child having an equal probability
;; of being either a boy or a girl.
(defun make-family (n)
(do ((family nil)
(i 0 (+ i 1)))
((>= i n) family)
(push (make-child) family)))
;; As in the story, meet someone at a party who informs us that (1) she or
;; he has two children, and (2) that at least one of these children is a
;; girl. E.g.,
;;
;; Me: "Hi there, what's your name?"
;; Cute lady: "Jennifer"
;; Me: "Nice to meet you, Jennifer, I'm Mark. What brings you here?"
;; Jennifer: "Well my husband is out of town on a business trip, so I
;; wanted to come here and catch up with some old friends of
;; mine. Fortunately I was able to get a baby sitter for my
;; two kids on such short notice. One of the kids, Meg, has
;; to be up early in the morning for dance practice and..."
;; Me: "Husband? Damn, all the good ones are taken."
;; Jennifer: "What?"
;; Me: "Nothing. Hey, hang on while I work out the probability that your
;; other child is a boy, based on the information that you've already
;; given me."
;; Jennifer: "You're weird. Have a good evening."
;;
;; This function works by calling (make-family 2) repeatedly until we get a
;; family that meets both of these criteria, then returns a representation
;; of said family. This is a precise analogy for the story: just as the
;; fictional person at this party, here we take the space of all possible
;; conceptual representations of a family of two, then discard any of these
;; that *does not* include at least one female child. THIS IS THE ONLY
;; REASONABLE WAY TO HANDLE THE INFORMATION THAT JENNIFER RELATES IN THE
;; ABOVE EXCHANGE.
(defun meet-at-party ()
(do ((family (make-family 2) (make-family 2)))
((find 'girl family) family)))
;; Perform the (meet-at-party) scenario num-total times, and then return
;; the fraction of those times in which the family contained a boy.
(defun run-test (num-total)
(let ((num-with-boys 0))
(dotimes (i num-total (float (/ num-with-boys num-total)))
(if (find 'boy (meet-at-party)) (incf num-with-boys)))))
Just call (run-test 1000000) or something. The result is approximately 2/3.
Here, I'll prove it for you:
Just call (run-test 1000000) or something. The result is approximately 2/3.