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

Worked example: determining domain word problem (positive integers)

Determining the domain of a function that models the price of candy bars.

Want to join the conversation?

  • blobby green style avatar for user Valerie Gray
    please explain the difference between the brackets
    (0 votes)
    Default Khan Academy avatar avatar for user
    • leaf orange style avatar for user YanSu
      [ = Represented as a closed dot on a number line. Up to and INCLUDING that value. Exmp. [-1,4] Means all values between -1 and 4, inclusive, meaning it includes -1 and 4.
      ( = Represented as an open dot on a number line. Up to but NOT INCLUDING that value. Parentheses are also used in front of negative or positive infinity. Exmps. (-4,6) Means all values between -4 and 6 exclusive, meaning it doesn't include -4 or 6. (-∞,4} Means all values between negative infinity and 4, including 4.
      { = Usually indicate sets. Exmp. {x ∈ ℝ | -4 < x < 9 }
      In words: X belongs to the set of real numbers such that it is greater than -4 and less than 9.
      (26 votes)
  • duskpin tree style avatar for user .
    how do i buy 0 candy bars
    (4 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      You getting caught up on the word "buy" in too technical of a sense. When you are at the store, you do not have to buy every item that there is. You can choose to buy nothing of most of the items, So choosing to buy nothing and choosing to not buy something are the same thing.
      (9 votes)
  • male robot hal style avatar for user RandomDad
    Can the domain be [0,401) since b epsilon to integer?
    (7 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user john
    At , Sal says "the fewest number of candy bars we can buy is zero candy bars". Why is this so? The definition of a purchase is receiving goods in exchange for money. Surely no money and no candy bars equals no purchase. Do all functions just have to accept zero as an input?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user programminglegend1029
      Not all functions have the same words like "purchase" so this makes it easier to understand so in a less mathy way of saying it is "you can buy No candy bars" for $0.00( my keyboard does not have the cent symbol).

      So manly all functions have different meaning of the words so they can all accept 0 to make it easier to understand p(0) completely means 0 candy bars so $0.00 was spent for it.

      Hope this helps..........Sorry if you already had it. It been a month xD.
      (1 vote)
  • purple pi teal style avatar for user Tara Dieringer
    Okay, so this problem ends with [0, 400]. I totally get why, you can choose any amount of candy bars (in integers, because you can't buy a fraction of a candy bar; that would be rude) until the store runs out. My question is: Would it be the same thing to say (-1, 401), or [0, 401), or (-1, 400], instead? It just seems to me like they would amount to the same meaning.
    (4 votes)
    Default Khan Academy avatar avatar for user
    • leaf orange style avatar for user Benny C
      0 is the least amount of bars there are, while 400 is the most. You can't buy less than 0 candy bars and you can't be more than 400.

      So (-1, 401) wouldn't make sense because -1 is not the least amount we have. But 0 is. 401 is not the most we have. 400 is.

      Same thing with [0, 401) because 401 is not the most. That parenthesis is telling us that 401 is the most we have in stock, but that's not true. If it were true, we could theoretrically buy 400.70 candy bars, but we can't. We can't go over 400 at all.

      (-1, 400] is telling that -1 is the least amount, but you can still buy -.05. That's not possible
      (2 votes)
  • male robot hal style avatar for user gremlin
    Does the domain only refer to the input to the function? Or does it also refer to the output? For example, is the domain of P(b) different from the domain of b?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • piceratops tree style avatar for user Trischolas
    At I don't get it why does he want to include 0, as 0 candy bars can't be bought, sounds illogical. Buying 0 candy bars is equivalent to buying none, for which the function isn't defined. The Question says "Purchased" unless and until it is 1 it can't be purchased.
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user John F
      You are correct. If the definition of making a purchase is the exchange of good(s) for money then both of these things have to happen in order for a purchase to occur. And that is exactly what "purchased no candy bars" or "purchased 0 candy bars" means. The "0" and "no candy bars" negates the act of purchasing, stating a purchase hasn't occured. This has to be included because it is a possible state.
      (1 vote)
  • duskpin tree style avatar for user .
    How do I buy 0 candy bars? () Why is 0 included? I would have thought the minimum would be 1.
    (3 votes)
    Default Khan Academy avatar avatar for user
  • male robot donald style avatar for user M
    can't understand it ?
    (0 votes)
    Default Khan Academy avatar avatar for user
    • female robot amelia style avatar for user E.
      So, I have 400 candy bars (I wish!). You say, "I'd like 3.78 candy bars, please!"
      I'd say, "Uh, I actually can only sell integers of candy bars, like, 1, 2, 3, 4 candy bars."
      So you say, "Then I'd like 923 candy bars, please!"
      And I'd say, "Nope, sorry, I don't have that many. And that many would make you ill."
      So you say, "Okay, then, if 403 isn't in the domain of the candy bar function, is -7?"
      And I say, "I don't have -7 candy bars, unless you owe me some, which you don't."
      So you say, "Ah, I get it! Your domain's interval is [0, 400] because I can have a minimum of 0 candy bars and a maximum of 400! And they have to be whole numbers!"
      And I say, "Yep! I guess I should have said that! How many candy bars would you like?"
      And you say, "400, please!"
      (6 votes)
  • starky seedling style avatar for user autumnswamp
    So I can somehow "buy 0 candy bars" but not "buy 1.5 candy bars". Logical fallacy right there.
    (0 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      I don't know why you think this is a fallacy. Every time you go into a store, if you walk out without buying a candy bar, then you have bought 0 candy bars. And, if you walk in a store and you say you want to buy 1.5 candy bars, they won't let you. The candy bars are not sold in fractional units.
      There is no fallacy here.
      (4 votes)

Video transcript

Thomas has 400 candy bars in his shop and each cost 50 cents. Let p of b denote the price, p, measured in dollars of a purchase of b candy bars. Alright I input b, the number candy bars I wanna buy, and p(b) will tell me what's the purchase price is really just taking the number of candy bars multiplied by 50 cents, but we won't have to worry about that just yet. Which number type is more appropriate for the domain of the function? So just to remind ourselves, what is the domain of a function? A domain is a set of all inputs over which the function is defined. So it is the set of all b's. It is the set of all inputs over which p of b will produce a defined response So let's think about it. Is it integers or real numbers? So I could buy -- b could be 0 candy bars, 1 candy bars, 2 candy bars, all up to 400 candy bars. Could I -- Could I have a fractional can-- Could be b 0.372 of a candy bar? Well, this is a normal candy shop. It's -- each candy bar is gonna be in its own packet. It's going to be in a discrete chunk. You're not going to be able to buy 0.372 of a candy bar. You can either buy a one more or none more, so you buy your 1, 2, 3 all the way up to 400. So I would say integers -- that the domain of this function is going to be is going to be a subset of integers. It's not -- you not, you can't have a real, all real number, but integers are obviously a subset real numbers. But you can't say, hey, I'm gonna buy pi candy bars, or I'm gonna buy the square root of two candy bars. You're gonna buy integer number candy bars. Now they say, define the interval of the domain. So the fewest candy bars I could buy are 0 candy bars, and I have to decide whether I put a bracket or I put a parenthesis. I can actually buy 0 candy bars so I'm gonna put a bracket. If I put a parentheses, that means I could have values above zero but not including 0, but I want to include 0 so I'm gonna put the bracket there. So the least I could buy is 0, and in the most I could buy, the store has 400 candy bars so that's the most I can buy. The most I could buy are 400 candy bars, and I can buy 400. So I would put brackets there as well. So the interval of the domain, I would want to select integers. So b is a member of integers such that b is also a member of this interval. It could be as low as 0 including 0, and as high as 400 including 400. Got it right.