If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Quadratic inequality word problem

Sal models a context that concerns a candy vending machine. The model turns out to be a quadratic inequality. Created by Sal Khan.

Want to join the conversation?

  • starky sapling style avatar for user Hodorious
    Can someone explain to me how the probability of getting a candy other than Honey Bunny is (1-p)^2? If the two events were independent then this would work. But they are not. The probability of getting a certain type of candy the first time is different than the probability of getting the same type of candy the second time. That's because by the second draw there will be less candies (we picked one on our first draw).
    (18 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user kea241199
      Sorry for necroposting, but this is for the new students watching this video. It is possible to create a vending machine wherein the probability of getting a specific type of candy can be programmed.

      Imagine an array of dispensers each containing candies of one type such that no two dispensers contain the same type of candy. Let's say that the first dispenser contains Honey Bunny candies. Now, a computer will generate a number, let's call it r, between 0 (inclusive) and 1 (exclusive) e.g. something like Math.random() in JavaScript. Now we can tell the computer, "if 0 ≤ r < 0.25, release one candy from the first dispenser." and so on.

      This means, for this particular vending machine, the probability of getting a specific type of candy is not dependent on the total number of candies. So each draw is an independent event.
      (15 votes)
  • male robot hal style avatar for user Studying
    I still don't get WHY Sal write 1-p (adds one to -p)
    (5 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user armin.burkholder
    With some effort, I followed everything up to getting the two possible values 1/4 and 4. But then at Sal plugs those numbers into (p-.25)(p-4) > 0

    First, I don't understand where that inequality (p-.25)(p-4)>0 was conjured from. Aren't 1/4 and 4 solutions for p?

    Second, if we are solving for p, why not just plug each of the solutions back into one of the previous inequalities that was derived? What I'm asking is why didn't he just replace p with 1/4 and 4 in the
    4p^2-17p+4>0 inequality and see if they were true?
    (13 votes)
    Default Khan Academy avatar avatar for user
    • leafers seedling style avatar for user eplinox
      4 and 1/4 are the roots which are obtained through the quadratic formula or completing the square. If you were to find the roots through factoring instead you would come from p^2-(17/4)p+1>0 at to (p-1/4)(p-4)>0 at . Try expanding (p-1/4)(p-4). so from the factored form we can see for it to hold true, p must be either greater than 4 or less than 1/4. It seems like Sal pulled out the factorised form from nowhere but actually he used the quadratic formula to to get the roots and then worked backwards to see how they would fit in the factored form.
      (5 votes)
  • aqualine seedling style avatar for user Diana Valle
    why can't you just multiply by 2 instead of squaring?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user InnocentRealist
      The probability of these 2 things both happening is the product of their probabilities, because it is directly proportional to the probability of each one.
      Like the probability of getting heads twice is .5*.5 = .25. There are 4 possibilities:
      HH, HT, TH, TT. each is .5*.5 = .25. The chances of getting one of these 4 should be what?
      (1, because you have to get one of the 4, so you're chances are 100%) So you see that if they are each .5*.5 = .25, that they add up to 1, so the product rule checks out.
      (7 votes)
  • male robot johnny style avatar for user Mohamed Ibrahim
    Would've been better if this was after probability lessons
    (5 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user Jude
    Why does sal switch the greater than sign to a less than sign? Did he multiply or divide by something negative?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Raymond
      Where do you mean? ?

      That was because the function had to be >0, which meant either the two factors, (p-1/4) and (p-4), were both positive or both negative (since multiplied together, both possibilities who have a positive, >0, product).

      So for the both - possibility, he reversed the inequality sign for both factors.
      (2 votes)
  • blobby green style avatar for user Sam Valor
    I completed the square instead of using the quadratic formula and factoring and my output was p > 4, I didn't get a p < 1/4 or any p < x for that matter; so where did I go wrong?
    What I did:
    (1-p)^2 > 9/4*p
    p^2-2p+1 > 9/4*p
    p^-17/4*p+1 > 0
    p^2-17/4*p+289/64 > -1+289/64
    (p-17/8)^2 > 225/64
    (p-17/8) > +/-15/8
    p > (17+/-15)/8
    p > 4
    p > 1/4
    simplifies to p > 4.
    (2 votes)
    Default Khan Academy avatar avatar for user
    • marcimus pink style avatar for user Tyler
      The error was right here:

      (p-17/8)^2 > 225/64
      (p-17/8) > +/-15/8

      Here's the thing: we know that a probability (p) must always be between 0 and 1. It wouldn't make sense for there to be a -15% chance of something, or a 140% chance of something, etc. So "p" must be between 0 and 1.

      Thus, p-17/8 will always be negative, no matter what "p" equals. So let's look at the problem again:

      (p-17/8)^2 > 225/64
      (p-17/8) > +/-15/8

      By taking the square root of both sides, you are essentially dividing both sides by "p-17/8". This is because "(p-17/8)^2" (the thing you had in the first step) divided by "p-17/8" is equal to "p-17/8" (the thing you had in the second step). So when you went from the first step to the second step above, you were essentially dividing by "p-17/8".

      However, we just said that "p-17/8" must be a negative number, because "p" is always from 0 to 1. So, by dividing by "p-17/8", we are dividing by a negative number! And when we divide by a negative in an inequality, we have to flip the sign. So it becomes:

      p-17/8 < ±15/8

      And you can solve the rest yourself.

      Just remember what taking a square root means. "Squaring" a number means multiplying it by itself; so when you take a square root, you are just dividing. So you just always need to check whether you're dividing by a positive or a negative, and then flip the sign if necessary.

      I hope this helps.
      (3 votes)
  • duskpin ultimate style avatar for user yikian2021
    at why is the probability of get a candy (1-p) I know this is a dumb question but my brain just doesn't get it.
    (2 votes)
    Default Khan Academy avatar avatar for user
    • blobby blue style avatar for user joshua
      Recall that you either get the Honey candy, or you don't. So (1 - p) means the probability when you don't get the Honey candy (since P(you get) + P(you don't get) = 1).

      And getting 2 non-Honey candy in a row means (1 - p) * (1 - p) = (1 - p)^2.
      (3 votes)
  • aqualine ultimate style avatar for user Daniel
    Is it true that this is math?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Fred Haynes
    I am in a bit of a discussion with someone about the correct answer of a problem that was on one of the Inequality Quizzes.

    We were given a word problem and the quiz was to write an inequality for the word problem. I won't write out the word problem but the correct inequality for the word problem was:

    50000*(4/3)^t<100000.

    What is the answer for t?

    Thanks very much. The sooner the better (because I am in a discuss) LOL!

    Sincerely,
    Fred H.
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

Lisa owns a "Random Candy" vending machine, which is a machine that picks a candy out of an assortment in a random fashion. Lisa controls the probability in which each candy is picked. She is running out of "Honey Bunny," so she wants to program its probability so that the probability of getting a different candy twice in a row is greater than 2 and 1/4 times the probability of getting "Honey Bunny" in one try. So let me read that again. She wants to program its probability so that the probability of getting a different candy twice in a row, or really any other candy twice in a row, is greater than 2 and 1/4 times the probability of getting "Honey Bunny" in one try. Write an inequality that models the situation. Use p to represent the probability of getting "Honey Bunny" in one try. Solve the inequality, and complete the sentence. Remember that the probability must be a number between 0 and 1. So we want to write the inequality that models the problem here. And then we want to complete the sentence, the probability of getting "Honey Bunny" in one try must be-- so they give us a bunch of options. Greater than, greater than or equal to, less than, less than or equal to, and then we have to put some number here. So to work through this, I've copy and pasted this problem onto my little scratch pad right over here. And so let's just think about it a little bit. So they tell us, use p to represent the probability of getting "Honey Bunny" in one try. And they also say she wants to program its probability so that the probability of getting a different candy twice in a row is greater than 2 and 1/4 the probability of getting "Honey Bunny" in one try. So if p is the probability of getting "Honey Bunny," what's the probability of getting any other candy at once? Well, that's going to be 1 minus p. If you have a probability of p of getting "Honey Bunny, well, then it's 1 minus p of anything but "Honey Bunny." Now, what's the probability of getting this twice in a row, of getting anything else twice in a row? Well, you're just going to multiply this probability times itself. It's going to be 1 minus p times 1 minus p, or we could just write that as 1 minus p squared. So this right over here is the probability of getting a different candy, any other candy, twice in a row. So prob of any other non-"Honey Bunny" candy, any other candy, twice in a row. Now, they tell us that this probability needs to be greater than 2 and 1/4 times the probability of getting "Honey Bunny" in one try. So is greater than 2 and 1/4 times the probability of getting "Honey Bunny" in one try, well, that is p-- times p. So we have just set up the first part. We have written an inequality that models the situation. Now let's actually solve this inequality. And so to do that, I will just expand 1 minus p squared out. 1 minus p squared is the same thing as-- well, I'll just multiply it out. So this is going to be 1 squared minus 2p plus p squared. And that's going to be greater than 2 and 1/4 p. Now let's see. If we subtract 2 and 1/4 p from both sides, we're going to be left with-- and I'm going to reorder this. We're going to get p squared. So you have minus 2p minus 2 and 1/4 p, so that's going to get us minus 4 and 1/4 p. Or let me just write that as 17/4 p plus 1 is greater than 0. And so let's think about solving this quadratic right over here. And under which circumstances is this greater than 0? To think about it, let's factor it. And actually, before we factor it, let's simplify it a little bit. I don't like having this 17/4 right over here, so let's multiply both sides times 4. And since 4 is a positive number, it's not going to change the sign, the direction of this inequality. So we could rewrite this as 4p squared minus 17p plus 4 is greater than 0. And let's see. What are the roots of this? And we could use the quadratic formula if we wanted to do it really quick. We could probably do it other ways. But negative b-- so it's going to be 17 plus or minus the square root of negative 17 squared-- b squared-- so that's 289 minus 4 times a times c. Well a times c is 16 times 4, so minus 64. All of that over 2 times a-- all of that over 8. So that's 17 plus or minus-- let's see, this is the square root of 225 over 8, which is equal to 17 plus or minus 15 over 8, which is equal to-- let's see, 17 minus 15 over 8 is 2/8-- which is equal to 2/8 or 1/4. So that's one of them. That's when we take the minus. And if we add 17 plus 15, that gets us to 32 divided by 8 is 4. So there's two situations right over here. Let's factor this out. We could write this as p minus 1/4 times p minus 4 is greater than 0. So under what circumstances is this going to be true? What constraints are this going to be true? Well if you're taking the product of two terms and they are going to be greater than 0, that means that these two things have to be the same sign. Or actually, in particular, they both have to be positive, or they both have to be negative. So let's look at those two situations. And I'll switch colors here just for fun-- so both positive or both negative. So if they are both positive-- let me do it here. That means that p minus 1/4 has to be greater than 0, and p minus 4 is greater than 0. Add 1/4 on both sides right over here. You get p is greater than 1/4, and p is greater than 4. So that's the situation where they are both positive. Now, what about if they are both negative? Well then you have p minus 1/4 is less than 0, and p minus 4 is less than 0. Add 1/4 here. So p needs to be less than 1/4, and p needs to be less than 4. Now, what does this constraint simplify to? p has to be greater than 1/4, and p has to be greater than 4. Well, if p is greater than 4, it's definitely going to be greater than 1/4. So all of this collapses into p needs to be greater than 4. That's the situation where both are positive. p must be greater than 4. Now what about here? Well if p is less than 1/4, it's definitely going to be less than four. And this is an and right over here, so this collapses to p is a less than 1/4. So which one do we go with-- p needs to be greater than 4, or p needs to be less than 1/4? Well, we need to remind ourselves that we're talking about a probability. To go back to the original problem, we're talking about a probability of someone getting "Honey Bunny" in one try. A probability must be between 0 and 1, so the probability having to be greater than 4, well that just doesn't make any sense. That doesn't make any sense in the context of this question. So we have to go with the probability of getting "Honey Bunny" needs to be less than 1/4, or less than 0.25, which makes complete sense. So let's fill in this information. This was the inequality that modeled the problem. And we got p has to be less than 1/4. So let's go back to the original problem. The inequality was 1 minus p squared needs to be greater than 2 and 1/4. So we could write that multiple times. I could write that as 2.25 times p. And then the probability of getting "Honey Bunny" in one try must be less than 0.25. And we're done.