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.

## Algebra 2

### Course: Algebra 2>Unit 12

Lesson 4: Modeling with two variables

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?

• 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).
• 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.
• 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?
• 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.
• I still don't get WHY Sal write 1-p (adds one to -p)
• The left side of the inequality has to use the probability of getting a candy that is NOT a Honey Bunny. Remember, the probability of getting any candy would = 1. The probability of a Honey Bunny = P. So NOT getting a Honey Bunney = 1 - P.
Hope this helps.
• why can't you just multiply by 2 instead of squaring?
• 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.
• Why does sal switch the greater than sign to a less than sign? Did he multiply or divide by something negative?
• 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.
• 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.
• 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.
• 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.
• 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.
• 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.
• I need help for this inequality word problem. Here it is.

Inequality word problem.?
The Jacksons and the Simpsons were competing in the final leg of the Amazing Race, which was 240 kilometers long.

In their race to the finish, the Jacksons immediately took off traveling at an average speed of v kilometers per hour. The Simpsons' start was delayed by an hour. When they eventually took off, they traveled at an average speed that was 40 kilometers per hour faster than the Jacksons' speed. Sadly for them, that didn't help, and the Jacksons won.Write an inequality in terms of v that models the situation.

240/v = t (time for the winners)

240/(v+40) + 1 > t ..

240/(v+40) + 1 > (240/v).. answer..
• Looks right to me. If you need to solve it keep in mind time cannot be negative, and each side of the inequality represents the time of one of the families.
(1 vote)
• Around in the video, Sal says that the equation can be simplified to p>4 because if something is greater than 4 it must be greater than 1/4. Wouldn't the equation be simplified to p>1/4 because if it is p>4 than p cannot be 2/4 which is greater than 1/4 but not greater than 4.
(1 vote)
• No, that part of the solution cannot be simplified to p > ¼

You want a summary statement that works all the time, and the solutions must satisfy both p > ¼ `and` p > 4
There are two parts of the constraint he has to consider: the positive case where
the raw solutions are p > ¼ `and` p > 4
Using your 2/4, that cannot be a solution because it is not greater than 4. Giving p > ¼ as the summary solution would say that you could have 2/4 as a solution.