Skip to content

Instantly share code, notes, and snippets.

@eduardoleon
Created February 25, 2019 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduardoleon/be344716ba33f429597f215c6d373df0 to your computer and use it in GitHub Desktop.
Save eduardoleon/be344716ba33f429597f215c6d373df0 to your computer and use it in GitHub Desktop.
unyu's teaching sucks
<stevie> Hi, I am having trouble with this statistics problem:
http://dpaste.com/267R2R4 - Would anyone be able to help push me in
the right direction? [18:37]
<indomitable> stevie, I'm going to recommend reading two chapters in secondary
school statistics [18:38]
<indomitable> This is basic stuff
<unyu> indomitable: All the more reason for you to help him. Do you want to be
asked hard questions?
<unyu> stevie: Let's work with one bolt at a time, and only then figure out
how to combine the information from all 25 bolts. [18:44]
<unyu> Actually, no, let's work with two bolts [18:45]
<stevie> ok
<unyu> So, for the time being, n = 2, rather than n = 25.
<unyu> What do you think is the probability that exactly one bolt is rated
“high”?
<unyu> stevie: If you have two bolts, then there are two different ways in
which exactly one bolt is rated “high”. [18:47]
<stevie> 40% [18:48]
<unyu> Errr, how did you get to that 40%?
<stevie> The number of bolts shouldn't affect it's % of strength right?
<unyu> ?
<unyu> What is “the % of strength” here?
<unyu> Those 30%, 40%, 20% and 10% are not strength values.
<unyu> They are probabilities.
<unyu> Anyhow.
<unyu> As I was saying, if you have two bolts, there are two different ways in
which exactly one of them is rated “high”.
<unyu> One of them is “the first bolt is rated ‘high’ but the second
isn't”. The other is “the first bolt isn't rated ‘high’ but the second
one is”. [18:50]
<stevie> makes sense
<unyu> Good.
<unyu> Moreover, these two possibilities are mutually exclusive.
<unyu> So far so good? [18:51]
<stevie> yeah
<unyu> When you have two mutually exclusive possibilities, the probability
that any of them happens is the sum of the possibilities' individual
probabilities.
<unyu> Actually, this works for three or more mutually exclusive possibilities
as well. [18:52]
<unyu> But they have to be mutually exclusive.
<unyu> I will use the notation P(something happens) to denote “probability
that something happens”.
<unyu> Thus, P(exactly one bolt is rated “high”) = P(first is “high” but
second isn't) + P(first isn't “high” but second is). [18:53]
<unyu> stevie: So far so good? If you need me to stop to digest the ideas or
to ask questions, feel free to tell me to stop. [18:54]
<stevie> digesting it while I draw it out in my notebook
<unyu> Okay.
<unyu> Tell me when you're done.
<stevie> unyu: they dont have to necessarily sum up to 1 right? [18:56]
<unyu> If all you know is that these possibliities are mutually exclusive,
then you don't know that their probabilities add up to 1. [18:57]
<stevie> ok
<unyu> They add up to one when the possibilities are exhaustive - nothing else
could happen.
<unyu> So, for instance P(no bolt is rated “high”) + P(one bolt is rated
“high”) + P(both bolts are rated “high”) = 1. [18:58]
<stevie> makes sense
<unyu> So, back to our example.
<unyu> We want to compute P(exactly one bolt is “high”), and we know that we
can obtain this by adding P(only first bolt is “high”) and P(only
second bolt is “high”). [18:59]
<unyu> So let's compute P(only first bolt is “high”).
<indomitable> and he says he's bad at teaching, pffft
<unyu> stevie: The problem statement tells you that the bolts are
*independent*.
<unyu> stevie: This means that the probability the first bolt is rather
<anything> does not depend on the probability that the second bolt is
rated <anything else>.
<unyu> When you have two independent possibilities A and B, you can say
[19:01]
<unyu> P(A happens and B happens) = P(A happens) * P(B happens)
<unyu> In particular, in our example, you can say
<unyu> P(first bolt is rated “high” but second isn't) = P(first bolt is rated
“high”) * P(second bolt isn't rated “high”). [19:02]
<unyu> stevie: So far so good? (Again, at this point I can stop if you need
time to process what I'm saying.)
<stevie> ok I think i'm following you [19:04]
<unyu> stevie: So, using this information, what do you think should be P(first
bolt is rated “high” but second isn't) ? [19:05]
<stevie> oh so I think I'm starting to see what you're getting at. I can get
the 7, 8, 6, and 4 in any order
<unyu> Yeah, but we will address that much later.
<stevie> and there's multiple combinations of that would contain it
<unyu> Yes, you are completely right about that. [19:07]
<stevie> so I need get the amount of permutations containing those
numbers/total permutations?
<unyu> Yes.
<unyu> No, wait, the last thing you said is not quite right.
<unyu> It's more complicated. [19:08]
<unyu> So let's not get ahead of ourselves.
<unyu> Try to solve the little exercise I gave you.
<stevie> ok
<unyu> What do you think should be P(first bolt is rated “high” but second
isn't) ?
<stevie> 0.04? [19:10]
<unyu> How did you get that 0.04?
<stevie> I should use choose right? [19:11]
<unyu> I didn't say anything about choose yet.
<unyu> What I asked is “If you are given two independent bolts, what is the
probability that the first is rated high but the second one isn't?”
<unyu> first one*
<stevie> not sure I know I need to find P(1st bolt is high and 2nd isnt) *
P(2nd is high and 1st isnt) [19:14]
<unyu> No.
<indomitable> stevie, Well what's the probability of the first one being high?
<unyu> You need to find P(1st bolt is high) and P(2nd bolt isn't)
<stevie> 1/4?
<stevie> or 40% [19:15]
<unyu> How did you get that 1/4?
<indomitable> stevie, 40% is not 1/4. :P
<stevie> well yeah
<unyu> I'll work you through this slowly this time.
<stevie> ok, since they're independent, each bolt in a set of n bolts has the
same chance of being that strenght
<stevie> i see now
<indomitable> yes, that is true. every bolt has a 30% chance of being "very
high", for instance. [19:16]
<unyu> As I'm saying, don't get too far ahead of yourself.
<unyu> Focus on the concrete problem at hand.
<indomitable> stevie, so you know that "high" is 40%. What's "not high"?
<unyu> indomitable: Your crappy use of terminology is undoing all my efforts.
[19:17]
<indomitable> unyu, I'm sorry. :(
<unyu> “high is 40%” --> What the hell is this shit?
<stevie> it would be 1-0.40 = 60% though right?
<unyu> 40% is the probability that a bolt is rated “high” [19:18]
<unyu> And 60% is indeed the probability that a bolt is rated something other
than “high”
<indomitable> well, 1-0.4 isn't 60%, but close. it's 0.6. % is just a thing we
use to confuse children
<unyu> stevie: So, what is the probability that the first bolt is rated
“high”? [19:19]
<indomitable> that might feel like a trick question but it isn't
<stevie> 40%
<unyu> Good.
<unyu> And what is the probability that the second bolt is rated something
other than “high”?
<stevie> 60%
<unyu> Good.
<indomitable> huzzah
<unyu> And what is the probability that the first bolt is rather “high” *and*
the second bolt is rated something else? [19:20]
<unyu> Remember that the bolts are independent, and use what I told you about
P(A happens and B happens) when A and B are independent.
<unyu> Argh [19:21]
<unyu> I keep saying “rather” rather than “rated”.
<stevie> 24%
<unyu> Good! [19:22]
<unyu> However, this is not the answer to the original question.
<unyu> Recall that we actually wanted to know the probability that exactly one
bolt is rated “high”.
<unyu> But it doesn't have to be the first.
<unyu> It could be the second.
<unyu> So, what do we need to do?
<stevie> is calculating P(exactly 1 bolt is "high") = P(1st is high 2nd isnt)
+ P(1st isnt 2nd is "high")? [19:26]
<unyu> Yes.
<stevie> 80%?
<unyu> Wh-what?
<unyu> How did you get that 80%?
<unyu> You already computed P(1st is high 2nd isnt) = 24%. [19:27]
<stevie> oh, I see
<unyu> stevie: No, it wouldn't be 44%.
<unyu> stevie: And sorry, I didn't notice you had already answered.
<unyu> stevie: Rather than blurt out numbers, show me your solution procedure.
[19:30]
<unyu> stevie: Because if you blurt out a wrong number, I can't tell where
your mistake is.
<stevie> Let T be a high bolt and let t be non-high bolt. We know that P(T t)
= 0.24 - Therefore, wouldn't P(t T) = 0.24 since they are
independent?
<unyu> Yes. [19:32]
<indomitable> huzzah
<unyu> stevie: And then, what is the probability that exactly one bolt is
rated “high”?
<stevie> 48%
<unyu> Good!
<stevie> oh i said 44
<unyu> :-p
<stevie> I meant to say 48
<stevie> haha ok I see now [19:33]
<unyu> Okay, no problem.
<unyu> stevie: Now we are going back to the original problem that you gave.
[19:34]
<unyu> We want to know the probability that 7 bolts are rated “very right”, 8
bolts are rated “high”, 6 are rated “average” and 4 are rated “low”.
<unyu> We are going to do this in a clever way.
<unyu> What I'm going to do first is tweak the question a little.
<unyu> In order to get a question that's slightly easier to answer.
<stevie> ok
<unyu> stevie: My tweaked question is: What is the probability that the first
7 bolts are rated “very high”, the next 8 bolts are rated “high”, the
next 6 bolts are rated “average”, and the last 4 bolts are rated “low”?
<unyu> stevie: For your convenience, you are allowed to give your answer as an
expression, rather than compute its final value, which would be a super
small number. [19:37]
<stevie> i'll try this and report back
<indomitable> stevie, did you figure it out [19:55]
<unyu> stevie: In case I wasn't clear the last time, don't bother computing a
numerical answer. [19:56]
<unyu> stevie: Just give me an expression whose value should be the answer.
<unyu> stevie: If/when we need a numerical value, we can use a computer.
<stevie> unyu: yeah I got no idea
<unyu> Let's start by recalling the tweaked question. [20:03]
<unyu> What is the probability that the first 7 bolts are rated “very high”,
the next 8 bolts are rated “high”, the next 6 bolts are rated
“average”, and the last 4 bolts are rated “low”?
<unyu> Since the bolts are independent, we can say
<unyu> P(...) = P(first 7 are “very high”) * P(next 8 are “high”) * P(next 6
are “average”) * P(last 4 are “low”) [20:04]
<unyu> So far so good?
<stevie> Yes, makes sense
<unyu> Using independence even more, we can say [20:05]
<unyu> P(first 7 are “very high”) = P(1st is “high”) * ... * P(7th is “high”)
<unyu> Argh
<unyu> P(first 7 are “very high”) = P(1st is “very high”) * ... * P(7th is
“very high”)
<unyu> P(next 8 are “very high”) = P(8th is “high”) * ... * P(15th is “high”)
<unyu> P(next 6 are “average”) = P(16th is “average”) * ... * P(21st is
“average”) [20:06]
<unyu> P(last 4 are “low”) = P(22nd is “low”) * ... * P(25th is “low”)
<stevie> right
<unyu> Can you take it from here?
<stevie> the probability would be decreasing as you get toward 25 [20:07]
<unyu> Don't worry about the exact number.
<unyu> Give me an expression.
<unyu> For example, if the answer were 3, you could tell me 1 + 2.
<unyu> (Of course, the answer can't be 3, because a probability can't be 3.)
<stevie> ok let me try [20:09]
<stevie>
https://www.wolframalpha.com/input/?i=(((0.3)%5E7)*((0.4)%5E8)*((0.2)%5E6)*((0.10)%5E4))%2F25
<unyu> As I said, don't worry about the number.
<unyu> I'm not asking the kind of question that requires Wolfram Alpha to
solve.
<unyu> Also, I'm not sure where you got your 1/25 from. [20:15]
<stevie> it just displayed the expr nice
<unyu> Where did you get your 1/25 from?
<unyu> Phrased differently: Why are you dividing by 25?
<stevie> I saw something similiar in my textbook
<stevie> but I don't totally understand it
<unyu> Using stuff you don't understand tends to be okay elsewhere.
<unyu> For example, I don't understand how computers work, yet I use
computers. [20:17]
<unyu> But in mathematics, this tends to have disastrous results.
<unyu> Like right now.
<unyu> Remember our example with 2 bolts.
<stevie> If I removed the /25 - does it make sense? Because the exponents make
the percentages decreases with each succeeding event which was inline
which what I was thinking [20:18]
<unyu> stevie: If you removed the division by 25, it makes sense.
<stevie> and then they all multiplied together as we said we can do by
independence
<unyu> Right.
<stevie> they are all*
<unyu> The answer is indeed 0.3^7 * 0.4^8 * 0.2^6 * 0.1^4. [20:19]
<unyu> But remember that this is the answer to a *tweaked* question.
<unyu> In our tweaked scenario, the first 7 bolts were “very high”, the next 8
were “high”, and so on. [20:20]
<stevie> right, but in the original - they don't need to be ordered
<unyu> Exactly.
<unyu> In our original scenario, we know that 7 bolts are “very high” - but
not necessarily the first 7 ones. Similarly, we know that 8 bolts are
“high” - but not necessarily the 8th through the 15th. [20:21]
<unyu> And so on.
<unyu> Before we can address the original question, I'm going to ask a second
tweaked question.
<unyu> It is going to take me a while to type, so please be patient. [20:22]
<stevie> np thank you for helping
<unyu> What is the probability that the first 3 bolts are rater “low”, the
next 4 ones are rated “high”, the next 2 ones are rated “average”, the
next one is rated “low”, the next 3 ones are rated “very high”, the
next 4 ones are rated “high”, the next 4 ones are rated “average”, and
the last 4 ones are rated “very high”?
* unyu hopes he counted correctly. [20:24]
<unyu> Note that, in total, we still have 7 bolts rated “very high”, 8 bolts
rated “high”, 6 bolts rated “average” and 4 bolts rated “low”. They
come in a different order than in the first tweaked scenario, but this
order is still fixed. [20:25]
<stevie> is is still 0.3^7 + 0.4^8 + .. [20:26]
<stevie> is it*
<unyu> Yes.
<unyu> Bingo.
<stevie> It's just another permutation with an equal chance of being selected
<unyu> Exactly. [20:27]
<stevie> 0.3^7 + 0.4^8 + .. is the probability for each permutation of 25!?
<unyu> Errr, wait.
<unyu> I misread what you said.
<unyu> I thought you said * instead of +. [20:28]
<stevie> oh I mean *
<stevie> not +
<unyu> Our original answer was 0.3^7 * 0.4^8 * 0.2^6 * 0.1^4
<unyu> That's the answer in both tweaked scenarios.
<stevie> yeah my bad
<unyu> :-)
<unyu> Now, notice that we could construct as many tweaked scenarios as there
are permutations of 7 bolts rated “very high”, 8 bolts rated “high”, 6
bolts rated “average” and 4 bolts rated “low”. [20:29]
<unyu> Hence, we may write
<unyu> P(untweaked scenario) = P(first tweaked scenario) + P(another tweaked
scenario) + ... + P(last tweaked scenario) [20:30]
<unyu> Moreover P(any tweaked scenario) = 0.3^7 * 0.4^8 * 0.2^6 * 0.1^4
<unyu> So far so good? (Again, I can stop here, and you may ask questions or
simply take your time to think.)
<stevie> so its any scenario containing 7 very high, 8 high, 6 average, 4 low
[20:31]
<unyu> Yes.
<stevie> ok makes sense
<unyu> Now, since the probability of all tweaked scenarios is the same, we can
say
<unyu> P(untweaked scenario) = P(any tweaked scenario) * <number of tweaked
scenarios> [20:32]
<stevie> ahh ok - i see where this is going [20:33]
<unyu> :-)
<stevie> let me write this down
<unyu> Okay.
<unyu> Tell me when you're done.
<indomitable> stevie, but how many tweaked scenarios are there? ;)
<unyu> indomitable: One idea at a time. [20:34]
<unyu> indomitable: How to count the tweaked scenarios has to be covered
separately.
<unyu> indomitable: I'm sure this stuff is routine for you. But you would ask
for the same kind of patience if you were studying something that is
new to you. Or maybe something that isn't new to you, but which you
never understood very well.
<indomitable> I'm not trying to be mean, I apologize if that seems like my
intent. [20:37]
<unyu> Oh, I know you mean well.
<indomitable> Probability isn't an easy thing to wrap your head around so I'm
by no means annoyed at showing patience.
<indomitable> (I actually had a good book in mind before you started helping,
with those two chapters I was talking about :P) [20:38]
<unyu> That book is in most likelihood better than my help. :-p [20:39]
<stevie> ok [20:40]
<unyu> Back.
<unyu> (Sorry, was fetching food.)
<indomitable> What kind of food? Did you bring for everyone? :D
<unyu> stevie: So, as indomitable said, we need to count the tweaked
scenarios. [20:41]
<unyu> indomitable: Chinese, made by dad, just enough for me, I'm afraid.
<stevie> unyu: is this where you would use choose?
<unyu> stevie: Yes.
<unyu> I'm suddenly uninspired to continue trying to teach “properly”. So I'll
just say that the formula for counting these kind of permutations is
<unyu> <total items>! / (<items of first kind>! <items of second kind>! <items
of third kind>! ... <items of last kind>!) [20:43]
<stevie> oh, yeah I've seen that [20:44]
<stevie> so I would do (25!/7!8!6!4!)(0.3^7)*(0.4^8)..?
<unyu> Yes. [20:45]
<unyu> And that should be your final answer.
<stevie> awesome - thank you
<unyu> You are welcome.
<stevie> that makes a world more sense than it did before
<stevie> thank again for all the help
<unyu> Yes, that was the point to working through it.
<unyu> Making it make sense. [20:46]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment