Is it truly random if the outcome of the first coin toss depends on the outcome of the second coin toss?

97 Views Asked by At

I'm trying to understand how randomness in not truly random in the following example:

an outcome of a first coin toss (yes/no) is only considered if the second coin toss also comes up 1/0 (1> accept yes/no ; 0> reject & toss again). Could this system be considered truly random, since the outcome of the first coin toss is dependent on the outcome of the second

Does the dependency between the two coin tosses introduce a bias into the system, making it less than truly random? I tried asking Google bard, who insisted that the system is not purely random as the second coin determines the value of the first coin. However, in my head, I can't comprehend how that could be, as the value of the second coin is random, so shouldn't the randomness be preserved (assuming first & second coins are both fair - 50/50)?

Below is a code of the demo, with which I tried to make a case for the preservation of randomness since the yes/no values always appear to be in a 50/50 ratio:

import random

# Number of times to repeat the experiment
num_trials = 1000

# Initialize counters for yes and no
yes_count = 0
no_count = 0

# Repeat the experiment num_trials times
for _ in range(num_trials):
    # Toss the first coin
    first_coin = random.choice(['yes', 'no'])

    # Toss the second coin
    second_coin = random.choice(['0', '1'])

    # If the second coin is 1, count the first coin as yes
    if second_coin == '1':
        if first_coin == 'yes':
            yes_count += 1
        else:
            no_count += 1

# Print the number of times yes and no came about
print("Number of times yes came about:", yes_count)
print("Number of times no came about:", no_count)
```
2

There are 2 best solutions below

1
On BEST ANSWER

The outcome is still random. The second coin flip only determines whether the first coin flip is taken into account, not the result of the first coin flip. The first coin flip is still random regardless. The presence of the second coin flip will ultimately only change the amount of results recorded, which may change the final outcome, but will not change whether or not it is random.

0
On

The way to think about this is not "the the first coin is dependent on the second coin" , which is wrong because there is no such dependency.

Correct way to think about this is "the outcome & number of coin tosses & termination of the Experiment depends on the first coin & the second coin & every Pair of coins further" , where each coin toss is indeed random & independent.

Consider this Partial Set of trials :
$Y1$ : Outcome is "2 Coin tosses , accept" : Probability is $1/4$
$N1$ : Outcome is "2 Coin tosses , reject" : Probability is $1/4$
$Y0Y1$ : Outcome is "4 Coin tosses , accept" : Probability is $1/16$
$N0Y1$ : Outcome is "4 Coin tosses , accept" : Probability is $1/16$
$Y0N1$ : Outcome is "4 Coin tosses , reject" : Probability is $1/16$
$N0N1$ : Outcome is "4 Coin tosses , reject" : Probability is $1/16$
This will gave a Series where the Probability terms are in Geometric Progression.
Summation will give $1$ Probability in the limit.

We can see that (1) Every coin toss is random & independent of the other coin tosses.
(2) Outcome & number of coin tosses & termination depends on each & every coin toss.

We can also see that Probability of accept == Probability of reject == $0.5$
Average Number of coin tosses can be easily calculated.

Outcome Dependency is on all coin tosses.
Each coin toss is independent.

Second coin will not decide on value of first coin which is independent.
Second coin will decide on value & termination of the experiment which is dependent on both independent coins.

[[ Summary : Bard is wrong ! ]]