# Binomial Probabilities

To compute the probability of a certain number of outcomes (*k*) of acertain number of attempts (*n*), given that the probability of thatoutcome is *p*, is:

_{n}C_{k} * *p*^{k} * (1-*p*)^{(n - k)}

Where _{n}C_{k} means the number of combinationsof *n* taken *k* at a time. This is:

*n*!

*k*! (*n - k*)!## Using a Javascript Function to Compute

It is easy to write a small web page that allows the user to type incertain values in a text field and make a small program in Javascript to compute a result based on these values.First define a form and some text fields to hold the values of *n, k* and *p*:Then define a script which is called when the user presses the button. Tosee how this works, View the page source. Save this page and see if youcan write your own web page that can compute the probability of *k or more * outcomes. To check your work, the probability of 3 successes of 5 attempts (with p=.6) is 0.346 and the the probabilityof 3 *or more* is .683. To see javascripterrors type "javascript:" in the web page location of your browser.See if you can use your web page to answer question 25 of the Chapter 4 Quiz