Video 7-3: Probability Theory Recap
CS 627 – Advanced Algorithms (Winter 2026-27) · unit page
· YouTube
2026-11-26, 28:47
← Video 7-2: Selection Lower BoundVideo 7-4: Probabilistic Turing Machines →
Click any sentence to play from there.
The transcript was generated automatically by YouTube's speech recognition and is offered as is. It may contain errors, in particular concerning technical terms, names and formulas.
0:03 So let's have a a very quick recap of probability theory to the extent that we need it. And there's a little bit that goes deeper than um than some standard introductory courses on on probability for a a particular reason. We need this for defining randomized computation. So there's a little bit of uh measure theory sneaking in. I don't know if people have seen this uh lebec measure these things these generalized uh ways to define integrals and then also um uh boral algebra these things okay I'll I'll explain a little bit >> yeah the um it's the foundation where all the probability theory is is built on most of the time you don't have to touch it there'll be just one contact point. Okay, let's start uh with the basics. So much of it is is just revisiting some key terms. Um and then we'll quickly move to the the parts that we need. Um a probability dispace if it's discrete has certain outcomes that are possible a countable set and then a probability needs to have certain properties to make sense. So we can assign every subset of these and a probability. So these can be events and uh I think these are standard um well-known aums of probability measures.
1:34 Um in the general case the most general is we have some some set of uh elementary outcomes points and then we need some notion of what is all subsets of this and if this omega in general can be arbitrary set. It could for example be the real numbers then taking all subsets runs into problems um because uh you want to assign these sets a number in a consistent way and there's just there's just too much creativity possible with subsets of continuous sets. So you have to restrict to some sensible sets that you allow as events and that's what the whole business of of measure theory um and these these sigma algebbras uh come in what they serve they essentially tell you what sets are measurable what you can sensibly use as events and just don't look at the others okay so um what is the requirement for such a set of subsets. Well, we should have the empty set. We should always be able to take the the complimentary set everything but a certain event and we should be able to take the countable union. So, it's even allowed to be infinite but countably infinite only. And of course, by combining these you can build intersections as well.
3:08 Um we'll talk a bit about these uh for the awkward case of continuous sets um on some examples and that's most it and then based on on this general so sigma algebra is just a collection of subsets of some ground universe and for these you can define a probability metric with the same kind of rules as before. uh the total thing should be measure one and if you have some sub some some events then um if you uh sums them sum them up and they're disjoint as sets then the the measure of the union should be the sum of the measures all of this I guess so intuitive and you've seen it at this at this level okay then there's a bunch of um examples that I wanted to show easy. If you have a finite set, then we all know how this works. You can have probabilities for the different outcomes and everything else is defined by just summing up the constituent elements. So here, if you want the probability of of having an even number in this strange die that has unequal probabilities, you would have to add up these three these three bars.
4:29 Uh that one uh kind of boring. Now next one is suppose we want a real number and say we take the unit interval of real numbers and we want a uniform distribution over those. Say how should we define um events or what's an event? It's already a bit problematic that if you pick a specific real number, the probability that you hit precisely that number is always going to be zero. But every outcome will be one specific number. It's this um seemingly paradoxical thing. So the only um events that make sense are also infinite sets. For example, you can ask is the value I get with my uniform number between I don't know okay I didn't even give points. It's just the length between 0 2 and 3. That's that's a valid thing. And because it's uniform and the entire unit interval has probability one, if I ask about 2 to 3, that's going to be a tenth. And if you have several intervals, you just add them up. They're disjoint. So far so good. Now, in principle, you could form really awkward sets. You could form the set of all rational numbers in the unit interval.
5:48 That's not an in not a union of of uh continuous intervals. That's just a mess, right? Between any two points, there's infinitely many others that are not in the set and that are in the set. So, it turns out this is even an allowed measure in an allowed event and it has measure zero, probability zero. uh to formalize this you use this this notion of boral sets which think about it as take open intervals for these it's clear how you define their length that's all that this lec measure tries to do now um if you have these you can essentially from there generalize uh if you have a union of of intervals you just sum this up if you have the complement then you do the complementation rule. Uh and you can do countably infinite unions.
6:53 Okay. Um what else to say? Yeah, Lebec measure is is the most general way to express how far can you push this idea? What are the kind of subsets of say this unit interval that you can still give a sensible length even if they're awkward sets? And for example, this this set of say r the set of all x's in 01 that are rational.
7:23 That would still be allowed because it is the countable infinite union of uh singleton sets, right? Uh you know that the rationals are countable by this uh contour argument. So this this would for example have zero measure.
7:40 Okay, we're not going to use any of that much. Um what we'll use might be the special case where you can express the distribution via density and this I'm sure you've also seen. So a small example um we'll we'll usually just use this over over real numbers. Um whenever we have a density the idea of a density is that you can integrate. So the density gives you um somehow how important a point is but it's not a probability because an individual point in a continuum has probability zero always. It's just the height. So that if you integrate over an inter interval now uh the real probability for this for this interval is now the integral over this density. And that's of course um what we had here where the density is just one. That's the special case where you don't where the integration does nothing. And the general case for these for these smooth distributions is the density allows you to put more weight in some area and less weight in another area.
8:49 And there's some assumptions about that this function is smooth in a way. You smooth is too strong. It needs to be integraable. And that's that's precisely all.
9:02 Okay. Uh yeah, I'm not going to dwell more on this. Um once you have such uh basic examples, you can combine them. For example, um a point in the unit square is essentially two um coordinates and then you can deal with those in well- definfined way by building the product space. So just remember product space means talking about um vectors of of random variables and here um a product space is always defined to have independent components. So the probability to have a point in this square is the same as having the x coordinate in the red part and the y-coordinate in that uh red interval. And that's all there is to it. Let's come to um the first weird but also important example for us uh and that's uh say think of um infinite sequences of coin flips all independent uh you can draw this as some infinite tree the universe the universe is all these infinite words of zeros and ones and you should this should immediately remind you of essentially the real numbers or the unit interval. If you say I'm going to put a zero dot and then read this off, that's a real number between zero and one. So it is kind of not discreet, right? It's a it's continuous. It hits all uh real numbers.
10:38 At the same time, it has some discreetness to it. Okay. Um the important uh the important trick to deal with these sets is to look at finite prefixes. So we'll define these these pi sets. That's for example here this u the pi 01 set is all the infinitely many paths that start with 01. And that is of course um again an infinite set but it has a well- definfined density among or a well- definfined probability among all the starting positions starting options because you can say I'm I'm only looking at the first two levels of this tree. Up to this point I have these four options. If these coins are all fair and independent that's going to be a quarter each. So a quarter of all infinite strings start with 01. That's kind of intuitive and well defined. And the whole notion of this general um probability space magic is only to say from there on you can define um a proper probability space using the same machinery as uh the general um general way of of measure theory. So you say that these these sets are uh generating a sigma algebra.
12:05 Um so you can take these sets you can take the complements and the infinite um the comp the countably infinite unions and that also explains the probabilities for any such set you can make. Again, a single point has probability zero, but you can um if you look only at finite prefixes, always assign a sensible probability. The reason or how this connects to random computations is that we'll assume an infinite tape with random bits, but any computation will only ever read a finite prefix and that's precisely such a pi uh set.
12:43 Okay, so that's that's the uh kind of important one to keep in mind. It's a bit awkward if you think about it for for a bit. Um it kind of needs some trick to assign probabilities. On the other hand, once you know the trick, nothing magic about it.
13:03 Okay, the the general recipe is is described here. If you have some uncountable set, you can't just list all the subsets. There's a cardinality higher. So um without getting into into set theory um you can always fix some primitive sets and then generate this sigma algebra by extension and for the real numbers these are the boral sets that I mentioned earlier and I think we don't need to know much more about it and then one way to define um a general way to define probability distributions is using CDFs the cumulative distribution function. Um, what do you call this? Well, the the function that expresses the probability to be below a certain value. And uh you can define for intervals the probability for that as the the difference of this function f on this uh interval. And from there you can generate the entire sigma algebra. Uh the other option is you define it via density. We've seen that. Or if the space is discrete then it's just summing things up. Um you can also have this function uh here it's um here's over the entire reals. You can also have it just for some some subset say the positive reals.
14:34 then you have some some functions there that integrate to one I don't know and for the example we've seen there the simple sets are these prefix sets yeah what we really need is either discrete or has a density or is this one specific example and that is it okay now a few of these standard terms from probability ility theory. Uh this is going to be events and random variables and expectation all these things. Um familiar enough or uh reminder an event is is some set where you can assign a probability to so it's some just an element of this sigma algebra. I think of the discrete case. It's a subset of the universe, a set of possible outcomes of the elementary outcomes.
15:36 There's complements and unions. Uh ah this this name is useful to keep in mind the union bound which is is nothing but this um basic property that follows from the uh the axum of the probability measure being additive over disjoint sets. If it's exactly additive over disjoint unions, then if you have general sets here, events where you don't know whether they're disjoint, then you can only upper bounded by the sum because there might be some overlap that you're now double counting. But as an upper bound, this is still always true. And this is maybe the single most useful bound like for analyzing algorithms because very often you have events where you know nothing about but the union bound still works even if they're dependent. Okay, dependence is of course the next thing. uh you can have a set of um events and these may be mutually independent which means that for all subsets of these sets if you take their intersection the probability to have all of these events in that set I at the same time is just the product of their indiv individual probabilities if that is the case then we call these mutually independent knowing that one occurs doesn't tell you anything about whether the other occurs.
17:04 That's the intuition. Uh we don't need this for infinite sets. I think now um maybe we do an infinite set of events is is independent if every finite subset is and then uh that that extends. Uh here mutually independent is for the entire set. You can also say out of this set of events I only need that every element every subset of at most three elements is independent. Then we can call this kwise independence. The special case for k equals two pairwise independence is what you often use to analyze hashing. Maybe there you've seen that before.
17:52 I guess conditional probability people know uh the probability that A occurs given that I know B occurred. You can write as uh just the probability of them both divided by the probability for B. Um and from that you can define this or you can derive this law of total probability. Sometimes useful just to compute probabilities. You want to know the probability of some event. Maybe that's complicated, but you can condition on other events and then multiply the conditional probability times the probability for that other event.
18:32 Uh random variables are mapping these abstract things from our probability space to some number we can compute with. Uh specifically we'll usually have real numbers or maybe some subset even or maybe a a vector you know uh we can define the event that a random variable attains a specific value. Um I'm going write this with these kind of indicator random variables.
19:04 Um so the one a I'll mostly use for um this is a a number either zero or one whereas this is an event which is some abstract set. That's maybe the distinction to keep in mind for the random variables. We can also define the cumulative distribution function. same as before. Uh yeah, even if the space is continuous, we might map it to a a smaller number. We could map the real interval to I don't know um to whether the number is in the first, second or third third and then it becomes discrete.
19:57 So everything that that we said about probability spaces, you can map to random variables if if the mapping gives you that. Ah um maybe a bit non-standard but I think extremely useful or convenient. That's the right way to do it. Um we'll I'll write equals with a d on top to say that these two random quantities the random variable x and random variable y are equal in distribution. um which means their this is precisely the formal definition is that their distribution function their CDF is the same this doesn't mean that they have the same value right so um it's much weaker than saying equal we could also write x equal y that would mean they always have exactly the same value in any possible outcome of this random universe equality distribution is much much weaker it might be that they have very different values. Usually they could even always have the same different value. I guess uh maybe you can define examples like this. Sure, you can have two coins and you know one is always the opposite of the other.
21:09 But if they're fair coins, then they're both just um a burly distribution. So they could be equal in distribution despite deterministically being never the same. Okay, I don't know if that's important. Um, you can lift independence from events to random variables is like um I don't know if I'm if this is boring or useful is defined in the same way. they're independent if the probabilities factor.
21:50 Um you can write this directly for a discrete then you can just say these these events factor. Uh for continuous ones the easiest is if the if the density is factors pdf is probability density function. Are these acronyms um self-explanatory enough? Maybe I should write them once. the cumulative distribution function this we had let's see f the capital fs then pd pmf is probability mass function probability weights uh say pi and pdf is probability density function Okay. Um, important for the algorithms often will be iid sequences of random variables which means independent and identically distributed random variables. So many copies of the same event, the same random experiment usually.
23:19 okay expectations um for discrete ones you sum up all possible values then the value times the probability to have that value. Now here it's important that really these uh map to some numbers we can compute with that's why we have random variables separate from just the probability spaces and for continuous with a distribution with the density you can define the expectation as an integral um the expectation may be undefined if this this sum or integral doesn't properly converge. So strictly speaking the condition is it needs to absolutely converge convergion absolute value.
24:05 Um expectation is a linear operator because it's essentially a sum respectively an integral. So it inherits linearity. Uh of course let me just stress this. This is even true if they are dependent. You do not need independence of the random variables x and y to do this because sums and integrals are still linear. Okay. Uh if they're independent then also the product factors that well you can calculate I guess you know as well.
24:42 Yeah you can define conditional expectations based on conditional probabilities. The expectation of X given that we know an event A occurs is the same as the formula for expectation but now the probabilities have this conditioning. being baked in. Okay. Um you can also do this uh if the event you condition on is some random variable having a specific value. That's often what one might want to use. Uh I think forget about this. Um I don't think we use this anywhere. Um yeah note that if you do this this conditioning on y having a specific value so the expectation of x given that y has a fixed value that's again um a random variable because um this y is is still random as a function of this little y that you fix. And so you can write this as a function of y is the expectation of x given y. So you're conditioning here not on a fixed event in the notation at least you just say condition on y but you're conditioning on something random now. So the result is a random variable in y and then you can write these lovely things. The total law of total expectation sometimes makes it easier to compute things. Same same as for conditional probabilities. This is just translated almost done. Yeah. Um just for reference a few distributions that pop up. Um I wanted to have them because they're named after some mathematician not at what after what they are. So Berni is a coin flip with probability P for for well whatever heads or tails is is one. um a binomial distribution I'm sure you know is the can be written as the sum of independent Bernoli trials and here this is why I like this equality and distribution so much because you can write these um these concise definitions so maybe you know what a binomial distribution is I suppose but the uh notation here is maybe worth studying we have x1 up to xn as independent and identically distributed random variables each has as distribution the Bernoli distribution with some parameter P and now I can say Y equals not only distribution exactly right is the sum of these and then I can say Y has is equal in distribution to this binomial uh B and P. Now, if you're strict, what I write here is a random variable on the left and a distribution on the right, but doesn't type check if you're strict.
27:43 So, if you care, you could define B of P to be an anonymous random variable with the distribution of a Bernoli distribution. I've seen that in papers. Um, you may not care uh if you just read this as expressing that X has this distribution. It's the same. Okay. Uniform distribution over some discrete set I think is clear. And the geometric distribution just pops up a lot. It's uh how often do you have to try before you see the first one in coin flips with probability P. So the probability to to need K such coin flips is K minus one times it didn't work and then the K one worked.
28:31 Okay. The only other I think I didn't didn't find any other interesting distributions that we need a lot. So the only continuous one is this uniform one. Uh we will come back to this weird infinite string one in a second.