Seorang pemain diberi dadu yang adil dan bersisi enam. Untuk menang, ia harus memutar angka lebih besar dari 4 (yaitu, 5 atau 6). Jika dia menggulung 4, dia harus menggulung lagi. Apa peluangnya untuk menang?
Saya pikir probabilitas memenangkan , dapat dinyatakan secara rekursif sebagai:
Saya telah memperkirakan sebagai dengan menjalankan 1 juta percobaan di Jawa, seperti ini:
import java.util.Random;
public class Dice {
public static void main(String[] args) {
int runs = 1000000000;
int wins = 0;
for (int i = 0; i < runs; i++) {
wins += playGame();
}
System.out.println(wins / (double)runs);
}
static Random r = new Random();
private static int playGame() {
int roll;
while ((roll = r.nextInt(6) + 1) == 4);
return (roll == 5 || roll == 6) ? 1 : 0;
}
}
Dan saya melihat seseorang dapat mengembangkan seperti ini:
Tapi saya tidak tahu bagaimana menyelesaikan hubungan perulangan jenis ini tanpa menggunakan pendekatan semacam ini. Apa itu mungkin?
probability
tronbabylove
sumber
sumber
Jawaban:
Pecahkan saja dengan menggunakan aljabar:
sumber
Catatan: Ini adalah jawaban untuk pertanyaan awal, bukan pengulangan.
Jika dia menggulung 4, maka itu pada dasarnya tidak masuk hitungan, karena gulungan berikutnya independen. Dengan kata lain, setelah memutar angka 4 situasinya sama dengan ketika dia mulai. Jadi Anda bisa mengabaikan 4. Lalu hasil yang bisa berarti adalah 1-3 dan 5-6. Ada 5 hasil berbeda, 2 di antaranya menang. Jadi jawabannya adalah 2/5 = 0,4 = 40%.
sumber
Jawaban oleh dsaxton ( /stats//a/232107/90759 ) dan GeoMatt22 ( /stats//a/232107/90759 ) memberikan pendekatan terbaik untuk masalah tersebut. Yang lain adalah menyadari bahwa ekspresimu
Benar-benar kemajuan geometris :
Secara umum kita miliki
jadi di sini kita miliki
Of course, the way to prove the general formula for the sum of a geometric progression, is by using an algebraic solution similarly to dsaxton.
sumber
All of the above answers are correct, but they don't explain why they are correct, and why you can ignore so many details and avoid having to solve a complicated recurrence relation.
The reason why the other answers are correct is the Strong Markov property, which for a discrete Markov Chain is equivalent to the regular Markov property. https://en.wikipedia.org/wiki/Markov_property#Strong_Markov_property
Basically the idea is that the random variable
is a stopping time. https://en.wikipedia.org/wiki/Stopping_time A stopping time is a random variable which doesn't depend on any future information.
In order to tell whether then th roll of the die is the first one which has not landed on a 4 (i.e. in order to decide whether τ=n ), you only need to know the value of the current roll, and of all previous rolls, but not of any future rolls -- thus τ is a stopping time, and the Strong Markov property applies.
What does the Strong Markov property say? It says that the number which the die lands on at theτ th roll, as a random variable, Xτ , is independent of the values of ALL previous rolls.
So if the die rolls 4 once, twice, ..., 50 million times, ...,τ−1 times before finally landing on another value for the τ th roll, it won't affect the probability of the event that Xτ>4 .
Therefore we can assume, without loss of generality, thatτ=1 . This is just the probability that the die lands a value greater than 4 given that it does not land on 4, which we can calculate very easily:
You can read more about stopping times and the Strong Markov property in Section 8.3 of (the 4th edition of) Durrett's Probability Theory and Examples, p. 365.
sumber
Another way to look at the problem.
Lets call a 'real result' a 1,2,3,5 or 6.
What is the probability of winning on the first roll, if you got a 'real result'? 2/5
What is the probability of winning on the second roll, if the second roll is the first time you got a 'real result'? 2/5
Same for third, fourth.
So, you can break your sample in (infinte) smaller samples, and those samples all give the same probability.
sumber