bag has 16 balls
4 are red-12 white
if 2 balls are pulled -what is the prob. 1 is red?
not returning 1st ball or pulling both at same time
how can i calculate this?
1st ball 4/16 ; if white (12/16 it's white)
75% of time 1st is white and still have 4/15 chance to pull red
could someone please show me the formula for this
chances both red?
the bookie at the pub says it's 50%, I know it's lower
Thanks, IGGY
I got 9/20:
You have a 1/4 probability of getting red the first time.
And a 1/5 probability of getting red the second time. ((3/4)*(4/15))
Add them: 9/20
35 0 c:\dev-cpp\mingw64\lib\gcc\x86_64-w64-mingw32\4.6.1\include\c++\random In file included from c:\dev-cpp\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.6.1/include/c++/random
3 C:\Dev-Cpp\Programs\000000.cpp from C:\Dev-Cpp\Programs\000000.cpp
32 2 c:\dev-cpp\mingw64\lib\gcc\x86_64-w64-mingw32\4.6.1\include\c++\bits\c++0x_warning.h [Error] #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
C:\Dev-Cpp\Programs\000000.cpp In function 'bag createBag(unsigned int, unsigned int)':
14 17 C:\Dev-Cpp\Programs\000000.cpp [Error] 'bag' has no member named 'emplace_back'
17 17 C:\Dev-Cpp\Programs\000000.cpp [Error] 'bag' has no member named 'emplace_back'
C:\Dev-Cpp\Programs\000000.cpp In function 'void randomize(bag&)':
24 12 C:\Dev-Cpp\Programs\000000.cpp [Error] 'mt19937' in namespace 'std' does not name a type
25 5 C:\Dev-Cpp\Programs\000000.cpp [Error] 'shuffle' is not a member of 'std'
25 50 C:\Dev-Cpp\Programs\000000.cpp [Error] 'engine' was not declared in this scope
C:\Dev-Cpp\Programs\000000.cpp In function 'int main()':
39 10 C:\Dev-Cpp\Programs\000000.cpp [Error] 'ballBag' does not name a type
43 19 C:\Dev-Cpp\Programs\000000.cpp [Error] 'ballBag' was not declared in this scope
This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
Enable C++11 support. And maybe update to a newer version of your compiler.
You enable it by using the compiler flags "-std=c++0x" or "-std=gnu++0x" when invoking the compiler (as indicated in the error message.) Generally, IDEs will have a menu for selecting/setting compiler flags per project. If the one you're looking for isn't present, they will also usually have an option where you can add the flag manually to the command line the IDE uses to invoke the compiler.
cire: There's a bug in your sampling method. The probability of each of two items independently meeting a condition is not necessarily equal to the probability of either of the same two items meeting it.
For example, in the set {10,11,01}, bit 0 is 1 with P=2/3, and bit 1 is 1 with P=2/3, but (bit 0)|(bit 1) is 1 with P=1.
The value Script Coder arrived at is correct, but the reasoning he used is incorrect.
Probability of first ball not being red: 12/16
Probability of second ball not being red: 11/15
Probability of neither ball being red: (12/16)*(11/15)
Probability of either ball being red: 1-(12/16)*(11/15) = 9/20
if 2 balls are pulled -what is the prob. 1 is red?
not returning 1st ball or pulling both at same time
Yes. Somehow I read that as "what is the probability the first ball is red," and given the inarticulate expression of the question, I guess it didn't bother me that it didn't make much sense, and advanced to the question that did make sense to me:
could someone please show me the formula for this
chances both red?
And a 1/5 probability of getting red the second time. ((3/4)*(4/15))
The description doesn't match the actual probability. 1/5 is a probability of getting red the second time (R2) after getting not red the first time (¬R1). This event is disjoint with R1, so
P(R1) + P(¬R1 && R2) = P(R1 || ¬R1 && R2) = P(R1 || R2)