Wikipedia:Reference desk/Archives/Mathematics/2012 April 14

= April 14 =

Black and white balls problem
A machine generates a random integer from 0 to 5. Then my partner puts 5 balls into a bag. The value of the integer indicates how many of the balls must be black, and the rest must be white.

My partner then gives me the bag. I take out one ball on a random basis, and it is black (so the number generated can't have been 0).

In that situation, what are the probabilities that the generated number could be each of 1, 2, 3, 4 and 5? --Theurgist (talk) 08:40, 14 April 2012 (UTC)


 * It is exactly as if there are four balls chosen ignoring the business about the fifth ball. It is just as if you closed your eyes as you stuck in the fifth ball and then immediately took it out again. It's colour makes no difference except to adjust the number of such balls remaining.Dmcq (talk) 10:35, 14 April 2012 (UTC)
 * I'm afraid that's wrong. If the generated number were low, it would be less likely that first selected ball were black.  Thus, by an application of Bayes's theorem, the fact that the first was black makes it less likely that the generated number was low.  The probability of there being n black balls and one of those black balls selected on the first pull is 1/6 * n/5 = n/30.  So the probability of a black ball being selected on the first pull is 15/30.  So the probability that the generated number is n is n/15.--121.74.125.218 (talk) 10:58, 14 April 2012 (UTC)
 * Edited the above because I confused black and white.--121.74.125.218 (talk) 11:01, 14 April 2012 (UTC)


 * Sorry misunderstood the question. I was just considering the balls being stuck in at random and then counting. If the count is predetermined and each count has an equal chance then things are different. There you start off with a 1/6 chance of each count. The ones of count n are chosen with probability proportional to n. The sum of 1 to 5 is 5.6/2 so n is chosen with probability n/15, i.e. 0 1/5 2/15 3/15 4/15 and 5/15 Dmcq (talk) 11:22, 14 April 2012 (UTC)


 * The answer is in a simple application of Bayes Theorem. You want the probability of the number of black balls being n given that the first one you drew is black. The theorem says this is equal to the probability of the first ball drawn being black given n balls are black (which is simply n/5) times the probability of there being n black balls (1/5 or 1/6, depending on how you interpret the question) divided by the probability of drawing a black ball over all cases considered (1/2, I believe). SamuelRiv (talk) 16:19, 14 April 2012 (UTC)


 * Succinctly: let N=unknown number of black balls and n=some realization of N. Then
 * $$P(N=n|observe black) = \frac{P(observe black|N=n)P(N=n)}{P(observe black)} = \frac{(n/5)(1/6)}{1/2} = n/15.$$
 * Here $${P(observe black)}=1/6$$ because a priori there were six possibilities: N=0, 1, 2, 3, 4, 5, of which N=n was just one of the six.
 * Duoduoduo (talk) 18:10, 14 April 2012 (UTC)

The odds for having K type-1 and N&minus;K type-2 items in the population, and k type-1 and n&minus;k type-2 items in a sample, is
 * $$\binom{K}{k}\binom{N-K}{n-k}$$.

The probabilities are odds divided by sum of odds. The sum of odds is for deduction:
 * $$\sum_{k=0}^n\binom{K}{k}\binom{N-K}{n-k}=\binom{N}{n}$$

and for induction:
 * $$\sum_{K=0}^N\binom{K}{k}\binom{N-K}{n-k}=\binom{N+1}{n+1}$$

Your example is induction - knowing the sample you want information about the population. Type-1=black, type-2=white, N=5, n=1, k=1. So odds are $$\binom{K}{1}\binom{5-K}{1-1}=K$$ for K=0,1,2,3,4,5, and the denominator is $$\binom{5+1}{1+1}=15$$. Bo Jacoby (talk) 19:35, 14 April 2012 (UTC).

The Rationals Are Dense In The Reals
Suppose $$f:\mathbb{R} \rightarrow \mathbb{R}$$ and $$g:\mathbb{R} \rightarrow \mathbb{R}$$ are continuous functions and that $$\forall x \in \mathbb{Q} f(x) = g(x)$$. Show that $$f=g$$. I know this follows from the fact that the rationals are dense in the reals, but how? Widener (talk) 11:44, 14 April 2012 (UTC)


 * For any given $$x \in \mathbb{R}$$ we can find a sequence of rational numbers $$x_i$$ such that $$\lim x_i = x$$. For each $$x_i$$ we have $$f(x_i)=g(x_i)$$ by hypothesis, so $$\lim f(x_i)= \lim g(x_i)$$. Now think how we can use $$\lim f(x_i)= \lim g(x_i)$$ and continuity of f and g to reach a conclusion about $$f(x)$$ and $$g(x)$$. Gandalf61 (talk) 14:52, 14 April 2012 (UTC)
 * Right; and presumably we have $$\lim f(x_i)= \lim g(x_i) \implies f(\lim x_i)= g(\lim x_i) \implies f(x) = g(x)$$ from the continuity of $$f$$ and $$g$$. Widener (talk) 12:19, 16 April 2012 (UTC)
 * Just want to add a fun little fact; that property you mentioned shows there are no more continuous functions from $$\mathbb{R} \rightarrow \mathbb{R}$$ than there are real numbers. Money is tight (talk) 08:04, 15 April 2012 (UTC)

It's instructive to do it also with the general topological definition of continuous functions (inverse images of open sets are open), where sequences are unnecessary. The hypotheses are certainly satisfied by R with the usual topology, for your question.

You can prove this: Suppose f, g:X→Y are continuous functions between topological spaces where Y is Hausdorff, and furthermore, f=g on a dense subset D of X. Show f=g.
 * If f and g disagreed on a number x, you could separate f(x) and g(x) with a pair of disjoint open sets (Hausdorff property).
 * The intersection of the inverse images of these open sets is open (by continuity) and nonempty.
 * By density the open set in the last step contains a point of D, but this contradicts the disjointness of the open sets separating f(x) and g(x).

I understand that this may be overabstract for your purposes, but if you can invest the thinking I think it is worthwhile. Rschwieb (talk) 14:09, 15 April 2012 (UTC)
 * Does a continuous function $$g:X \rightarrow Y$$ always exist, given a continuous $$f$$ defined on a dense subset of $$X$$ satisfying $$f(x) = g(x)$$ for all $$x$$ in this dense subset? Widener (talk) 12:19, 16 April 2012 (UTC)
 * No. You can surely figure out a few counterexamples in the case of $$\mathbb{Q} \subset \mathbb{R}$$. In fact, it is rather tricky to give necessary and sufficient conditions for a function on $$\mathbb{Q}$$ to extend to all of $$\mathbb{R}$$ continuously. --COVIZAPIBETEFOKY (talk) 12:53, 16 April 2012 (UTC)


 * @Widener If D is the dense subset of X, I hope in your statement you mean that f is continuous as a function from D to Y (or else the answer would be trivially "yes, f itself"). Rschwieb (talk) 13:48, 16 April 2012 (UTC)
 * Yes, $$f$$ is a function $$f:D \rightarrow Y$$, which is what I meant when I said "$$f$$ defined on a dense subset of $$X$$" Widener (talk) 15:44, 18 April 2012 (UTC)
 * Yes, and since that statement (that you just repeated) does nothing to clarify the ambiguous phrase "continuous f", a 100% clear statement would be "a function f defined and continuous on a dense subset D". Rschwieb (talk) 18:46, 18 April 2012 (UTC)
 * Well, hopefully that made it obvious that it was continuous as a function from D to Y (since it's only defined on D). Widener (talk) 03:24, 19 April 2012 (UTC)
 * "Only defined on", which is semantically stronger than "defined on", would have been a stronger indicator of your intentions to talk only of continuity on D. Functions "defined on X" are also "defined on D", so the scope of continuity of f would still be a mystery. Rschwieb (talk) 17:44, 19 April 2012 (UTC)
 * The notation $$f:D \rightarrow Y$$ implies that the function is defined only on D. Widener (talk) 05:26, 20 April 2012 (UTC)
 * In the case of R over Q, uniform continuity on bounded subsets is a necessary and sufficient condition for the existence of a continuous extension. For general metric spaces, this condition is sufficient but not necessary (necessity requires the Heine-Borel property).   Sławomir Biały  (talk) 14:05, 16 April 2012 (UTC)

I love modern algebra like this. VernaRebnick (talk) 00:54, 17 April 2012 (UTC)

Algebra?! Rschwieb (talk) 13:27, 18 April 2012 (UTC)