Basic Probablity Concepts For Coding

Probability:

Understanding probability is very important for programmers, rather being good at mathematics is always a boon to them. Here, are some points to refresh your probability concepts.

The sum probabilities in the sample space are one.

$P(A ⋃ B)$ is also written as $P(A + B)$ and $P(A ⋂ B)$ is also written as $P(AB)$.

⋃ is called the union and is somewhat analogous to OR operator.

⋂ is called the intersection and is analogous to AND operator.

Mutually exclusive: Two events are mutually exclusive if the result of one does not affect the result of the second.
If A and B are mutually exclusive then $P(A or B) = P(A) + P(B)$

Conditional Probability:

"Handles Dependent events."

A measure of the probability of an event given that another event has occurred. If A is unknown and B is known (occurred). The Conditional Probability of A given B is written as P(A|B).



For two independent Events A and B, $P(B|A) = P(B)$ and $P(A|B) = P(A)$.

If E1, E2, ... En are Independent events. $P(E1⋂E2⋂E3....⋂En) = P(E1)*P(E2)....$


Exhaustive Events: A set of events is called exhaustive events if at least one of them must occur.

If E1, E2, ... En is mutually exclusive. $P(E1⋃E2⋃E3....⋃En) = ∑P(Ei)$

A and B are not mutually exclusive then: $P(A⋃B) = P(A) + P(B) - P(A⋂B)$.

Three events are mutually independent if $P(A⋂B) = P(A)*P(B)$, $P(B⋂C) = P(B)*P(C)$, and $P(A⋂C) = P(A)*P(C)$.



IMPORTANT:

  • The Probability of getting at least k successes out of n trials is
\[P(x>=K) = ∑C(n,x)(p^x)*(q^(n-x))\]
Here the p is the probability for success and q is the probability for failure in an event.

  • If A and B are independent P(A and B) = P(A)*P(B)
  • Else(in general), P(A and B) = P(A given B)* P(B)

No comments:

Post a Comment

Installing albert on ubuntu 19.04

Installing Albert on Ubuntu 19.04... Albert is not still released for ubuntu 19.04. But still, you can install it using the following ...