.. _review2: Complement 2: Combinatorics and Probability Distribution ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .. note:: This content was crafted by Ms. Colleen Pfaff. Combinations ------------ .. math:: C^n_r = \frac{n!}{(n-r)!r!} Helpful Tip: If you are having trouble visualizing a probability problem draw it as a tree with each combination being a different branch. Example Combinations ~~~~~~~~~~~~~~~~~~~~ Red cars numbered 2-10 and black cards 2-10 are placed in a bag. If 4 cards are selected at random, what is the probability that 2 are red and 2 are black? Solution ~~~~~~~~ There are :math:`C^9_2` ways to chose 2 red cards There are :math:`C^9_2` ways to chose 2 black cards In order to calculate probability need to find out the total number of possible ways to choose 4 cards. Number of ways to chose 4 cards :math:`C^{18}_4` Probability = :math:`\frac{C^9_2C^9_2}{C^{18}_4} = \frac{1296}{3060}` Discrete Probability -------------------- .. math:: = \sum_i x_i P_i .. math:: = \sum_i x_i^2P_i Example Discrete Probability ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Calculate :math:`` and :math:`` and :math:`\sigma^2` for a coin flip Solution ~~~~~~~~ .. math:: = (1)(0.5) + (-1)(0.5) = 0 .. math:: = (1)^2(0.5) + (-1)^2(0.5) = 1 .. math:: \sigma^2 = - ^2 = 1 - 0 = 1 Continuous Probability ---------------------- .. math:: = \int x P(x)dx and .. math:: \int P(x) = 1 Independent Variables --------------------- .. math:: = Example Independent Variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Are temperature and size of a system independent Solution ~~~~~~~~ Yes temperature and size of system are independent! Binomial Distribution --------------------- Success has probability p and failure has probability 1-p. Success typically has a value of 1 and failure a value of -1. These values for probability make sense because p + 1 - p = 1. Probability of k success(es) and n-k failures on n trials: .. math:: p^k(1-p)^{n-k} If we have k success on n trials then there must be n-k failures because there are only two possible outcomes. The average number of successful trials is the probability of success times the number of trials. .. math:: = np .. math:: \sigma^2 = np(1-p) Drunk's Walk ~~~~~~~~~~~~ A man leaves the bar and he is just as likely to step to the left as he is the right. What is his average distance after n steps and what is the variance? Solution ~~~~~~~~ Let's see what the possibilities are after 2 steps: LL, RR, LR, RL and the probability of each of these results is .. math:: \frac{1}{4}, \frac{1}{4}, \frac{1}{4}, \frac{1}{4} And this means that after 2 steps the average distance is 0 We can extrapolate this to N steps because this behavior won't change, therefore after N steps the average distance is 0. .. math:: = ( + + ... + )^2 = + + ... + + + \ldots So the value of :math:` = 1`. Whereas the value of :math:`` or any other combination can take a couple of forms: (1)(1), (-1)(1), (1)(-1), (1)(1) Since :math:`` or :math:`` is equally likely to be either 1 or -1 so like in the first step this will be 0 Therefore we have .. math:: = (1 + 1 + 1 ... 1) for every N step .. math:: = N .. math:: \sigma_x = \sqrt{N}